diff options
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
| -rw-r--r-- | source/slang/slang-ir-util.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index 5aae53747..9d8773237 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -2250,4 +2250,27 @@ bool isFirstBlock(IRInst* inst) return block->getParent()->getFirstBlock() == block; } +bool isSpecConstRateType(IRType* type) +{ + if (auto rateQualifiedType = as<IRRateQualifiedType>(type)) + { + if (as<IRSpecConstRate>(rateQualifiedType->getRate())) + { + return true; + } + } + return false; +} +void hoistInstAndOperandsToGlobal(IRBuilder* builder, IRInst* inst) +{ + IRInst* moduleInst = builder->getModule()->getModuleInst(); + UInt operandCount = inst->getOperandCount(); + for (UInt ii = 0; ii < operandCount; ++ii) + { + auto operand = inst->getOperand(ii); + if (operand->parent != moduleInst) + hoistInstAndOperandsToGlobal(builder, operand); + } + inst->insertAt(IRInsertLoc::atStart(moduleInst)); +} } // namespace Slang |
