diff options
| author | Yong He <yonghe@outlook.com> | 2024-05-29 11:14:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-29 11:14:22 -0700 |
| commit | 83f176ba8a3bae5533470aed6a90663653f894b8 (patch) | |
| tree | 3e39a674cb4662c946598526f633302f139e14ab /source/slang/slang-ir-lower-generics.cpp | |
| parent | c1e34c5a29d99d8a70b4e78313bfd3d539d9206e (diff) | |
Add options to speedup compilation. (#4240)
* Add options to speedup compilation.
* Fix.
* Plumb options to DCE pass.
* Revert debug change.
* Fix regressions.
* More optimizations.
* more cleanup and fixes.
* remove comment.
* Fixes.
* Another fix.
* Fix errors.
* Fix errors.
* Add comments.
Diffstat (limited to 'source/slang/slang-ir-lower-generics.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-generics.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source/slang/slang-ir-lower-generics.cpp b/source/slang/slang-ir-lower-generics.cpp index dd85487f5..198804500 100644 --- a/source/slang/slang-ir-lower-generics.cpp +++ b/source/slang/slang-ir-lower-generics.cpp @@ -182,7 +182,8 @@ namespace Slang void stripWrapExistential(IRModule* module) { - auto& workList = *module->getContainerPool().getList<IRInst>(); + InstWorkList workList(module); + workList.add(module->getModuleInst()); for (Index i = 0; i < workList.getCount(); i++) { @@ -229,7 +230,6 @@ namespace Slang // and used to create a tuple representing the existential value. augmentMakeExistentialInsts(module); - lowerGenericFunctions(&sharedContext); if (sink->getErrorCount() != 0) return; @@ -271,4 +271,28 @@ namespace Slang // We should remove them now. stripWrapExistential(module); } + + void cleanupGenerics(TargetProgram* program, IRModule* module, DiagnosticSink* sink) + { + SharedGenericsLoweringContext sharedContext(module); + sharedContext.targetProgram = program; + sharedContext.sink = sink; + + specializeRTTIObjects(&sharedContext, sink); + + lowerTuples(module, sink); + if (sink->getErrorCount() != 0) + return; + + generateAnyValueMarshallingFunctions(&sharedContext); + if (sink->getErrorCount() != 0) + return; + + // At this point, we should no longer need to care any `WrapExistential` insts, + // although they could still exist in the IR in order to call generic stdlib functions, + // e.g. RWStucturedBuffer.Load(WrapExistential(sbuffer, type), index). + // We should remove them now. + stripWrapExistential(module); + } + } // namespace Slang |
