Jlm
Public Member Functions | Public Attributes | Private Member Functions | 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)
 
bool traceAllMemoryStateInputs ()
 

Public Attributes

rvsdg::SimpleNodeloadNode
 
rvsdg::OutputloadedAddress
 
std::shared_ptr< const rvsdg::TypeloadedType
 
size_t loadedTypeSize
 
OutputTracertracer
 
aa::AliasAnalysisaliasAnalysis
 
size_t numNoAliasAnalysisQueries = 0
 
size_t numMayAliasAnalysisQueries = 0
 
size_t numMustAliasAnalysisQueries = 0
 
std::unordered_map< rvsdg::SimpleNode *, StoreNodeInfostoreNodeInfo
 
std::unordered_map< rvsdg::Input *, StoreValueOriginlastStoreBeforeInput
 
std::unordered_map< rvsdg::Node *, StoreValueOriginlastStoreBeforeNode
 
std::unordered_map< rvsdg::Region *, StoreValueOriginlastStoreInRegion
 
util::HashSet< rvsdg::Input * > loopVarPostsToTrace
 
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 queryAliasAnalysis (rvsdg::SimpleNode &storeNode)
 
StoreValueOrigin getLastStoreBeforeInput (rvsdg::Input &input)
 
StoreValueOrigin getLastStoreBeforeInputInternal (rvsdg::Input &input)
 
void updateAliasAnalysisQueryCounters (aa::AliasAnalysis::AliasQueryResponse response)
 

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 store nodes for separate regions. If all branches lead to a store that can be forwarded, forwarding can be performed.

Definition at line 320 of file StoreValueForwarding.cpp.

Constructor & Destructor Documentation

◆ LoadTracingInfo()

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

Definition at line 323 of file StoreValueForwarding.cpp.

Member Function Documentation

◆ getLastStoreBeforeInput()

StoreValueOrigin jlm::llvm::LoadTracingInfo::getLastStoreBeforeInput ( rvsdg::Input input)
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
Returns
the last node that stores to the memory loaded by the loadNode, before the input.

Definition at line 421 of file StoreValueForwarding.cpp.

◆ getLastStoreBeforeInputInternal()

StoreValueOrigin jlm::llvm::LoadTracingInfo::getLastStoreBeforeInputInternal ( rvsdg::Input input)
inlineprivate

Definition at line 457 of file StoreValueForwarding.cpp.

◆ queryAliasAnalysis()

aa::AliasAnalysis::AliasQueryResponse jlm::llvm::LoadTracingInfo::queryAliasAnalysis ( 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 387 of file StoreValueForwarding.cpp.

◆ traceAllMemoryStateInputs()

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

Performs tracing of memory states to find store node(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 store node(s), store value forwarding is not possible, and false is returned. Different branches of structural nodes can lead to different store nodes, 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 store node(s).

Definition at line 347 of file StoreValueForwarding.cpp.

◆ updateAliasAnalysisQueryCounters()

void jlm::llvm::LoadTracingInfo::updateAliasAnalysisQueryCounters ( aa::AliasAnalysis::AliasQueryResponse  response)
inlineprivate

Definition at line 627 of file StoreValueForwarding.cpp.

Member Data Documentation

◆ aliasAnalysis

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

Definition at line 652 of file StoreValueForwarding.cpp.

◆ createdExitVars

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

Definition at line 676 of file StoreValueForwarding.cpp.

◆ createdLoopVars

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

Definition at line 678 of file StoreValueForwarding.cpp.

◆ lastStoreBeforeInput

std::unordered_map<rvsdg::Input *, StoreValueOrigin> jlm::llvm::LoadTracingInfo::lastStoreBeforeInput

Definition at line 663 of file StoreValueForwarding.cpp.

◆ lastStoreBeforeNode

std::unordered_map<rvsdg::Node *, StoreValueOrigin> jlm::llvm::LoadTracingInfo::lastStoreBeforeNode

Definition at line 665 of file StoreValueForwarding.cpp.

◆ lastStoreInRegion

std::unordered_map<rvsdg::Region *, StoreValueOrigin> jlm::llvm::LoadTracingInfo::lastStoreInRegion

Definition at line 668 of file StoreValueForwarding.cpp.

◆ loadedAddress

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

Definition at line 647 of file StoreValueForwarding.cpp.

◆ loadedType

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

Definition at line 648 of file StoreValueForwarding.cpp.

◆ loadedTypeSize

size_t jlm::llvm::LoadTracingInfo::loadedTypeSize

Definition at line 649 of file StoreValueForwarding.cpp.

◆ loadNode

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

Definition at line 646 of file StoreValueForwarding.cpp.

◆ loopVarPostsToTrace

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

Definition at line 673 of file StoreValueForwarding.cpp.

◆ numMayAliasAnalysisQueries

size_t jlm::llvm::LoadTracingInfo::numMayAliasAnalysisQueries = 0

Definition at line 656 of file StoreValueForwarding.cpp.

◆ numMustAliasAnalysisQueries

size_t jlm::llvm::LoadTracingInfo::numMustAliasAnalysisQueries = 0

Definition at line 657 of file StoreValueForwarding.cpp.

◆ numNoAliasAnalysisQueries

size_t jlm::llvm::LoadTracingInfo::numNoAliasAnalysisQueries = 0

Definition at line 655 of file StoreValueForwarding.cpp.

◆ storeNodeInfo

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

Definition at line 660 of file StoreValueForwarding.cpp.

◆ tracer

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

Definition at line 651 of file StoreValueForwarding.cpp.

◆ unroutedLoopVarPosts

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

Definition at line 680 of file StoreValueForwarding.cpp.


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