Jlm
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
jlm::llvm::LoadTracingInfo Class Reference
Collaboration diagram for jlm::llvm::LoadTracingInfo:
Collaboration graph
[legend]

Public Member Functions

 LoadTracingInfo (rvsdg::SimpleNode &loadNode, OutputTracer &tracer, aa::AliasAnalysis &aliasAnalysis, rvsdg::RegionPredicateTrace &regionPredicateTrace)
 
bool traceAllMemoryStateInputs ()
 
std::optional< ValueOrigingetLastValueOriginBeforeNode (rvsdg::Node &node, bool loopBackEdgeMaybeTaken)
 
std::optional< ValueOrigingetLastValueOriginInRegion (rvsdg::Region &region, bool loopBackEdgeMaybeTaken)
 

Public Attributes

rvsdg::SimpleNodeloadNode
 
rvsdg::OutputloadedAddress
 
std::shared_ptr< const rvsdg::TypeloadedType
 
size_t loadedTypeSize
 
AliasQueryResponseCounter storeAAResponses
 
AliasQueryResponseCounter loadAAResponses
 
std::unordered_map< rvsdg::GammaNode *, rvsdg::Output * > createdExitVars
 
std::unordered_map< rvsdg::ThetaNode *, rvsdg::ThetaNode::LoopVarcreatedLoopVars
 
std::queue< rvsdg::Input * > unroutedLoopVarPosts
 

Private Member Functions

aa::AliasAnalysis::AliasQueryResponse queryAliasAnalysisWithStore (rvsdg::SimpleNode &storeNode)
 
aa::AliasAnalysis::AliasQueryResponse queryAliasAnalysisWithLoad (rvsdg::SimpleNode &otherLoadNode)
 
ValueOrigin getLastValueOriginBeforeInput (rvsdg::Input &input, bool loopBackEdgeTaken)
 
ValueOrigin getLastValueOriginBeforeInputInternal (rvsdg::Input &input, bool loopBackEdgeTaken)
 

Private Attributes

OutputTracertracer
 
aa::AliasAnalysisaliasAnalysis
 
rvsdg::RegionPredicateTraceregionPredicateTrace
 
std::unordered_map< rvsdg::SimpleNode *, StoreNodeInfostoreNodeInfo
 
std::unordered_map< rvsdg::SimpleNode *, LoadNodeInfoloadNodeInfo
 
std::unordered_map< std::pair< rvsdg::Input *, bool >, ValueOrigin, util::Hash< std::pair< rvsdg::Input *, bool > > > lastValueOriginBeforeInput
 
std::unordered_map< std::pair< rvsdg::Node *, bool >, ValueOrigin, util::Hash< std::pair< rvsdg::Node *, bool > > > lastValueOriginBeforeNode
 
std::unordered_map< std::pair< rvsdg::Region *, bool >, ValueOrigin, util::Hash< std::pair< rvsdg::Region *, bool > > > lastValueOriginInRegion
 
util::HashSet< rvsdg::Input * > loopVarPostsToTrace
 

Detailed Description

Helper class holding info during tracing of the memory states going to a given load node. Can trace into structural nodes, and keep track of separate value origins for separate regions. If all branches lead to a value origin that can be forwarded, forwarding can be performed.

Definition at line 408 of file StoreValueForwarding.cpp.

Constructor & Destructor Documentation

◆ LoadTracingInfo()

jlm::llvm::LoadTracingInfo::LoadTracingInfo ( rvsdg::SimpleNode loadNode,
OutputTracer tracer,
aa::AliasAnalysis aliasAnalysis,
rvsdg::RegionPredicateTrace regionPredicateTrace 
)
inline

Definition at line 411 of file StoreValueForwarding.cpp.

Member Function Documentation

◆ getLastValueOriginBeforeInput()

ValueOrigin jlm::llvm::LoadTracingInfo::getLastValueOriginBeforeInput ( rvsdg::Input input,
bool  loopBackEdgeTaken 
)
inlineprivate

