diff options
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 136bf322f..4d507de41 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -2770,12 +2770,13 @@ namespace Slang return inst; } - IRWitnessTable* IRBuilder::createWitnessTable() + IRWitnessTable* IRBuilder::createWitnessTable(IRType* baseType) { IRWitnessTable* witnessTable = createInst<IRWitnessTable>( this, kIROp_WitnessTable, - nullptr); + nullptr, + baseType); addGlobalValue(this, witnessTable); return witnessTable; } @@ -2810,12 +2811,14 @@ namespace Slang return structType; } - IRInterfaceType* IRBuilder::createInterfaceType() + IRInterfaceType* IRBuilder::createInterfaceType(UInt operandCount, IRInst* const* operands) { IRInterfaceType* interfaceType = createInst<IRInterfaceType>( this, kIROp_InterfaceType, - nullptr); + nullptr, + operandCount, + operands); addGlobalValue(this, interfaceType); return interfaceType; } @@ -4209,6 +4212,42 @@ namespace Slang dump(context, "}"); } + static void dumpInstOperandList( + IRDumpContext* context, + IRInst* inst) + { + UInt argCount = inst->getOperandCount(); + + if (argCount == 0) + return; + + UInt ii = 0; + + // Special case: make printing of `call` a bit + // nicer to look at + if (inst->op == kIROp_Call && argCount > 0) + { + dump(context, " "); + auto argVal = inst->getOperand(ii++); + dumpOperand(context, argVal); + } + + bool first = true; + dump(context, "("); + for (; ii < argCount; ++ii) + { + if (!first) + dump(context, ", "); + + auto argVal = inst->getOperand(ii); + + dumpOperand(context, argVal); + + first = false; + } + + dump(context, ")"); + } void dumpIRWitnessTableEntry( IRDumpContext* context, @@ -4234,6 +4273,8 @@ namespace Slang dumpInstTypeClause(context, inst->getFullType()); + dumpInstOperandList(context, inst); + if (!inst->getFirstChild()) { // Empty. @@ -4321,38 +4362,7 @@ namespace Slang dump(context, opInfo.name); - UInt argCount = inst->getOperandCount(); - - if(argCount == 0) - return; - - UInt ii = 0; - - // Special case: make printing of `call` a bit - // nicer to look at - if (inst->op == kIROp_Call && argCount > 0) - { - dump(context, " "); - auto argVal = inst->getOperand(ii++); - dumpOperand(context, argVal); - } - - bool first = true; - dump(context, "("); - for (; ii < argCount; ++ii) - { - if (!first) - dump(context, ", "); - - auto argVal = inst->getOperand(ii); - - dumpOperand(context, argVal); - - first = false; - } - - dump(context, ")"); - + dumpInstOperandList(context, inst); } static void dumpInstBody( |
