diff options
| author | Yong He <yonghe@outlook.com> | 2020-08-28 09:04:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-28 09:04:55 -0700 |
| commit | ab5b0a7f9fbc47f7c51a7ec4a20ac0be55333e93 (patch) | |
| tree | abeb62d38f2af31e39a6dac216bc77e88af8ffbc /source/slang/slang-ir.cpp | |
| parent | e9bf8de3123563df6f2ca4d3b99291c6a8c99d5d (diff) | |
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.
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
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<IRGeneric>(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<IRBuiltinDecoration>() != nullptr; + } +} // namespace Slang + |