Attempts to trace the given memory state input back to a store node that can be forwarded. If a store node that may alias the load is encountered, unknown is returned. If structural nodes are encountered, all branches are traced. If any of the branches are not traceable, unknown is returned. If the branches lead to different store nodes, the structural node itself is returned.

During tracing, the class keeps track of the last store before nodes and region exits. If tracing different memory state chains lead to different "last store node before X", store forwarding is not possible, and unknown is returned to terminate early.

Parameters
inputthe memory state input to trace from
loopBackEdgeTakentrue if any loop back edge has been traced on the way to this input
Returns
the last node that stores to the memory loaded by the loadNode, before the input.

Definition at line 591 of file StoreValueForwarding.cpp.

◆ getLastValueOriginBeforeInputInternal()

ValueOrigin jlm::llvm::LoadTracingInfo::getLastValueOriginBeforeInputInternal ( rvsdg::Input input,
bool  loopBackEdgeTaken 
)
inlineprivate

Definition at line 632 of file StoreValueForwarding.cpp.

◆ getLastValueOriginBeforeNode()

std::optional< ValueOrigin > jlm::llvm::LoadTracingInfo::getLastValueOriginBeforeNode ( rvsdg::Node node,
bool  loopBackEdgeMaybeTaken 
)
inline

After tracing has finished, provides the last value origin before the given node.

Parameters
nodethe node to trace backwards from
loopBackEdgeMaybeTakenif true, the function uses the most conservative value origin for the node, which does not make any assumptions about loop back-edges. If false, or if tracing never reached the node after following a back-edge, the value origin found under the assumption that no back-edges have been taken is used.
Returns
the last value origin before the given node, or nullopt if the node was never reached.

Definition at line 480 of file StoreValueForwarding.cpp.

◆ getLastValueOriginInRegion()

std::optional< ValueOrigin > jlm::llvm::LoadTracingInfo::getLastValueOriginInRegion ( rvsdg::Region region,
bool  loopBackEdgeMaybeTaken 
)
inline

After tracing has finished, provides the last value origin before the end of a region. Note that this value origin may be outside the region, if the region does not clobber.

Parameters
regionthe region whose results are traced backwards from
loopBackEdgeMaybeTakenif true, the function uses the most conservative value origin for the region, which does not make any assumptions about loop back-edges. If false, or if tracing never reached the region after following a back-edge, the value origin found under the assumption that no back-edges have been taken is used.
Returns
the last value origin in the region, or nullopt if the region was never reached.

Definition at line 507 of file StoreValueForwarding.cpp.

◆ queryAliasAnalysisWithLoad()

aa::AliasAnalysis::AliasQueryResponse jlm::llvm::LoadTracingInfo::queryAliasAnalysisWithLoad ( rvsdg::SimpleNode otherLoadNode)
inlineprivate

Performs a simple alias analysis query between the LoadTracingInfo's loadNode, and the other load node given as a parameter, to determine if they read from the same address.

Parameters
otherLoadNodethe LoadOperation node

Definition at line 556 of file StoreValueForwarding.cpp.

◆ queryAliasAnalysisWithStore()

aa::AliasAnalysis::AliasQueryResponse jlm::llvm::LoadTracingInfo::queryAliasAnalysisWithStore ( rvsdg::SimpleNode storeNode)
inlineprivate

Performs a simple alias analysis query between the loadNode and the given store node, to determine if they read and write from the same exact address, possibly interfere, or if the operations are guaranteed to be fully independent.

Parameters
storeNodethe StoreOperation node

Definition at line 531 of file StoreValueForwarding.cpp.

◆ traceAllMemoryStateInputs()

bool jlm::llvm::LoadTracingInfo::traceAllMemoryStateInputs ( )
inline

Performs tracing of memory states to find value origin(s) that can be forwarded to the load. If tracing leads to nodes that may or may not clobber the load, or if different memory state inputs lead to different value origins, value forwarding is not possible, and false is returned. Different branches of structural nodes can lead to different value origins, as long as all memory states lead to the same store node in each branch.

Returns
true iff all memory state inputs could be traced to the same value origin(s).

Definition at line 437 of file StoreValueForwarding.cpp.

Member Data Documentation

