diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-05-26 14:12:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-26 14:12:46 -0400 |
| commit | abb89b3e460e11e8f9a134199c2d559190bfc47e (patch) | |
| tree | 801c977f1dabb4539059ffaf9abb70da62dc91a7 /source/slang/slang-emit.cpp | |
| parent | 43e1b7cdc70b2fcac8a3e8ee72f5bc91726f4ec5 (diff) | |
Remove LivenessLocation (#2248)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Remove the need for LivenessLocation.
* Use LivenessMode.
* Fix some comments.
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index a128644d3..0ed17ad7c 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -736,10 +736,9 @@ Result linkAndOptimizeIR( simplifyIR(irModule); { - // Storage for liveness information - List<LivenessLocation> livenessLocations; - const bool shouldTrackLiveness = codeGenContext->shouldTrackLiveness(); - + // 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 @@ -750,9 +749,9 @@ Result linkAndOptimizeIR( // temporary variables into the IR module should take responsibility for // producing their own live-range information. // - if (shouldTrackLiveness) + if (isEnabled(livenessMode)) { - LivenessUtil::locateVariables(irModule, livenessLocations); + LivenessUtil::addVariableRangeStarts(irModule, livenessMode); } // As a late step, we need to take the SSA-form IR and move things *out* @@ -764,9 +763,7 @@ Result linkAndOptimizeIR( { // We only want to accumulate locations if liveness tracking is enabled. - List<LivenessLocation>* locsPtr = shouldTrackLiveness ? &livenessLocations : nullptr; - - eliminatePhis(codeGenContext, locsPtr, irModule); + eliminatePhis(codeGenContext, livenessMode, irModule); #if 0 dumpIRIfEnabled(codeGenContext, irModule, "PHIS ELIMINATED"); #endif @@ -774,9 +771,9 @@ Result linkAndOptimizeIR( // If liveness is enabled add liveness ranges based on the accumulated liveness locations - if (shouldTrackLiveness) + if (isEnabled(livenessMode)) { - LivenessUtil::addLivenessRanges(irModule, livenessLocations); + LivenessUtil::addRangeEnds(irModule, livenessMode); #if 0 dumpIRIfEnabled(codeGenContext, irModule, "LIVENESS"); |
