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

Method PrintIf

Source/SpireCore/SpirVCodeGen.cpp:4419–4448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4417 }
4418
4419 void PrintIf(IfInstruction * instr)
4420 {
4421 int operandID = GetOperandValue(instr->Operand.Ptr());
4422 operandID = ctx.ConvertBasicType(
4423 operandID,
4424 ctx.IDInfos[operandID]().GetILType(),
4425 GetTypeFromString("bool"));
4426
4427 int TrueLabel = ++ctx.CurrentID;
4428 int FalseLabel = ++ctx.CurrentID;
4429 int MergeLabel = ++ctx.CurrentID;
4430
4431 ctx.AddInstrSelectionMerge(MergeLabel);
4432 ctx.AddInstrBranchConditional(operandID, TrueLabel, FalseLabel);
4433
4434 ctx.PushScope();
4435 ctx.AddInstrLabel_AtFunctionBody(TrueLabel);
4436 GenerateCode(instr->TrueCode.Ptr(), TrueLabel);
4437 ctx.AddInstrBranch(MergeLabel);
4438 ctx.PopScope();
4439
4440 ctx.PushScope();
4441 ctx.AddInstrLabel_AtFunctionBody(FalseLabel);
4442 if (instr->FalseCode)
4443 GenerateCode(instr->FalseCode.Ptr(), FalseLabel);
4444 ctx.AddInstrBranch(MergeLabel);
4445 ctx.PopScope();
4446
4447 ctx.AddInstrLabel_AtFunctionBody(MergeLabel);
4448 }
4449
4450 void PrintFor(ForInstruction * instr)
4451 {

Callers

nothing calls this directly

Calls 10

GetTypeFromStringFunction · 0.85
ConvertBasicTypeMethod · 0.80
GetILTypeMethod · 0.80
AddInstrBranchMethod · 0.80
PtrMethod · 0.45
PushScopeMethod · 0.45
PopScopeMethod · 0.45

Tested by

no test coverage detected