From ab5b0a7f9fbc47f7c51a7ec4a20ac0be55333e93 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 28 Aug 2020 09:04:55 -0700 Subject: Enable lower-generics pass universally. (#1518) * Enable lower-generics pass universally. * Exclude builtin interfaces and functions from lower-generics pass. * Update stdlib. * Fixup. * Fixes handling of nested intrinsic generic functions. * Fixes. * Fixes. --- source/slang/slang-ir.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index c5943da3c..2f27bbebc 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -5263,6 +5263,7 @@ namespace Slang case kIROp_GlobalGenericParam: case kIROp_WitnessTable: case kIROp_WitnessTableEntry: + case kIROp_InterfaceRequirementEntry: case kIROp_Block: return false; @@ -5384,6 +5385,14 @@ namespace Slang auto val = returnInst->getVal(); return val; } + + IRInst* findInnerMostGenericReturnVal(IRGeneric* generic) + { + IRInst* inst = generic; + while (auto genericInst = as(inst)) + inst = findGenericReturnVal(genericInst); + return inst; + } IRGeneric* findSpecializedGeneric(IRSpecialize* specialize) { @@ -5488,9 +5497,15 @@ namespace Slang { return ptrType && ptrType->op == kIROp_PtrType && ptrType->getOperand(0) == elementType; } + bool isPointerOfType(IRInst* ptrType, IROp opCode) { return ptrType && ptrType->op == kIROp_PtrType && ptrType->getOperand(0) && ptrType->getOperand(0)->op == opCode; } -} + bool isBuiltin(IRInst* inst) + { + return inst->findDecoration() != nullptr; + } +} // namespace Slang + -- cgit v1.2.3