diff options
| author | Yong He <yonghe@outlook.com> | 2023-01-27 16:41:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-27 16:41:31 -0800 |
| commit | 4a66e9729175a89833e5db784bb64e6a7f60cdf2 (patch) | |
| tree | 6a3cb0da3a6682ac0f8b06e66cb8e5fcd6dff279 /source/slang/slang-emit.cpp | |
| parent | 93a6b6119b6b65c4f6b00ca12d745e21b679c82f (diff) | |
Register allocation during phi elimination. (#2613)
* Register allocation during phi elimination.
* Enhance the test case.
* Cleanup line breaks in test case.
* remove unncessary line break changes.
* More cleanups.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 00fa5d3cb..3d923179c 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -811,10 +811,17 @@ Result linkAndOptimizeIR( lowerBitCast(targetRequest, irModule); simplifyIR(irModule); + eliminateMultiLevelBreak(irModule); + + // As a late step, we need to take the SSA-form IR and move things *out* + // of SSA form, by eliminating all "phi nodes" (block parameters) and + // introducing explicit temporaries instead. Doing this at the IR level + // means that subsequent emit logic doesn't need to contend with the + // complexities of blocks with parameters. + // { // Get the liveness mode. const LivenessMode livenessMode = codeGenContext->shouldTrackLiveness() ? LivenessMode::Enabled : LivenessMode::Disabled; - // // Downstream targets may benefit from having live-range information for // local variables, and our IR currently encodes a reasonably good version @@ -830,22 +837,11 @@ Result linkAndOptimizeIR( LivenessUtil::addVariableRangeStarts(irModule, livenessMode); } - eliminateMultiLevelBreak(irModule); - - // As a late step, we need to take the SSA-form IR and move things *out* - // of SSA form, by eliminating all "phi nodes" (block parameters) and - // introducing explicit temporaries instead. Doing this at the IR level - // means that subsequent emit logic doesn't need to contend with the - // complexities of blocks with parameters. - // - - { - // We only want to accumulate locations if liveness tracking is enabled. - eliminatePhis(livenessMode, irModule); + // We only want to accumulate locations if liveness tracking is enabled. + eliminatePhis(livenessMode, irModule); #if 0 - dumpIRIfEnabled(codeGenContext, irModule, "PHIS ELIMINATED"); + dumpIRIfEnabled(codeGenContext, irModule, "PHIS ELIMINATED"); #endif - } // If liveness is enabled add liveness ranges based on the accumulated liveness locations |
