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

Method PrintBinaryInstr

Source/SpireCore/CLikeCodeGen.cpp:327–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325 }
326
327 void CLikeCodeGen::PrintBinaryInstr(CodeGenContext & ctx, BinaryInstruction * instr)
328 {
329 auto op0 = instr->Operands[0].Ptr();
330 auto op1 = instr->Operands[1].Ptr();
331 if (instr->Is<StoreInstruction>())
332 {
333 PrintOp(ctx, op0);
334 ctx.Body << " = ";
335 PrintOp(ctx, op1);
336 ctx.Body << ";\n";
337 return;
338 }
339 auto varName = ctx.DefineVariable(instr);
340 if (instr->Is<MemberLoadInstruction>())
341 {
342 ctx.Body << varName << " = ";
343 PrintBinaryInstrExpr(ctx, instr);
344 ctx.Body << ";\n";
345 return;
346 }
347 ctx.Body << varName << " = ";
348 PrintBinaryInstrExpr(ctx, instr);
349 ctx.Body << ";\n";
350 }
351
352 void CLikeCodeGen::PrintUnaryInstrExpr(CodeGenContext & ctx, UnaryInstruction * instr)
353 {

Callers

nothing calls this directly

Calls 2

DefineVariableMethod · 0.80
PtrMethod · 0.45

Tested by

no test coverage detected