class CacheCost

Declaration

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

Description

\c 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: - one if it is loop invariant w.r.t the innermost loop, - equal to the loop trip count divided by the cache line times the reference stride if the reference stride is less than the cache line size (CLS), and the coefficient of this loop's index variable used in all other subscripts is zero (e.g. RefCost = TripCount/(CLS/RefStride)) - equal to the innermost loop trip count if the reference stride is greater or equal to the cache line size CLS.

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

Member Variables

public static const llvm::CacheCostTy InvalidCost = -1

Method Overview

  • public CacheCost(const llvm::LoopVectorTy & Loops, const llvm::LoopInfo & LI, llvm::ScalarEvolution & SE, llvm::TargetTransformInfo & TTI, llvm::AliasAnalysis & AA, llvm::DependenceInfo & DI, Optional<unsigned int> TRT = None)
  • public static std::unique_ptr<CacheCost> getCacheCost(llvm::Loop & Root, llvm::LoopStandardAnalysisResults & AR, llvm::DependenceInfo & DI, Optional<unsigned int> TRT = None)
  • public llvm::CacheCostTy getLoopCost(const llvm::Loop & L) const
  • public const ArrayRef<llvm::CacheCost::LoopCacheCostTy> getLoopCosts() const

Methods

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

Description

Construct a CacheCost object for the loop nest described by \p Loops. The optional parameter \p 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.

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

Parameters

const llvm::LoopVectorTy& Loops
const llvm::LoopInfo& LI
llvm::ScalarEvolution& SE
llvm::TargetTransformInfo& TTI
llvm::AliasAnalysis& AA
llvm::DependenceInfo& DI
Optional<unsigned int> TRT = None

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

Description

Create a CacheCost for the loop nest rooted by \p Root. The optional parameter \p 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.

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

Parameters

llvm::Loop& Root
llvm::LoopStandardAnalysisResults& AR
llvm::DependenceInfo& DI
Optional<unsigned int> TRT = None

llvm::CacheCostTy getLoopCost(
    const llvm::Loop& L) const

Description

Return the estimated cost of loop \p L if the given loop is part of the loop nest associated with this object. Return -1 otherwise.

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

Parameters

const llvm::Loop& L

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

Description

Return the estimated ordered loop costs.

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