diff options
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
| -rw-r--r-- | source/slang/slang-emit-c-like.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index 3438fd3f4..2605723c7 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -236,9 +236,9 @@ List<IRWitnessTableEntry*> CLikeSourceEmitter::getSortedWitnessTableEntries(IRWi // Get a sorted list of entries using RequirementKeys defined in `interfaceType`. for (UInt i = 0; i < interfaceType->getOperandCount(); i++) { - auto reqKey = cast<IRStructKey>(interfaceType->getOperand(i)); + auto reqEntry = cast<IRInterfaceRequirementEntry>(interfaceType->getOperand(i)); IRWitnessTableEntry* entry = nullptr; - if (witnessTableEntryDictionary.TryGetValue(reqKey, entry)) + if (witnessTableEntryDictionary.TryGetValue(reqEntry->getRequirementKey(), entry)) { sortedWitnessTableEntries.add(entry); } @@ -1962,6 +1962,10 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO are hashed with 'getStringHash' */ break; + case kIROp_undefined: + m_writer->emit(getName(inst)); + break; + case kIROp_IntLit: case kIROp_FloatLit: case kIROp_BoolLit: @@ -3554,6 +3558,11 @@ void CLikeSourceEmitter::emitGlobalInst(IRInst* inst) are hashed with 'getStringHash' */ break; + case kIROp_InterfaceRequirementEntry: + // Don't emit anything for interface requirement at global level. + // They are handled in `emitInterface`. + break; + case kIROp_Func: emitFunc((IRFunc*) inst); break; @@ -3610,6 +3619,10 @@ void CLikeSourceEmitter::ensureInstOperandsRec(ComputeEmitActionsContext* ctx, I ensureInstOperand(ctx, inst->getFullType()); UInt operandCount = inst->operandCount; + auto requiredLevel = EmitAction::Definition; + if (inst->op == kIROp_InterfaceType) + requiredLevel = EmitAction::ForwardDeclaration; + for(UInt ii = 0; ii < operandCount; ++ii) { // TODO: there are some special cases we can add here, @@ -3620,8 +3633,8 @@ void CLikeSourceEmitter::ensureInstOperandsRec(ComputeEmitActionsContext* ctx, I // only need the type they point to to be forward-declared. // Similarly, a `call` instruction only needs the callee // to be forward-declared, etc. - - ensureInstOperand(ctx, inst->getOperand(ii)); + + ensureInstOperand(ctx, inst->getOperand(ii), requiredLevel); } for(auto child : inst->getDecorationsAndChildren()) |
