summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-06-25 14:01:33 -0700
committerYong He <yonghe@outlook.com>2020-06-25 14:01:33 -0700
commit509e36b62de7578843abc2547921beadff7a3ce0 (patch)
treea74096fa8a71a69f5645fc7ad4b94b0bf8860ac1 /source/slang/slang-lower-to-ir.cpp
parenta1fed5e49bc1c8452752d13d401ee0bbbc5c71c4 (diff)
Remove interfaceType operand from lookup_witness_method inst
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 96d4b121f..5bd983cab 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -1049,7 +1049,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
{
return emitDeclRef(context, val->declRef,
context->irBuilder->getWitnessTableType(
- lowerType(context, DeclRefType::create(context->astBuilder, val->declRef))));
+ lowerType(context, val->sup)));
}
LoweredValInfo visitTransitiveSubtypeWitness(
@@ -1071,10 +1071,9 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
// to reflect the right constraints.
return LoweredValInfo::simple(getBuilder()->emitLookupInterfaceMethodInst(
- nullptr,
+ getBuilder()->getWitnessTableType(lowerType(context, val->sup)),
baseWitnessTable,
- requirementKey,
- lowerType(context, val->subToMid->sup)));
+ requirementKey));
}
LoweredValInfo visitTaggedUnionSubtypeWitness(
@@ -1255,8 +1254,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
auto caseFunc = subBuilder->emitLookupInterfaceMethodInst(
caseFuncType,
caseWitnessTable,
- irReqKey,
- irWitnessTableBaseType);
+ irReqKey);
// We are going to emit a `call` to the satisfying value
// for the case type, so we will collect the arguments for that call.
@@ -5311,7 +5309,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
auto constraintKey = getInterfaceRequirementKey(constraintDecl);
requirementEntries.add(
subBuilder->createInterfaceRequirementEntry(constraintKey,
- lowerType(context, constraintDecl->getSup().type)));
+ getBuilder()->getWitnessTableType(lowerType(context, constraintDecl->getSup().type))));
}
}
}
@@ -6578,9 +6576,9 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
for (UInt i = 0; i < irInterfaceType->getOperandCount(); i++)
{
auto operand = cast<IRInterfaceRequirementEntry>(irInterfaceType->getOperand(i));
- if (operand->getOperand(0) == key)
+ if (operand->getRequirementKey() == key)
{
- operand->setOperand(1, irFuncType);
+ operand->setRequirementVal(irFuncType);
return;
}
}
@@ -6874,8 +6872,7 @@ LoweredValInfo emitDeclRef(
auto irSatisfyingVal = context->irBuilder->emitLookupInterfaceMethodInst(
type,
irWitnessTable,
- irRequirementKey,
- lowerType(context, thisTypeSubst->witness->sup));
+ irRequirementKey);
return LoweredValInfo::simple(irSatisfyingVal);
}
else