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

#include <AliasAnalysisPrecisionEvaluator.hpp>

Collaboration diagram for jlm::llvm::aa::AliasAnalysisPrecisionEvaluator:
Collaboration graph
[legend]

Classes

struct  AggregatedClobberInfos
 
struct  Context
 
struct  PrecisionInfo
 
class  PrecisionStatistics
 

Public Member Functions

 AliasAnalysisPrecisionEvaluator ()
 
 ~AliasAnalysisPrecisionEvaluator () noexcept
 
void SetLoadsConsideredClobbers (bool loadsConsideredClobbers) noexcept
 
bool AreLoadsConsideredClobbers () const noexcept
 
void SetDeduplicatePointers (bool deduplicatePointers) noexcept
 
bool IsDeduplicatingPointers () const noexcept
 
void SetAliasingGraphEnabled (bool aliasingGraphEnabled) noexcept
 
bool IsAliasingGraphEnabled () const noexcept
 
void SetPerFunctionOutputEnabled (bool perFunctionOutputEnabled) noexcept
 
bool IsPerFunctionOutputEnabled () const noexcept
 
void EvaluateAliasAnalysisClient (const rvsdg::RvsdgModule &rvsdgModule, AliasAnalysis &aliasAnalysis, util::StatisticsCollector &statisticsCollector)
 

Private Member Functions

void EvaluateAllFunctions (const rvsdg::Region &region, AliasAnalysis &aliasAnalysis)
 
void EvaluateFunction (const rvsdg::LambdaNode &function, AliasAnalysis &aliasAnalysis)
 
void CollectPointersFromRegion (const rvsdg::Region &region)
 
void CollectPointersFromSimpleNode (const rvsdg::SimpleNode &node)
 
void CollectPointersFromStructuralNode (const rvsdg::StructuralNode &node)
 
void CollectPointer (const rvsdg::Output *value, size_t size, bool isClobber)
 
void NormalizePointerValues ()
 
void AggregateDuplicates ()
 
void CalculateResults (std::optional< util::FilePath > perFunctionOutput, PrecisionStatistics &statistics) const
 
void AddToAliasingGraph (const rvsdg::Output &p1, size_t s1, const rvsdg::Output &p2, size_t s2, AliasAnalysis::AliasQueryResponse response)
 

Static Private Member Functions

static AggregatedClobberInfos AggregateClobberInfos (const std::vector< PrecisionInfo::ClobberInfo > &clobberInfos)
 
static void PrintAggregatedClobberInfos (const AggregatedClobberInfos &clobberInfos, std::ostream &out)
 

Private Attributes

bool LoadsConsideredClobbers_ = false
 
bool DeduplicatePointers_ = false
 
bool AliasingGraphEnabled_ = false
 
bool PerFunctionOutputEnabled_ = false
 
Context Context_
 

Detailed Description

Class for evaluating the precision of a PointsToGraph on an RVSDG module. Uses a pairwise alias analysis to ask MayAlias queries on relevant pairs of pointers. Only considers load and store operations, and not function calls.

Definition at line 30 of file AliasAnalysisPrecisionEvaluator.hpp.

Constructor & Destructor Documentation

◆ AliasAnalysisPrecisionEvaluator()

jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::AliasAnalysisPrecisionEvaluator ( )
default

◆ ~AliasAnalysisPrecisionEvaluator()

jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::~AliasAnalysisPrecisionEvaluator ( )
defaultnoexcept

Member Function Documentation

◆ AddToAliasingGraph()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::AddToAliasingGraph ( const rvsdg::Output p1,
size_t  s1,
const rvsdg::Output p2,
size_t  s2,
AliasAnalysis::AliasQueryResponse  response 
)
private

Creates nodes corresponding to operations on p1 and p2 in the aliasing graph, and adds an edge between them based on the alias response.

Parameters
p1the first pointer
s1the size of the operation at the first pointer
p2the second pointer
s2the size of the operation at the second pointer
responsethe result of performing an alias query on the operation pair

Definition at line 359 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ AggregateClobberInfos()

AliasAnalysisPrecisionEvaluator::AggregatedClobberInfos jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::AggregateClobberInfos ( const std::vector< PrecisionInfo::ClobberInfo > &  clobberInfos)
staticprivate

Adds up a list of ClobberInfo structs, where each element represents N clobber operations Returns results for the average clobber, as well as total alias query response counts

Definition at line 402 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ AggregateDuplicates()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::AggregateDuplicates ( )
private

Removes repeated instances of the same (pointer, size) pair in the current context. If IsDeduplicatingPointers() is true, duplicate instances are discarded. Otherwise, the duplicated instances are added up and given a multiplier.

Definition at line 327 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ AreLoadsConsideredClobbers()

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::AreLoadsConsideredClobbers ( ) const
inlinenoexcept

Definition at line 54 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ CalculateResults()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::CalculateResults ( std::optional< util::FilePath perFunctionOutput,
PrecisionStatistics statistics 
) const
private

Called once all functions have been evaluated, to calculate and print averages. Adds up both the total number of responses, and calculates average response rates per clobber.

Parameters
perFunctionOutputif given, statistics about each function are written to the file
statisticsthe statistics instance where the final module-level statistics are written

