diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-05-05 09:09:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-05 09:09:25 -0400 |
| commit | e3e0132743ada1569cefe18bfbf54178330204c4 (patch) | |
| tree | a85b3992f97f67a5520a520dd60677d382ee4ce6 /source/slang/slang-emit-c-like.cpp | |
| parent | ef314f1b417e92b2fd27e3ed7f504a711c49231b (diff) | |
Preliminary Liveness tracking (#2218)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP tracking liveness.
* Skeleton around adding liveness instructions.
* Calling into liveness tracking logic.
Adds live start to var insts.
* Liveness macros have initial output.
* Looking at different initialization scenarios.
* Some discussion around liveness.
* WIP for working out liveness end.
* WIP Updated liveness using use lists.
* Is now adding liveness information
* Some small fixes.
* WIP around liveness.
* Seems to output liveness correctly for current scenario.
* Tidy up liveness code.
* Update comment arounds liveness to current status.
* Small fixes to liveness test.
* Add support for call in liveness analysis.
* Improve liveness example with array access.
* Small updates to comments.
* Disable liveness test because inconsistencies with output on CI system.
* Fix some issues brought up in PR.
* Rename liveness instructions.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
| -rw-r--r-- | source/slang/slang-emit-c-like.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index dccfde7b7..90ccb3e73 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -405,6 +405,43 @@ void CLikeSourceEmitter::emitType(IRType* type, NameLoc const& nameAndLoc) emitType(type, nameAndLoc.name, nameAndLoc.loc); } + +void CLikeSourceEmitter::emitLivenessImpl(IRInst* inst) +{ + + auto liveMarker = as<IRLiveRangeMarker>(inst); + if (!liveMarker) + { + return; + } + + IRInst* referenced = liveMarker->getReferenced(); + SLANG_ASSERT(referenced); + + UnownedStringSlice text; + switch (inst->getOp()) + { + case kIROp_LiveRangeStart: + { + text = UnownedStringSlice::fromLiteral("SLANG_LIVE_START"); + break; + } + case kIROp_LiveRangeEnd: + { + text = UnownedStringSlice::fromLiteral("SLANG_LIVE_END"); + break; + } + default: break; + } + + m_writer->emit(text); + m_writer->emit("("); + + emitOperand(referenced, getInfo(EmitOp::General)); + + m_writer->emit(")\n"); +} + // // Expressions // @@ -2029,6 +2066,10 @@ void CLikeSourceEmitter::_emitInst(IRInst* inst) m_writer->emit(";\n"); break; + case kIROp_LiveRangeStart: + case kIROp_LiveRangeEnd: + emitLiveness(inst); + break; case kIROp_undefined: case kIROp_DefaultConstruct: { |
