LLVM
15.0.0git
|
Represents a memory reference as a base pointer and a set of indexing operations. More...
#include "llvm/Analysis/LoopCacheAnalysis.h"
Public Member Functions | |
IndexedReference (Instruction &StoreOrLoadInst, const LoopInfo &LI, ScalarEvolution &SE) | |
Construct an indexed reference given a StoreOrLoadInst instruction. More... | |
bool | isValid () const |
const SCEV * | getBasePointer () const |
size_t | getNumSubscripts () const |
const SCEV * | getSubscript (unsigned SubNum) const |
const SCEV * | getFirstSubscript () const |
const SCEV * | getLastSubscript () const |
Optional< bool > | hasSpacialReuse (const IndexedReference &Other, unsigned CLS, AAResults &AA) const |
Return true/false if the current object and the indexed reference Other are/aren't in the same cache line of size CLS . More... | |
Optional< bool > | hasTemporalReuse (const IndexedReference &Other, unsigned MaxDistance, const Loop &L, DependenceInfo &DI, AAResults &AA) const |
Return true if the current object and the indexed reference Other have distance smaller than MaxDistance in the dimension associated with the given loop L . More... | |
CacheCostTy | computeRefCost (const Loop &L, unsigned CLS) const |
Compute the cost of the reference w.r.t. More... | |
Friends | |
raw_ostream & | operator<< (raw_ostream &OS, const IndexedReference &R) |
Represents a memory reference as a base pointer and a set of indexing operations.
For example given the array reference A[i][2j+1][3k+2] in a 3-dim loop nest: for(i=0;i<n;++i) for(j=0;j<m;++j) for(k=0;k<o;++k) ... A[i][2j+1][3k+2] ... We expect: BasePointer -> A Subscripts -> [{0,+,1}<for.i>][{1,+,2}<for.j>][{2,+,3}<for.k>] Sizes -> [m][o][4]
Definition at line 47 of file LoopCacheAnalysis.h.
IndexedReference::IndexedReference | ( | Instruction & | StoreOrLoadInst, |
const LoopInfo & | LI, | ||
ScalarEvolution & | SE | ||
) |
Construct an indexed reference given a StoreOrLoadInst
instruction.
Definition at line 147 of file LoopCacheAnalysis.cpp.
References assert(), llvm::dbgs(), and LLVM_DEBUG.
CacheCostTy IndexedReference::computeRefCost | ( | const Loop & | L, |
unsigned | CLS | ||
) | const |
Compute the cost of the reference w.r.t.
the given loop L
when it is considered in the innermost position in the loop nest. The cost is defined as:
Definition at line 273 of file LoopCacheAnalysis.cpp.
References assert(), CacheLineSize, computeTripCount(), llvm::dbgs(), llvm::ScalarEvolution::getConstant(), llvm::SCEVAddRecExpr::getLoop(), llvm::ScalarEvolution::getMulExpr(), llvm::ScalarEvolution::getNegativeSCEV(), llvm::ScalarEvolution::getNoopOrAnyExtend(), getNumSubscripts(), getSubscript(), llvm::SCEV::getType(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getWiderType(), I, llvm::raw_ostream::indent(), llvm::CacheCost::InvalidCost, llvm::ScalarEvolution::isKnownNegative(), and LLVM_DEBUG.
Definition at line 56 of file LoopCacheAnalysis.h.
Definition at line 62 of file LoopCacheAnalysis.h.
References assert().
Definition at line 66 of file LoopCacheAnalysis.h.
References assert().
Referenced by hasSpacialReuse().
|
inline |
Definition at line 57 of file LoopCacheAnalysis.h.
Referenced by computeRefCost(), getSubscript(), and hasSpacialReuse().
Definition at line 58 of file LoopCacheAnalysis.h.
References assert(), and getNumSubscripts().
Referenced by computeRefCost(), and hasSpacialReuse().
Optional< bool > IndexedReference::hasSpacialReuse | ( | const IndexedReference & | Other, |
unsigned | CLS, | ||
AAResults & | AA | ||
) | const |
Return true/false if the current object and the indexed reference Other
are/aren't in the same cache line of size CLS
.
Two references are in the same chace line iff the distance between them in the innermost dimension is less than the cache line size. Return None if unsure.
Definition at line 159 of file LoopCacheAnalysis.cpp.
References assert(), llvm::dbgs(), getLastSubscript(), llvm::ScalarEvolution::getMinusSCEV(), getNumSubscripts(), llvm::ConstantInt::getSExtValue(), getSubscript(), llvm::SCEVConstant::getValue(), llvm::raw_ostream::indent(), LLVM_DEBUG, llvm::None, and Other.
Optional< bool > IndexedReference::hasTemporalReuse | ( | const IndexedReference & | Other, |
unsigned | MaxDistance, | ||
const Loop & | L, | ||
DependenceInfo & | DI, | ||
AAResults & | AA | ||
) | const |
Return true if the current object and the indexed reference Other
have distance smaller than MaxDistance
in the dimension associated with the given loop L
.
Return false if the distance is not smaller than MaxDistance
and None if unsure.
Definition at line 214 of file LoopCacheAnalysis.cpp.
References assert(), D, llvm::dbgs(), llvm::DependenceInfo::depends(), llvm::LoopBase< BlockT, LoopT >::getLoopDepth(), llvm::ConstantInt::getSExtValue(), llvm::SCEVConstant::getValue(), llvm::ConstantInt::isZero(), LLVM_DEBUG, llvm::None, and Other.
|
inline |
Definition at line 55 of file LoopCacheAnalysis.h.
|
friend |