diff options
| author | Yong He <yonghe@outlook.com> | 2020-11-06 10:26:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-06 10:26:27 -0800 |
| commit | 444ff4d8fdeb721b94a9424d03c162f43fb217c9 (patch) | |
| tree | 7896e00e223d9b1a66a8479f510e60136c5713c3 /source/slang/slang-ir-lower-generic-call.cpp | |
| parent | 94861d5d8afdf216c0a507af24fdbe9fda4b66d7 (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-lower-generic-call.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-generic-call.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
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<IRLookupWitnessMethod>(loweredFunc), specializeInst); + return; + } IRFuncType* funcType = cast<IRFuncType>(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<IRFuncType>(dispatchFunc->getFullType()), dispatchFunc, nullptr); + newCall, + cast<IRFuncType>(dispatchFunc->getFullType()), + dispatchFunc, + specializeInst); } void lowerCall(IRCall* callInst) @@ -320,7 +329,7 @@ namespace Slang if (auto specializeInst = as<IRSpecialize>(callInst->getCallee())) lowerCallToSpecializedFunc(callInst, specializeInst); else if (auto lookupInst = as<IRLookupWitnessMethod>(callInst->getCallee())) - lowerCallToInterfaceMethod(callInst, lookupInst); + lowerCallToInterfaceMethod(callInst, lookupInst, nullptr); } void processInst(IRInst* inst) |
