|
Jlm
|
#include <Trace.hpp>


Classes | |
| class | TraceStepResult |
Public Types | |
| enum class | StructuralNodePolicy { traceThroughTriviallyInvariant = 0 , traceThroughIfDetectedInvariant = 1 , traceIntoSubregions = 2 } |
Public Member Functions | |
| virtual | ~OutputTracer () |
| OutputTracer () noexcept | |
| StructuralNodePolicy | getStructuralNodePolicy () const noexcept |
| bool | isDeepInvarianceCheckingEnabled () const noexcept |
| bool | isTracingIntoSubregionsEnabled () const noexcept |
| void | setStructuralNodePolicy (StructuralNodePolicy value) noexcept |
| bool | isInterprocedural () const noexcept |
| void | setInterprocedural (bool value) noexcept |
| bool | isEnteringPhiNodes () const noexcept |
| void | setEnterPhiNodes (bool value) noexcept |
| bool | isRegionPredicateCheckingEnabled () const noexcept |
| void | setRegionPredicateCheckingEnabled (bool value) noexcept |
| bool | isInvarianceCachingEnabled () const noexcept |
| void | setInvarianceCaching (bool value) noexcept |
| void | clearInvarianceCache () |
| Output & | trace (Output &output) |
| Output & | trace (Output &output, const Region *withinRegion) |
Protected Types | |
| enum class | BackEdgeState { NoBackEdgeTaken , PossiblyBackEdgeTaken } |
Protected Member Functions | |
| TraceStepResult | traceInternal (Output &output, BackEdgeState backEdgeState, const Region *withinRegion) |
| TraceStepResult | traceGammaOutput (GammaNode &gammaNode, Output &output, BackEdgeState backEdgeState) |
| TraceStepResult | traceThetaOutput (ThetaNode &thetaNode, Output &output, BackEdgeState backEdgeState) |
| TraceStepResult | traceThetaArgument (ThetaNode &thetaNode, Output &output) |
| virtual TraceStepResult | traceStep (Output &output, BackEdgeState backEdgeState, const Region *withinRegion) |
| Output & | insertInInvarianceCache (const Output &structuralOutput, Input &structuralInput) |
| Input * | lookupInInvarianceCache (const Output &structuralOutput) |
Protected Attributes | |
| StructuralNodePolicy | structuralNodePolicy_ |
| bool | isInterprocedural_ = true |
| bool | enterPhiNodes_ = true |
| bool | enableRegionPredicateChecking_ = false |
| AlternativeRegionPredicateTracer | regionPredicateTracer_ |
| const Output * | startingOutput_ = nullptr |
| bool | enableInvarianceCaching_ = false |
| std::unordered_map< const Output *, Input * > | invariantOutputCache_ {} |
Helper class for tracing through RVSDG graphs to find the origins of outputs. Traces through simple nodes that do not affect the value, through structural nodes when the value is invariant, and out of structural nodes when the value is passed in.
It supports caching of traced values at gamma and theta outputs to avoid the retracing of a value through these structural nodes.
|
strongprotected |
Different policies for how to handle outputs of structural nodes during tracing. The policies are numbered such that a greater number means more effort is spent.
These policies only apply to gamma and theta nodes. For phi nodes, see isEnteringPhiNodes()
| Enumerator | |
|---|---|
| traceThroughTriviallyInvariant | |
| traceThroughIfDetectedInvariant | |
| traceIntoSubregions | |
|
virtualdefault |
|
noexcept |
Creates an OutputTracer with the default configuration
|
inline |
Clears the invariance cache.
This only needs to done if invariance caching is enabled.
It only needs to be done if either of the following happens:
|
inlinenoexcept |
When tracing reaches the output of a structural node, how should the tracer continue.
|
protected |
Inserts the given structuralOutput in the invariance cache. Invariance means that the structural output gets its value from one of the inputs of the structural node, so tracing can pass through the structural node without looking inside its subregions.
When determining invariance, it is important to not makse assumptions about tracing never having followed back-edges.
| structuralOutput | The structural output that was traced. |
| structuralInput | The corresponding structural input. |
structuralInput for convenience.
|
inlinenoexcept |
Checks if the current StructuralNodePolicy allows checking for invariant outputs of structural nodes by performing tracing inside the subregion(s) of the node.
|
inlinenoexcept |
Controls if tracing is allowed to enter the subregion of a phi node from its outputs. If true, tracing can go further and reach lambda or delta nodes inside of phi nodes. It does, however, mean that the result of tracing can end up inside a region that is not an ancestor of the starting region in the region tree.
|
inlinenoexcept |
|
inlinenoexcept |
Controls whether caching of structural output invariance is enabled, which can speed up tracing through deeply nested graphs.
It only caches outputs that are confirmed to be invariant, so outputs that change from variant to invariant will still be picked up. Outputs that change from invariant to variant need to trigger a manual cache invalidation.
|
inlinenoexcept |
|
inlinenoexcept |
Checks if the current StructuralNodePolicy allows tracing to enter subregions, and returning value origins that are inside subregions or sibling regions of the region where tracing started.
Enables or disables tracing into phi nodes from the outside.
| value | the new value |
Enables or disables interprocedural tracing.
| value | the new value |
Enables or disables invariant structural output caching.
| value | the new value |
|
inlinenoexcept |
Traces from the given output to find the source of the output's value. The optional parameter withinRegion prevents values from being traced out of the region. If withinRegion is a nullptr, the tracing will continue until the output no longer changes.
| output | the output to trace from. |
| withinRegion | the region where we stop tracing. |
|
protected |
Trace from the given gamma output. If the gamma output can be traced to the same gamma input in all subregions, the origin of the gamma input is returned. Otherwise, if the tracer is allowed to trace into subregions, and only one of the subregions can be the origin of the value being traced, the origin within that subregion is returned. Otherwise, the gamma output itself is returned.
output is an output of the given gammaNode | gammaNode | the gamma node to trace through |
| output | an output of the given gamma node |
| backEdgeState | enum describing the path taken from the starting output to output. |
|
protected |
Performs tracing from the given output, without updating the current starting output. Keeps tracing until the tracer is unable to find a more canonical output, or until an argument of the optional withinRegion limit is reached.
| output | the output to trace from. |
| backEdgeState | enum describing the path taken from the starting output to output. |
| withinRegion | the region tracing has to stay within, or nullptr |
|
protectedvirtual |
The innermost body of the tracing loop. Should trace at least one step, if possible. If it is not possible to trace further, the same output is returned.
| output | the output to trace from. |
| backEdgeState | enum describing the path taken from the starting output to output. |
| withinRegion | if not nullptr, tracing stops if it reaches an argument of the region. |
Reimplemented in jlm::llvm::OutputTracer.
|
protected |
Trace from the given loop variable pre argument. This function is only used when the tracing starting point is inside the theta.
output is an argument of the given thetaNode's subregion.| thetaNode | the theta node to attempt to trace out of |
| output | the theta subregion argument |
|
protected |
Trace from the the given loop output. If the loop output is found to be loop invariant, the origin of the theta input is returned. Otherwise, if the tracer is allowed to trace into the subregion of structural nodes, the traced origin of the loop variable post inside the theta is returned. Otherwise, the theta output itself is returned.
output is an output of the given thetaNode | thetaNode | the theta node to trace through |
| output | an output of the given theta node |
| backEdgeState | enum describing the path taken from the starting output to output. |
|
protected |
|
protected |