llvm::IndexedReference

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]

Synopsis

Declared in <llvm/Analysis/LoopCacheAnalysis.h>

class IndexedReference;

Member Functions

NameDescription
IndexedReference [constructor]Construct an indexed reference given a StoreOrLoadInst instruction.
computeRefCost 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: - equal to one if the reference is loop invariant, or - equal to '(TripCount * stride) / cache_line_size' if: + the reference stride is less than the cache line size, and + the coefficient of this loop's index variable used in all other subscripts is zero - or otherwise equal to 'TripCount'.
getBasePointer
getFirstSubscript
getLastSubscript
getNumSubscripts
getSubscript
hasSpacialReuse 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 std::nullopt if unsure.
hasTemporalReuse 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 std::nullopt if unsure.
isValid

Friends

NameDescription
llvm::operator<<Stream insertion operator