MCPcopy Create free account
hub / github.com/csyonghe/Spire / DefineVariable

Method DefineVariable

Source/SpireCore/CLikeCodeGen.cpp:1085–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1083 }
1084
1085 String CodeGenContext::DefineVariable(ILOperand * op)
1086 {
1087 String rs;
1088 if (VarName.TryGetValue(op, rs))
1089 {
1090 return rs;
1091 }
1092 else
1093 {
1094 auto name = GenerateCodeName(op->Name, "");
1095 codeGen->PrintDef(Header, op->Type.Ptr(), name);
1096 if (op->Type->IsInt() || op->Type->IsUInt())
1097 {
1098 Header << " = 0";
1099 }
1100 Header << ";\n";
1101 VarName.Add(op, name);
1102 op->Name = name;
1103 return op->Name;
1104 }
1105 }
1106 }
1107}

Callers 9

PrintBinaryInstrMethod · 0.80
PrintUnaryInstrMethod · 0.80
PrintAllocVarInstrMethod · 0.80
PrintFetchArgInstrMethod · 0.80
PrintSelectInstrMethod · 0.80
PrintCallInstrMethod · 0.80
PrintCastF2IInstrMethod · 0.80
PrintCastI2FInstrMethod · 0.80
PrintImportInstrMethod · 0.80

Calls 6

PrintDefMethod · 0.80
IsIntMethod · 0.80
IsUIntMethod · 0.80
TryGetValueMethod · 0.45
PtrMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected