LLVM  10.0.0svn
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
llvm::CacheCost Class Reference

CacheCost represents the estimated cost of a inner loop as the number of cache lines used by the memory references it contains. More...

#include "llvm/Analysis/LoopCacheAnalysis.h"

Collaboration diagram for llvm::CacheCost:
Collaboration graph
[legend]

Public Member Functions

 CacheCost (const LoopVectorTy &Loops, const LoopInfo &LI, ScalarEvolution &SE, TargetTransformInfo &TTI, AliasAnalysis &AA, DependenceInfo &DI, Optional< unsigned > TRT=None)
 Construct a CacheCost object for the loop nest described by Loops. More...
 
CacheCostTy getLoopCost (const Loop &L) const
 Return the estimated cost of loop L if the given loop is part of the loop nest associated with this object. More...
 
const ArrayRef< LoopCacheCostTy > getLoopCosts () const
 Return the estimated ordered loop costs. More...
 

Static Public Member Functions

static std::unique_ptr< CacheCostgetCacheCost (Loop &Root, LoopStandardAnalysisResults &AR, DependenceInfo &DI, Optional< unsigned > TRT=None)
 Create a CacheCost for the loop nest rooted by Root. More...
 

Static Public Attributes

static CacheCostTy constexpr InvalidCost = -1
 

Friends

raw_ostreamoperator<< (raw_ostream &OS, const CacheCost &CC)
 

Detailed Description

CacheCost represents the estimated cost of a inner loop as the number of cache lines used by the memory references it contains.

The 'cache cost' of a loop 'L' in a loop nest 'LN' is computed as the sum of the cache costs of all of its reference groups when the loop is considered to be in the innermost position in the nest. A reference group represents memory references that fall into the same cache line. Each reference group is analysed with respect to the innermost loop in a loop nest. The cost of a reference is defined as follow:

Definition at line 173 of file LoopCacheAnalysis.h.

Constructor & Destructor Documentation

◆ CacheCost()

CacheCost::CacheCost ( const LoopVectorTy Loops,
const LoopInfo LI,
ScalarEvolution SE,
TargetTransformInfo TTI,
AliasAnalysis AA,
DependenceInfo DI,
Optional< unsigned TRT = None 
)

Construct a CacheCost object for the loop nest described by Loops.

The optional parameter TRT can be used to specify the max. distance between array elements accessed in a loop so that the elements are classified to have temporal reuse.

Definition at line 451 of file LoopCacheAnalysis.cpp.

References assert(), DefaultTripCount, llvm::SmallVectorBase::empty(), llvm::ScalarEvolution::getSmallConstantTripCount(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Member Function Documentation

◆ getCacheCost()

std::unique_ptr< CacheCost > CacheCost::getCacheCost ( Loop Root,
LoopStandardAnalysisResults AR,
DependenceInfo DI,
Optional< unsigned TRT = None 
)
static

◆ getLoopCost()

CacheCostTy llvm::CacheCost::getLoopCost ( const Loop L) const
inline

Return the estimated cost of loop L if the given loop is part of the loop nest associated with this object.

Return -1 otherwise.

Definition at line 199 of file LoopCacheAnalysis.h.

References llvm::find_if(), and IT.

◆ getLoopCosts()

const ArrayRef<LoopCacheCostTy> llvm::CacheCost::getLoopCosts ( ) const
inline

Return the estimated ordered loop costs.

Definition at line 207 of file LoopCacheAnalysis.h.

References B, Loops, llvm::IndexedReference::operator<<, and llvm::sort().

Friends And Related Function Documentation

◆ operator<<

raw_ostream& operator<< ( raw_ostream OS,
const CacheCost CC 
)
friend

Member Data Documentation

◆ InvalidCost

CacheCostTy constexpr llvm::CacheCost::InvalidCost = -1
static

Definition at line 179 of file LoopCacheAnalysis.h.

Referenced by llvm::IndexedReference::computeRefCost(), and getCacheCost().


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