14 #ifndef LLVM_ANALYSIS_LOOPCACHEANALYSIS_H 15 #define LLVM_ANALYSIS_LOOPCACHEANALYSIS_H 57 return Subscripts[SubNum];
60 assert(!Subscripts.empty() &&
"Expecting non-empty container");
61 return Subscripts.front();
64 assert(!Subscripts.empty() &&
"Expecting non-empty container");
65 return Subscripts.back();
80 unsigned MaxDistance,
const Loop &L,
96 bool delinearize(
const LoopInfo &LI);
99 bool isLoopInvariant(
const Loop &L)
const;
105 bool isConsecutive(
const Loop &L,
unsigned CLS)
const;
108 const SCEV *getLastCoefficient()
const;
112 bool isCoeffForLoopZeroOrInvariant(
const SCEV &Subscript,
113 const Loop &L)
const;
117 bool isSimpleAddRecurrence(
const SCEV &Subscript,
const Loop &L)
const;
125 bool IsValid =
false;
131 const SCEV *BasePointer =
nullptr;
175 using LoopTripCountTy = std::pair<const Loop *, unsigned>;
176 using LoopCacheCostTy = std::pair<const Loop *, CacheCostTy>;
193 static std::unique_ptr<CacheCost>
201 LoopCosts.begin(), LoopCosts.end(),
202 [&L](
const LoopCacheCostTy &LCC) {
return LCC.first == &L; });
203 return (
IT != LoopCosts.end()) ? (*IT).second : -1;
212 void calculateCacheFootprint();
235 const Loop &L)
const;
238 void sortLoopCosts() {
239 sort(LoopCosts, [](
const LoopCacheCostTy &A,
const LoopCacheCostTy &
B) {
240 return A.second > B.second;
281 #endif // LLVM_ANALYSIS_LOOPCACHEANALYSIS_H
This class represents lattice values for constants.
The main scalar evolution driver.
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
DependenceInfo - This class is the main dependence-analysis driver.
LoopCachePrinterPass(raw_ostream &OS)
const SCEV * getFirstSubscript() const
friend raw_ostream & operator<<(raw_ostream &OS, const IndexedReference &R)
A CRTP mix-in to automatically provide informational APIs needed for passes.
This header provides classes for managing per-loop analyses.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
CacheCost represents the estimated cost of a inner loop as the number of cache lines used by the memo...
Printer pass for the CacheCost results.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A set of analyses that are preserved following a run of a transformation pass.
Optional< bool > hasSpacialReuse(const IndexedReference &Other, unsigned CLS, AliasAnalysis &AA) const
Return true/false if the current object and the indexed reference Other are/aren't in the same cache ...
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
void sort(IteratorTy Start, IteratorTy End)
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
size_t getNumSubscripts() const
const SCEV * getSubscript(unsigned SubNum) const
const ArrayRef< LoopCacheCostTy > getLoopCosts() const
Return the estimated ordered loop costs.
Optional< bool > hasTemporalReuse(const IndexedReference &Other, unsigned MaxDistance, const Loop &L, DependenceInfo &DI, AliasAnalysis &AA) const
Return true if the current object and the indexed reference Other have distance smaller than MaxDista...
Represents a memory reference as a base pointer and a set of indexing operations. ...
const SCEV * getLastSubscript() const
IndexedReference(Instruction &StoreOrLoadInst, const LoopInfo &LI, ScalarEvolution &SE)
Construct an indexed reference given a StoreOrLoadInst instruction.
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::ZeroOrMore, cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate IT block based on arch"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow deprecated IT based on ARMv8"), clEnumValN(NoRestrictedIT, "arm-no-restrict-it", "Allow IT blocks based on ARMv7")))
This class represents an analyzed expression in the program.
Represents a single loop in the control flow graph.
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 o...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
CacheCostTy computeRefCost(const Loop &L, unsigned CLS) const
Compute the cost of the reference w.r.t.
const SCEV * getBasePointer() const
This class implements an extremely fast bulk output stream that can only output to a stream...
A container for analyses that lazily runs them and caches their results.