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

Method PrintSelectInstr

Source/SpireCore/SpirVCodeGen.cpp:4078–4106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4076 }
4077
4078 void PrintSelectInstr(SelectInstruction * instr)
4079 {
4080 int ID0 = GetOperandValue(instr->Operands[0].Ptr());
4081 ID0 = ctx.ConvertBasicType(
4082 ID0,
4083 ctx.IDInfos[ID0]().GetILType(),
4084 GetTypeFromString("bool"));
4085
4086 int TrueLabel = ++ctx.CurrentID;
4087 int FalseLabel = ++ctx.CurrentID;
4088 int MergeLabel = ++ctx.CurrentID;
4089
4090 ctx.AddInstrSelectionMerge(MergeLabel);
4091 ctx.AddInstrBranchConditional(ID0, TrueLabel, FalseLabel);
4092
4093 ctx.AddInstrLabel_AtFunctionBody(TrueLabel);
4094 int ID1 = GetOperandValue(instr->Operands[1].Ptr());
4095 ID1 = ctx.ConvertBasicType(ID1, ctx.IDInfos[ID1]().GetILType(), instr->Type);
4096 ctx.AddInstrBranch(MergeLabel);
4097
4098 ctx.AddInstrLabel_AtFunctionBody(FalseLabel);
4099 int ID2 = GetOperandValue(instr->Operands[2].Ptr());
4100 ID2 = ctx.ConvertBasicType(ID2, ctx.IDInfos[ID2]().GetILType(), instr->Type);
4101 ctx.AddInstrBranch(MergeLabel);
4102
4103 ctx.AddInstrLabel_AtFunctionBody(MergeLabel);
4104
4105 ctx.AddInstrPhi((ILOperand*)instr, ID1, TrueLabel, ID2, FalseLabel);
4106 }
4107
4108 void PrintFetchArgInstr(FetchArgInstruction * instr)
4109 {

Callers

nothing calls this directly

Calls 9

GetTypeFromStringFunction · 0.85
ConvertBasicTypeMethod · 0.80
GetILTypeMethod · 0.80
AddInstrBranchMethod · 0.80
AddInstrPhiMethod · 0.80
PtrMethod · 0.45

Tested by

no test coverage detected