◆ aliasAnalysis

aa::AliasAnalysis& jlm::llvm::LoadTracingInfo::aliasAnalysis
private

Definition at line 928 of file StoreValueForwarding.cpp.

◆ createdExitVars

std::unordered_map<rvsdg::GammaNode *, rvsdg::Output *> jlm::llvm::LoadTracingInfo::createdExitVars

Definition at line 975 of file StoreValueForwarding.cpp.

◆ createdLoopVars

std::unordered_map<rvsdg::ThetaNode *, rvsdg::ThetaNode::LoopVar> jlm::llvm::LoadTracingInfo::createdLoopVars

Definition at line 977 of file StoreValueForwarding.cpp.

◆ lastValueOriginBeforeInput

std::unordered_map< std::pair<rvsdg::Input *, bool>, ValueOrigin, util::Hash<std::pair<rvsdg::Input *, bool> > > jlm::llvm::LoadTracingInfo::lastValueOriginBeforeInput
private

Definition at line 943 of file StoreValueForwarding.cpp.

◆ lastValueOriginBeforeNode

std::unordered_map< std::pair<rvsdg::Node *, bool>, ValueOrigin, util::Hash<std::pair<rvsdg::Node *, bool> > > jlm::llvm::LoadTracingInfo::lastValueOriginBeforeNode
private

Definition at line 953 of file StoreValueForwarding.cpp.

◆ lastValueOriginInRegion

std::unordered_map< std::pair<rvsdg::Region *, bool>, ValueOrigin, util::Hash<std::pair<rvsdg::Region *, bool> > > jlm::llvm::LoadTracingInfo::lastValueOriginInRegion
private

Definition at line 964 of file StoreValueForwarding.cpp.

◆ loadAAResponses

AliasQueryResponseCounter jlm::llvm::LoadTracingInfo::loadAAResponses

Definition at line 922 of file StoreValueForwarding.cpp.

◆ loadedAddress

rvsdg::Output* jlm::llvm::LoadTracingInfo::loadedAddress

Definition at line 916 of file StoreValueForwarding.cpp.

◆ loadedType

std::shared_ptr<const rvsdg::Type> jlm::llvm::LoadTracingInfo::loadedType

Definition at line 917 of file StoreValueForwarding.cpp.

◆ loadedTypeSize

size_t jlm::llvm::LoadTracingInfo::loadedTypeSize

Definition at line 918 of file StoreValueForwarding.cpp.

◆ loadNode

rvsdg::SimpleNode& jlm::llvm::LoadTracingInfo::loadNode

Definition at line 915 of file StoreValueForwarding.cpp.

◆ loadNodeInfo

std::unordered_map<rvsdg::SimpleNode *, LoadNodeInfo> jlm::llvm::LoadTracingInfo::loadNodeInfo
private

Definition at line 934 of file StoreValueForwarding.cpp.

◆ loopVarPostsToTrace

util::HashSet<rvsdg::Input *> jlm::llvm::LoadTracingInfo::loopVarPostsToTrace
private

Definition at line 969 of file StoreValueForwarding.cpp.

◆ regionPredicateTrace

rvsdg::RegionPredicateTrace& jlm::llvm::LoadTracingInfo::regionPredicateTrace
private

Definition at line 929 of file StoreValueForwarding.cpp.

◆ storeAAResponses

AliasQueryResponseCounter jlm::llvm::LoadTracingInfo::storeAAResponses

Definition at line 921 of file StoreValueForwarding.cpp.

◆ storeNodeInfo

std::unordered_map<rvsdg::SimpleNode *, StoreNodeInfo> jlm::llvm::LoadTracingInfo::storeNodeInfo
private

Definition at line 932 of file StoreValueForwarding.cpp.

◆ tracer

OutputTracer& jlm::llvm::LoadTracingInfo::tracer
private

Definition at line 927 of file StoreValueForwarding.cpp.

◆ unroutedLoopVarPosts

std::queue<rvsdg::Input *> jlm::llvm::LoadTracingInfo::unroutedLoopVarPosts

Definition at line 979 of file StoreValueForwarding.cpp.


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