class IndexedReference

Declaration

class IndexedReference { /* full declaration omitted */ };

Description

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]

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:44

Method Overview

  • public IndexedReference(llvm::Instruction & StoreOrLoadInst, const llvm::LoopInfo & LI, llvm::ScalarEvolution & SE)
  • public llvm::CacheCostTy computeRefCost(const llvm::Loop & L, unsigned int CLS) const
  • public const llvm::SCEV * getBasePointer() const
  • public const llvm::SCEV * getFirstSubscript() const
  • public const llvm::SCEV * getLastSubscript() const
  • public size_t getNumSubscripts() const
  • public const llvm::SCEV * getSubscript(unsigned int SubNum) const
  • public Optional<bool> hasSpacialReuse(const llvm::IndexedReference & Other, unsigned int CLS, llvm::AliasAnalysis & AA) const
  • public Optional<bool> hasTemporalReuse(const llvm::IndexedReference & Other, unsigned int MaxDistance, const llvm::Loop & L, llvm::DependenceInfo & DI, llvm::AliasAnalysis & AA) const
  • public bool isValid() const

Methods

IndexedReference(
    llvm::Instruction& StoreOrLoadInst,
    const llvm::LoopInfo& LI,
    llvm::ScalarEvolution& SE)

Description

Construct an indexed reference given a \p StoreOrLoadInst instruction.

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:49

Parameters

llvm::Instruction& StoreOrLoadInst
const llvm::LoopInfo& LI
llvm::ScalarEvolution& SE

llvm::CacheCostTy computeRefCost(
    const llvm::Loop& L,
    unsigned int CLS) const

Description

Compute the cost of the reference w.r.t. the given loop \p 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'.

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:92

Parameters

const llvm::Loop& L
unsigned int CLS

const llvm::SCEV* getBasePointer() const

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:53

const llvm::SCEV* getFirstSubscript() const

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:59

const llvm::SCEV* getLastSubscript() const

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:63

size_t getNumSubscripts() const

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:54

const llvm::SCEV* getSubscript(
    unsigned int SubNum) const

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:55

Parameters

unsigned int SubNum

Optional<bool> hasSpacialReuse(
    const llvm::IndexedReference& Other,
    unsigned int CLS,
    llvm::AliasAnalysis& AA) const

Description

Return true/false if the current object and the indexed reference \p Other are/aren't in the same cache line of size \p 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.

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:72

Parameters

const llvm::IndexedReference& Other
unsigned int CLS
llvm::AliasAnalysis& AA

Optional<bool> hasTemporalReuse(
    const llvm::IndexedReference& Other,
    unsigned int MaxDistance,
    const llvm::Loop& L,
    llvm::DependenceInfo& DI,
    llvm::AliasAnalysis& AA) const

Description

Return true if the current object and the indexed reference \p Other have distance smaller than \p MaxDistance in the dimension associated with the given loop \p L. Return false if the distance is not smaller than \p MaxDistance and None if unsure.

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:79

Parameters

const llvm::IndexedReference& Other
unsigned int MaxDistance
const llvm::Loop& L
llvm::DependenceInfo& DI
llvm::AliasAnalysis& AA

bool isValid() const

Declared at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:52