Definition at line 463 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ CollectPointer()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::CollectPointer ( const rvsdg::Output value,
size_t  size,
bool  isClobber 
)
private

Adds the given pointer + size to the list of operations in the function being evaluated

Definition at line 307 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ CollectPointersFromRegion()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::CollectPointersFromRegion ( const rvsdg::Region region)
private

Definition at line 256 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ CollectPointersFromSimpleNode()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::CollectPointersFromSimpleNode ( const rvsdg::SimpleNode node)
private

Definition at line 276 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ CollectPointersFromStructuralNode()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::CollectPointersFromStructuralNode ( const rvsdg::StructuralNode node)
private

Definition at line 297 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ EvaluateAliasAnalysisClient()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::EvaluateAliasAnalysisClient ( const rvsdg::RvsdgModule rvsdgModule,
AliasAnalysis aliasAnalysis,
util::StatisticsCollector statisticsCollector 
)

Performs alias analysis precision evaluation on the given rvsdgModule, using the given aliasAnalysis instance. If the given statisticsCollector does not demand Statistics::Id::AliasAnalysisPrecisionEvaluation, evaluation is skipped.

Definition at line 109 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ EvaluateAllFunctions()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::EvaluateAllFunctions ( const rvsdg::Region region,
AliasAnalysis aliasAnalysis 
)
private

Definition at line 163 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ EvaluateFunction()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::EvaluateFunction ( const rvsdg::LambdaNode function,
AliasAnalysis aliasAnalysis 
)
private

Definition at line 181 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ IsAliasingGraphEnabled()

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::IsAliasingGraphEnabled ( ) const
inlinenoexcept

Definition at line 94 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ IsDeduplicatingPointers()

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::IsDeduplicatingPointers ( ) const
inlinenoexcept

Definition at line 73 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ IsPerFunctionOutputEnabled()

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::IsPerFunctionOutputEnabled ( ) const
inlinenoexcept

Definition at line 112 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ NormalizePointerValues()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::NormalizePointerValues ( )
private

Updates the pointers collected in the current context by tracing their origin. This is only done for pointers that are trivially passed directly through nodes or into regions.

Definition at line 317 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ PrintAggregatedClobberInfos()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::PrintAggregatedClobberInfos ( const AggregatedClobberInfos clobberInfos,
std::ostream &  out 
)
staticprivate

Outputs the aggregated clobber infos to the given output stream

Parameters
clobberInfosthe result of aggregating a set of clobbering operations
outthe stream to write the results to

Definition at line 441 of file AliasAnalysisPrecisionEvaluator.cpp.

◆ SetAliasingGraphEnabled()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::SetAliasingGraphEnabled ( bool  aliasingGraphEnabled)
inlinenoexcept

Enables or disables the creation of an aliasing graph. When enabled, the pass produces a GraphWriter output of the module, with an additional graph containing pointer values, and edges connecting pairs of pointers where the alias analysis responded MayAlias and MustAlias. The graph is written to an output file in the statistics directory.

Parameters
aliasingGraphEnabledif true, evaluation will produce an aliasing graph.

Definition at line 88 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ SetDeduplicatePointers()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::SetDeduplicatePointers ( bool  deduplicatePointers)
inlinenoexcept

Enables or disables the deduplication of pointers during precision evaluation. Deduplication removes duplicate instances of (pointer, size) operations in each function. If any of the (pointer, size) operations is a clobber, the deduplicated operation is a clobber.

Parameters
deduplicatePointersif true, pointers will be deduplicated.

Definition at line 67 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ SetLoadsConsideredClobbers()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::SetLoadsConsideredClobbers ( bool  loadsConsideredClobbers)
inlinenoexcept

Makes loads count as clobbering operations. Alias queries are only made between pairs operations if at least one of them is a clobber. If alias queries between pairs of loads are desired, set this to true.

Default: false

Parameters
loadsConsideredClobbersif true, loads will be clobbers.

Definition at line 48 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ SetPerFunctionOutputEnabled()

void jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::SetPerFunctionOutputEnabled ( bool  perFunctionOutputEnabled)
inlinenoexcept

Enables or disables the creation of a file containing precision statistics per function. When enabled, the file is created in the statistics output directory.

Parameters
perFunctionOutputEnabledif true, evaluation will print output per function to a file.

Definition at line 106 of file AliasAnalysisPrecisionEvaluator.hpp.

Member Data Documentation

◆ AliasingGraphEnabled_

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::AliasingGraphEnabled_ = false
private

Definition at line 285 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ Context_

Context jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::Context_
private

Definition at line 291 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ DeduplicatePointers_

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::DeduplicatePointers_ = false
private

Definition at line 282 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ LoadsConsideredClobbers_

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::LoadsConsideredClobbers_ = false
private

Definition at line 279 of file AliasAnalysisPrecisionEvaluator.hpp.

◆ PerFunctionOutputEnabled_

bool jlm::llvm::aa::AliasAnalysisPrecisionEvaluator::PerFunctionOutputEnabled_ = false
private

Definition at line 288 of file AliasAnalysisPrecisionEvaluator.hpp.


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