summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-generics-lowering-context.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-11-06 10:26:27 -0800
committerGitHub <noreply@github.com>2020-11-06 10:26:27 -0800
commit444ff4d8fdeb721b94a9424d03c162f43fb217c9 (patch)
tree7896e00e223d9b1a66a8479f510e60136c5713c3 /source/slang/slang-ir-generics-lowering-context.cpp
parent94861d5d8afdf216c0a507af24fdbe9fda4b66d7 (diff)
Specialize witness table lookups. (#1596)
* Specialize witness table lookups. * Remove generated files from vcxproj * Fix call to generic interface methods.
Diffstat (limited to 'source/slang/slang-ir-generics-lowering-context.cpp')
-rw-r--r--source/slang/slang-ir-generics-lowering-context.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/slang/slang-ir-generics-lowering-context.cpp b/source/slang/slang-ir-generics-lowering-context.cpp
index 9c4eb7856..bef4dbb0a 100644
--- a/source/slang/slang-ir-generics-lowering-context.cpp
+++ b/source/slang/slang-ir-generics-lowering-context.cpp
@@ -219,6 +219,21 @@ namespace Slang
}
}
+ List<IRWitnessTable*> SharedGenericsLoweringContext::getWitnessTablesFromInterfaceType(IRInst* interfaceType)
+ {
+ List<IRWitnessTable*> witnessTables;
+ for (auto globalInst : module->getGlobalInsts())
+ {
+ if (globalInst->op == kIROp_WitnessTable &&
+ cast<IRWitnessTableType>(globalInst->getDataType())->getConformanceType() ==
+ interfaceType)
+ {
+ witnessTables.add(cast<IRWitnessTable>(globalInst));
+ }
+ }
+ return witnessTables;
+ }
+
IRIntegerValue SharedGenericsLoweringContext::getInterfaceAnyValueSize(IRInst* type, SourceLoc usageLocation)
{
if (auto decor = type->findDecoration<IRAnyValueSizeDecoration>())