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

Method GetOperandPointer

Source/SpireCore/SpirVCodeGen.cpp:3411–3437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3409 }
3410
3411 int GetOperandPointer(ILOperand * op)
3412 {
3413 int id = -1;
3414 //RefPtr<ILType> result_type;
3415 if (auto c = dynamic_cast<ILConstOperand*>(op))
3416 {
3417 int valueID = GetOperandValue(op);
3418 id = ctx.AddInstrVariableDeclaration(op, op->Type, StorageClass::Function);
3419 ctx.AddInstrStore(op, id, valueID);
3420 }
3421 else if (auto instr = dynamic_cast<ILInstruction*>(op))
3422 {
3423 id = ctx.FindVariableID(op);
3424 if (id == -1)
3425 {
3426 int valueID = ctx.FindValueID(op);
3427 if (valueID == -1)
3428 throw InvalidOperationException("can not find variable ID in Get OperandPointer(): " + op->ToString());
3429 id = ctx.AddInstrVariableDeclaration(op, instr->Type, StorageClass::Function);
3430 ctx.AddInstrStore(op, id, valueID);
3431 }
3432 }
3433 else
3434 throw InvalidOperationException("Unsupported operand type.");
3435
3436 return id;
3437 }
3438
3439 void PrintAllocVarInstr(AllocVarInstruction * instr, StorageClass store)
3440 {

Callers

nothing calls this directly

Calls 6

AddInstrStoreMethod · 0.80
FindVariableIDMethod · 0.80
FindValueIDMethod · 0.80
ToStringMethod · 0.45

Tested by

no test coverage detected