diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-21 14:00:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-21 14:00:48 -0700 |
| commit | 5b2eb06816521cc0fcfe03258452560bd200002d (patch) | |
| tree | dc06cc626ff0059dded3f4245f9309b3071ae94c /source/slang/slang-ir.cpp | |
| parent | af8ce68e9fd7b6255b6e4e9e9524a285497116dc (diff) | |
Various slangpy fixes. (#3227)
* Make dynamic cast transparent through `IRAttributedType`.
* Add [CUDAXxx] variant of attributes.
* Support marshaling of vector types.
* Wrap cuda kernels in `extern "C"` block.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 95d6c9e1f..ff6c8c39e 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -304,12 +304,12 @@ namespace Slang IRParam* IRParam::getNextParam() { - return as<IRParam>(getNextInst()); + return as<IRParam, IRDynamicCastBehavior::NoUnwrap>(getNextInst()); } IRParam* IRParam::getPrevParam() { - return as<IRParam>(getPrevInst()); + return as<IRParam, IRDynamicCastBehavior::NoUnwrap>(getPrevInst()); } // IRArrayTypeBase @@ -472,7 +472,7 @@ namespace Slang // If the last instruction is a parameter, then // there are no ordinary instructions, so the last // one is a null pointer. - if (as<IRParam>(inst)) + if (as<IRParam, IRDynamicCastBehavior::NoUnwrap>(inst)) return nullptr; // Otherwise the last instruction is the last "ordinary" @@ -1643,8 +1643,8 @@ namespace Slang // instructions, so they need to come after // any parameters of the parent. // - while(auto param = as<IRParam>(insertBeforeInst)) - insertBeforeInst = param->getNextInst(); + while (insertBeforeInst && insertBeforeInst->getOp() == kIROp_Param) + insertBeforeInst = insertBeforeInst->getNextInst(); // For instructions that will be placed at module scope, // we don't care about relative ordering, but for everything @@ -6425,14 +6425,14 @@ namespace Slang // First walk through any `param` instructions, // so that we can format them nicely - if (auto firstParam = as<IRParam>(inst)) + if (auto firstParam = as<IRParam, IRDynamicCastBehavior::NoUnwrap>(inst)) { dump(context, "(\n"); context->indent += 2; for(;;) { - auto param = as<IRParam>(inst); + auto param = as<IRParam, IRDynamicCastBehavior::NoUnwrap>(inst); if (!param) break; |
