From 444ff4d8fdeb721b94a9424d03c162f43fb217c9 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 6 Nov 2020 10:26:27 -0800 Subject: Specialize witness table lookups. (#1596) * Specialize witness table lookups. * Remove generated files from vcxproj * Fix call to generic interface methods. --- source/slang/slang-ir-lower-generic-call.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-ir-lower-generic-call.cpp') diff --git a/source/slang/slang-ir-lower-generic-call.cpp b/source/slang/slang-ir-lower-generic-call.cpp index bd01a78fb..369bc712f 100644 --- a/source/slang/slang-ir-lower-generic-call.cpp +++ b/source/slang/slang-ir-lower-generic-call.cpp @@ -266,11 +266,17 @@ namespace Slang return; SLANG_UNEXPECTED("Nested generics specialization."); } + else if (loweredFunc->op == kIROp_lookup_interface_method) + { + lowerCallToInterfaceMethod( + callInst, cast(loweredFunc), specializeInst); + return; + } IRFuncType* funcType = cast(loweredFunc->getDataType()); translateCallInst(callInst, funcType, loweredFunc, specializeInst); } - void lowerCallToInterfaceMethod(IRCall* callInst, IRLookupWitnessMethod* lookupInst) + void lowerCallToInterfaceMethod(IRCall* callInst, IRLookupWitnessMethod* lookupInst, IRSpecialize* specializeInst) { // If we see a call(lookup_interface_method(...), ...), we need to translate // all occurences of associatedtypes. @@ -312,7 +318,10 @@ namespace Slang // Translate the new call inst as normal, taking care of packing/unpacking inputs // and outputs. translateCallInst( - newCall, cast(dispatchFunc->getFullType()), dispatchFunc, nullptr); + newCall, + cast(dispatchFunc->getFullType()), + dispatchFunc, + specializeInst); } void lowerCall(IRCall* callInst) @@ -320,7 +329,7 @@ namespace Slang if (auto specializeInst = as(callInst->getCallee())) lowerCallToSpecializedFunc(callInst, specializeInst); else if (auto lookupInst = as(callInst->getCallee())) - lowerCallToInterfaceMethod(callInst, lookupInst); + lowerCallToInterfaceMethod(callInst, lookupInst, nullptr); } void processInst(IRInst* inst) -- cgit v1.2.3