Jlm
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
jlm::llvm::StoreValueForwarding Class Referencefinal

Store Value Forwarding Optimization. More...

#include <StoreValueForwarding.hpp>

Inheritance diagram for jlm::llvm::StoreValueForwarding:
Inheritance graph
[legend]
Collaboration diagram for jlm::llvm::StoreValueForwarding:
Collaboration graph
[legend]

Classes

struct  Context
 
class  Statistics
 Store Value Forwarding Statistics class. More...
 

Public Member Functions

 ~StoreValueForwarding () noexcept override
 
 StoreValueForwarding ()
 
 StoreValueForwarding (const StoreValueForwarding &)=delete
 
 StoreValueForwarding (StoreValueForwarding &&)=delete
 
StoreValueForwardingoperator= (const StoreValueForwarding &)=delete
 
StoreValueForwardingoperator= (StoreValueForwarding &&)=delete
 
void Run (rvsdg::RvsdgModule &module, util::StatisticsCollector &statisticsCollector) override
 Perform RVSDG transformation. More...
 
- Public Member Functions inherited from jlm::rvsdg::Transformation
virtual ~Transformation () noexcept
 
 Transformation (std::string_view Name)
 
const std::string_view & GetName () const noexcept
 
void Run (RvsdgModule &module)
 Perform RVSDG transformation. More...
 

Private Member Functions

void traverseInterProceduralRegion (rvsdg::Region &region)
 
void traverseIntraProceduralRegion (rvsdg::Region &region)
 
void processLoadNode (rvsdg::SimpleNode &loadNode)
 
void forwardStoredValues (LoadTracingInfo &tracingInfo)
 
rvsdg::OutputgetStoredValueOrigin (StoreValueOrigin storeValueOrigin, rvsdg::Region &targetRegion, LoadTracingInfo &tracingInfo)
 
void connectUnroutedLoopPosts (LoadTracingInfo &tracingInfo)
 
rvsdg::OutputrouteOutputToRegion (rvsdg::Output &output, rvsdg::Region &region)
 

Private Attributes

std::unique_ptr< Contextcontext_
 

Detailed Description

Store Value Forwarding Optimization.

Store Value Forwarding is an optimization that forwards store values to eliminate redundant loads.

Definition at line 29 of file StoreValueForwarding.hpp.

Constructor & Destructor Documentation

◆ ~StoreValueForwarding()

jlm::llvm::StoreValueForwarding::~StoreValueForwarding ( )
overridedefaultnoexcept

◆ StoreValueForwarding() [1/3]

jlm::llvm::StoreValueForwarding::StoreValueForwarding ( )

Definition at line 167 of file StoreValueForwarding.cpp.

◆ StoreValueForwarding() [2/3]

jlm::llvm::StoreValueForwarding::StoreValueForwarding ( const StoreValueForwarding )
delete

◆ StoreValueForwarding() [3/3]

jlm::llvm::StoreValueForwarding::StoreValueForwarding ( StoreValueForwarding &&  )
delete

Member Function Documentation

◆ connectUnroutedLoopPosts()

void jlm::llvm::StoreValueForwarding::connectUnroutedLoopPosts ( LoadTracingInfo tracingInfo)
private

In getStoredValueOrigin(), all loop variables are created as invariant, to avoid recursive function calls looping around the graph. Instead, the post results of all created loop variables are added to a queue, and properly diverted to their correct origins by this function.

Definition at line 857 of file StoreValueForwarding.cpp.

◆ forwardStoredValues()

void jlm::llvm::StoreValueForwarding::forwardStoredValues ( LoadTracingInfo tracingInfo)
private

Performs store value forwarding to the load node represented by the given tracingInfo. Uses the metadata stored during tracing to replace the value output of the load node with the last value that was stored to the memory loaded by it.

Parameters
tracingInfothe metadata created during store value origin tracing.

Definition at line 710 of file StoreValueForwarding.cpp.

◆ getStoredValueOrigin()

rvsdg::Output & jlm::llvm::StoreValueForwarding::getStoredValueOrigin ( StoreValueOrigin  storeValueOrigin,
rvsdg::Region targetRegion,
LoadTracingInfo tracingInfo 
)
private

Gets an output providing the value stored at the given storeValueOrigin. The returned output is in the specified targetRegion. It must be the same region as the storeValueOrigin itself, or a parent region. Getting it may involve routing and creating new structural node inputs and outputs.

Parameters
storeValueOriginthe origin of the last stored value along some memory state.
targetRegionthe region the returned output should be in.
tracingInfothe metadata created during store value origin tracing.
Returns
the rvsdg output providing the stored value in the given region.

Definition at line 740 of file StoreValueForwarding.cpp.

◆ operator=() [1/2]

StoreValueForwarding& jlm::llvm::StoreValueForwarding::operator= ( const StoreValueForwarding )
delete

◆ operator=() [2/2]

StoreValueForwarding& jlm::llvm::StoreValueForwarding::operator= ( StoreValueForwarding &&  )
delete

◆ processLoadNode()

void jlm::llvm::StoreValueForwarding::processLoadNode ( rvsdg::SimpleNode loadNode)
private

Process a non-volatile load node during traversal

Parameters
loadNodethe load node to handle

Definition at line 684 of file StoreValueForwarding.cpp.

◆ routeOutputToRegion()

rvsdg::Output & jlm::llvm::StoreValueForwarding::routeOutputToRegion ( rvsdg::Output output,
rvsdg::Region region 
)
private

Helper for routing outputs that memoizes the routing to avoid creating duplicate inputs and outputs in structural nodes. The output must be in the region, or in an ancestor of the region.

Parameters
outputthe output to route
regionthe destination of the routing
Returns
an output inside region that provides the same value as output

Definition at line 874 of file StoreValueForwarding.cpp.

◆ Run()

void jlm::llvm::StoreValueForwarding::Run ( rvsdg::RvsdgModule module,
util::StatisticsCollector statisticsCollector 
)
overridevirtual

Perform RVSDG transformation.

Note
This method is expected to be called multiple times. An implementation is required to reset the objects' internal state to ensure correct behavior after every invocation.
Parameters
moduleRVSDG module the transformation is performed on.
statisticsCollectorStatistics collector for collecting transformation statistics.

Implements jlm::rvsdg::Transformation.

Definition at line 943 of file StoreValueForwarding.cpp.

◆ traverseInterProceduralRegion()

void jlm::llvm::StoreValueForwarding::traverseInterProceduralRegion ( rvsdg::Region region)
private

Traverse the given inter-procedural region

Parameters
regionthe region to traverse

Definition at line 172 of file StoreValueForwarding.cpp.

◆ traverseIntraProceduralRegion()

void jlm::llvm::StoreValueForwarding::traverseIntraProceduralRegion ( rvsdg::Region region)
private

Traverse the given intra-procedural region

Parameters
regionthe region to traverse

Definition at line 199 of file StoreValueForwarding.cpp.

Member Data Documentation

◆ context_

std::unique_ptr<Context> jlm::llvm::StoreValueForwarding::context_
private

Definition at line 122 of file StoreValueForwarding.hpp.


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