diff options
| author | Yong He <yonghe@outlook.com> | 2022-10-13 20:31:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-13 20:31:30 -0700 |
| commit | 09408e32d7c0ccebf38fe31b5d2ddf4b1cd128e4 (patch) | |
| tree | 65e0f711de39f2d095aed8f15798668975375e08 /source/slang/slang-ir-inline.cpp | |
| parent | 27d7961db15ed5890d2ad0eff1218e26dcdaf82c (diff) | |
Allow multi-level breaks to break out of `switch` statements. (#2451)
* Allow multi-level breaks to break out of `switch` statements.
* Rename loop->region.
* Add `[ForceInline]` attribute.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-inline.cpp')
| -rw-r--r-- | source/slang/slang-ir-inline.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/slang/slang-ir-inline.cpp b/source/slang/slang-ir-inline.cpp index 70d98d10c..8f5412fa6 100644 --- a/source/slang/slang-ir-inline.cpp +++ b/source/slang/slang-ir-inline.cpp @@ -516,6 +516,28 @@ void performMandatoryEarlyInlining(IRModule* module) pass.considerAllCallSites(); } +struct ForceInliningPass : InliningPassBase +{ + typedef InliningPassBase Super; + + ForceInliningPass(IRModule* module) + : Super(module) + {} + + bool shouldInline(CallSiteInfo const& info) + { + if (info.callee->findDecoration<IRForceInlineDecoration>() || + info.callee->findDecoration<IRUnsafeForceInlineEarlyDecoration>()) + return true; + return false; + } +}; + +void performForceInlining(IRModule* module) +{ + ForceInliningPass pass(module); + pass.considerAllCallSites(); +} // Defined in slang-ir-specialize-resource.cpp bool isResourceType(IRType* type); |
