Jlm
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
jlm::rvsdg::OutputTracer Class Reference

#include <Trace.hpp>

Inheritance diagram for jlm::rvsdg::OutputTracer:
Inheritance graph
[legend]

Public Member Functions

virtual ~OutputTracer ()
 
 OutputTracer ()
 
bool isTracingThroughStructuralNodes () const noexcept
 
void setTraceThroughStructuralNodes (bool value) noexcept
 
bool isEnteringPhiNodes () const noexcept
 
void setEnterPhiNodes (bool value) noexcept
 
bool isInterprocedural () const noexcept
 
void setInterprocedural (bool value) noexcept
 
Outputtrace (Output &output)
 
OutputtryTraceThroughGamma (GammaNode &gammaNode, Output &output)
 
OutputtryTraceThroughTheta (ThetaNode &thetaNode, Output &output)
 

Protected Member Functions

Outputtrace (Output &output, bool mayLeaveRegion)
 
virtual OutputtraceStep (Output &output, bool mayLeaveRegion)
 

Protected Attributes

bool traceThroughStrucutalNodes_ = true
 
bool enterPhiNodes_ = true
 
bool isInterprocedural_ = true
 

Detailed Description

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.

Definition at line 22 of file Trace.hpp.

Constructor & Destructor Documentation

◆ ~OutputTracer()

jlm::rvsdg::OutputTracer::~OutputTracer ( )
virtualdefault

◆ OutputTracer()

jlm::rvsdg::OutputTracer::OutputTracer ( )
default

Creates an OutputTracer with the default configuration

Member Function Documentation

◆ isEnteringPhiNodes()

bool jlm::rvsdg::OutputTracer::isEnteringPhiNodes ( ) const
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.

Returns
true if tracing may enter phi nodes.

Definition at line 65 of file Trace.hpp.

◆ isInterprocedural()

bool jlm::rvsdg::OutputTracer::isInterprocedural ( ) const
inlinenoexcept

Controls if tracing is allowed to leave functions. If true, outputs can be traced out of functions via context arguments. If false, tracing stops if it reaches lambda context arguments.

Returns
true if interprocedural tracing is enabled.

Definition at line 88 of file Trace.hpp.

◆ isTracingThroughStructuralNodes()

bool jlm::rvsdg::OutputTracer::isTracingThroughStructuralNodes ( ) const
inlinenoexcept

When tracing reaches the output of a structural node, how much effort should be made to check if the output is an invariant copy of one of the node's inputs. If true, tracing is performed inside the subregion(s) of the node. If false, only a simple invariant check is performed, which only detects invariance if the region result is directly connected to a region argument.

Returns
true if tracing though the subregions of structural nodes is enabled.

Definition at line 41 of file Trace.hpp.

◆ setEnterPhiNodes()

void jlm::rvsdg::OutputTracer::setEnterPhiNodes ( bool  value)
inlinenoexcept

Enables or disables tracing into phi nodes from the outside.

See also
isEnteringPhiNodes()
Parameters
valuethe new value

Definition at line 76 of file Trace.hpp.

◆ setInterprocedural()

void jlm::rvsdg::OutputTracer::setInterprocedural ( bool  value)
inlinenoexcept

Enables or disables interprocedural tracing.

See also
isInterprocedural()
Parameters
valuethe new value

Definition at line 99 of file Trace.hpp.

◆ setTraceThroughStructuralNodes()

void jlm::rvsdg::OutputTracer::setTraceThroughStructuralNodes ( bool  value)
inlinenoexcept

Enables or disables tracing through the subregions of structural nodes.

See also
isTracingThroughStructuralNodes
Parameters
valuethe new value

Definition at line 52 of file Trace.hpp.

◆ trace() [1/2]

Output & jlm::rvsdg::OutputTracer::trace ( Output output)

Traces from the given output to find the source of the output's value.

Parameters
outputthe output to trace from.

Definition at line 20 of file Trace.cpp.

◆ trace() [2/2]

Output & jlm::rvsdg::OutputTracer::trace ( Output output,
bool  mayLeaveRegion 
)
protected

Traces from the given output to find the source of the output's value.

Parameters
outputthe output to trace from.
mayLeaveRegionif false, tracing stops if it reaches a region argument

Definition at line 26 of file Trace.cpp.

◆ traceStep()

Output & jlm::rvsdg::OutputTracer::traceStep ( Output output,
bool  mayLeaveRegion 
)
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.

Parameters
outputthe output to trace from
mayLeaveRegionif false, tracing stops if it reaches a region argument
Returns
the result of tracing from the given output, if possible. Otherwise, output.

Reimplemented in jlm::llvm::OutputTracer.

Definition at line 124 of file Trace.cpp.

◆ tryTraceThroughGamma()

Output * jlm::rvsdg::OutputTracer::tryTraceThroughGamma ( GammaNode gammaNode,
Output output 
)

Attempts to trace the output of a gamma node through the node. This is only possible if the output can be traced to a gamma entry variable in all subregions, and these entry variables all share the same origin outside the gamma.

Precondition
the output is an output of the given gammaNode
Parameters
gammaNodethe gamma node to trace through
outputan output of the given gamma node
Returns
the origin of the output value on the input side of the gamma, or nullptr.

Definition at line 64 of file Trace.cpp.

◆ tryTraceThroughTheta()

Output * jlm::rvsdg::OutputTracer::tryTraceThroughTheta ( ThetaNode thetaNode,
Output output 
)

Attempts to trace the output of a theta node through the node. This is only possible if the output is invariant within the theta node.

Precondition
the output is an output of the given thetaNode
Parameters
thetaNodethe theta node to trace through
outputan output of the given theta node
Returns
the origin of the output value on the input side of the theta, or nullptr.

Definition at line 104 of file Trace.cpp.

Member Data Documentation

◆ enterPhiNodes_

bool jlm::rvsdg::OutputTracer::enterPhiNodes_ = true
protected

Definition at line 163 of file Trace.hpp.

◆ isInterprocedural_

bool jlm::rvsdg::OutputTracer::isInterprocedural_ = true
protected

Definition at line 167 of file Trace.hpp.

◆ traceThroughStrucutalNodes_

bool jlm::rvsdg::OutputTracer::traceThroughStrucutalNodes_ = true
protected

Definition at line 159 of file Trace.hpp.


The documentation for this class was generated from the following files: