Jlm
Loading...
Searching...
No Matches
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...
 
struct  TracedDelta
 

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.
 
- 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.
 

Private Member Functions

void traverseInterProceduralRegion (rvsdg::Region &region)
 
void traverseIntraProceduralRegion (rvsdg::Region &region)
 
void processLoad (rvsdg::SimpleNode &loadNode)
 
void processLoadWithoutMemoryStates (rvsdg::SimpleNode &loadNode)
 
std::optional< TracedDeltatraceLoadWithoutMemoryStates (const rvsdg::SimpleNode &loadNode)
 
void forwardLoadWithoutMemoryStates (rvsdg::SimpleNode &loadNode, const TracedDelta &tracedDelta)
 
void processLoadWithMemoryStates (rvsdg::SimpleNode &loadNode)
 
void forwardValueOrigins (LoadTracingInfo &tracingInfo)
 
rvsdg::OutputgetValueOriginOutput (ValueOrigin 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 30 of file StoreValueForwarding.hpp.

Constructor & Destructor Documentation

◆ ~StoreValueForwarding()

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

◆ StoreValueForwarding() [1/3]

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

Definition at line 237 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 getValueOriginOutput(), 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 1492 of file StoreValueForwarding.cpp.

◆ forwardLoadWithoutMemoryStates()

void jlm::llvm::StoreValueForwarding::forwardLoadWithoutMemoryStates ( rvsdg::SimpleNode loadNode,
const TracedDelta tracedDelta 
)
private

Forwards a traced LoadNonVolatileOperation node without memory states.

Parameters
loadNodeThe LoadNonVolatileOperation node to handle.
tracedDeltaThe TracedDelta information of loadNode.

Definition at line 1301 of file StoreValueForwarding.cpp.

◆ forwardValueOrigins()

void jlm::llvm::StoreValueForwarding::forwardValueOrigins ( 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 1338 of file StoreValueForwarding.cpp.

◆ getValueOriginOutput()

rvsdg::Output & jlm::llvm::StoreValueForwarding::getValueOriginOutput ( ValueOrigin  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 1368 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

◆ processLoad()

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

Process a non-volatile load node during traversal

Parameters
loadNodethe load node to handle

Definition at line 983 of file StoreValueForwarding.cpp.

◆ processLoadWithMemoryStates()

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

Process a LoadNonVolatileOperation node with no memory states during traversal

Parameters
loadNodeThe LoadNonVolatileOperation node to handle

Definition at line 1000 of file StoreValueForwarding.cpp.

◆ processLoadWithoutMemoryStates()

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

Process a LoadNonVolatileOperation node with memory states during traversal

Parameters
loadNodeThe LoadNonVolatileOperation node to handle

Definition at line 1026 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 1514 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 1603 of file StoreValueForwarding.cpp.

◆ traceLoadWithoutMemoryStates()

std::optional< StoreValueForwarding::TracedDelta > jlm::llvm::StoreValueForwarding::traceLoadWithoutMemoryStates ( const rvsdg::SimpleNode loadNode)
private

Try to trace a LoadNonVolatileOperation node without memory states to a delta node.

Parameters
loadNodeThe LoadNonVolatileOperation node to handle
Returns
The TracedDelta information if tracing was successful, otherwise std::nullopt.

Definition at line 1045 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 242 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 269 of file StoreValueForwarding.cpp.

Member Data Documentation

◆ context_

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

Definition at line 174 of file StoreValueForwarding.hpp.


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