Go to the documentation of this file.
30 #ifndef LoopDependencyAnalysis_H
31 #define LoopDependencyAnalysis_H
33 #include "llvm/IR/PassManager.h"
34 #include "llvm/Analysis/LoopInfo.h"
35 #include "llvm/Analysis/LoopAnalysisManager.h"
36 #include "llvm/ADT/iterator_range.h"
37 #include "llvm/ADT/SmallVector.h"
39 #include "llvm/Analysis/ScalarEvolution.h"
40 #include "llvm/ADT/Optional.h"
67 PHINode *phi,
int distance) :
68 def(def), distance(distance), kind(kind), phi(phi),
88 return dyn_cast<Instruction>(def);
123 return LD->
getKind() == LoopDependency::DepKind::Simple;
137 nullptr, nullptr, distance),
138 store(store), load(load) {};
150 return LD->
getKind() == LoopDependency::DepKind::Memory;
165 Value* start, Value *step) :
171 return LD->
getKind() == LoopDependency::DepKind::InductionVar;
190 return indvar_dep_list.begin();
193 return indvar_dep_list.end();
196 return make_range(idv_dep_begin(), idv_dep_end());
200 indvar_dep_list.emplace_back(D);
204 return indvar_dep_list.size();
209 return mem_dep_list.begin();
212 return mem_dep_list.end();
215 return make_range(mem_dep_begin(), mem_dep_end());
219 mem_dep_list.emplace_back(D);
223 return mem_dep_list.size();
228 return lc_dep_list.begin();
231 return lc_dep_list.end();
233 inline iterator_range<dep_iterator>
lc_deps() {
234 return make_range(lc_dep_begin(), lc_dep_end());
238 lc_dep_list.emplace_back(D);
242 return lc_dep_list.size();
257 public AnalysisInfoMixin<LoopDependencyAnalysisPass> {
260 Result run(Loop &L, LoopAnalysisManager &AM,
261 LoopStandardAnalysisResults &AR);
263 friend AnalysisInfoMixin<LoopDependencyAnalysisPass>;
267 Optional<int> getDistance(Instruction* A, Instruction *B, ScalarEvolution &SE);
273 #endif //LoopDependencyAnalysis_H
Value * getInit()
Definition: LoopDependencyAnalysis.hpp:91
static AnalysisKey Key
Definition: LoopDependencyAnalysis.hpp:264
Definition: OptionPlugin.cpp:128
iterator_range< dep_iterator > idv_deps()
Definition: LoopDependencyAnalysis.hpp:195
Value * def
Definition: LoopDependencyAnalysis.hpp:106
InductionVariableDependency(PHINode *indvar, Instruction *bin_op, Value *start, Value *step)
Definition: LoopDependencyAnalysis.hpp:164
Instruction * bin_op
Definition: LoopDependencyAnalysis.hpp:175
static bool classof(const LoopDependency *LD)
Definition: LoopDependencyAnalysis.hpp:122
DepList mem_dep_list
Definition: LoopDependencyAnalysis.hpp:247
dep_iterator idv_dep_end()
Definition: LoopDependencyAnalysis.hpp:192
int getDistance()
Definition: LoopDependencyAnalysis.hpp:99
Value * init
Definition: LoopDependencyAnalysis.hpp:107
A base class for loop dependency relationship.
Definition: LoopDependencyAnalysis.hpp:51
dep_iterator mem_dep_begin()
Definition: LoopDependencyAnalysis.hpp:208
SmallVector< LoopDependency * > DepList
Definition: LoopDependencyAnalysis.hpp:184
PHINode * phi
Definition: LoopDependencyAnalysis.hpp:104
static bool classof(const LoopDependency *LD)
Definition: LoopDependencyAnalysis.hpp:170
DepKind kind
Definition: LoopDependencyAnalysis.hpp:105
dep_iterator lc_dep_begin()
Definition: LoopDependencyAnalysis.hpp:227
DepList::iterator dep_iterator
Definition: LoopDependencyAnalysis.hpp:186
LoadInst * getLoad()
Definition: LoopDependencyAnalysis.hpp:141
int getNumIdvDep()
Definition: LoopDependencyAnalysis.hpp:203
DepKind
Definition: LoopDependencyAnalysis.hpp:53
iterator_range< dep_iterator > lc_deps()
Definition: LoopDependencyAnalysis.hpp:233
Definition: AGVerifyPass.hpp:50
DepList indvar_dep_list
Definition: LoopDependencyAnalysis.hpp:246
A derived class from LoopDependency for loop carried dependency via register.
Definition: LoopDependencyAnalysis.hpp:117
dep_iterator idv_dep_begin()
Definition: LoopDependencyAnalysis.hpp:189
StoreInst * getStore()
Definition: LoopDependencyAnalysis.hpp:145
void add_mem_dep(MemoryLoopDependency *D)
Definition: LoopDependencyAnalysis.hpp:218
dep_iterator mem_dep_end()
Definition: LoopDependencyAnalysis.hpp:211
LoadInst * load
Definition: LoopDependencyAnalysis.hpp:153
LoopDependency analysis result.
Definition: LoopDependencyAnalysis.hpp:182
void add_dep(SimpleLoopDependency *D)
Definition: LoopDependencyAnalysis.hpp:237
dep_iterator lc_dep_end()
Definition: LoopDependencyAnalysis.hpp:230
StoreInst * store
Definition: LoopDependencyAnalysis.hpp:154
MemoryLoopDependency(StoreInst *store, LoadInst *load, int distance)
Definition: LoopDependencyAnalysis.hpp:135
void add_idv_dep(InductionVariableDependency *D)
Definition: LoopDependencyAnalysis.hpp:199
bool correspond(PHINode *P)
Definition: LoopDependencyAnalysis.hpp:75
PHINode * getPhi()
Definition: LoopDependencyAnalysis.hpp:95
int getNumDep()
Definition: LoopDependencyAnalysis.hpp:241
A derived class from LoopDependency for loop carried dependency via memory access.
Definition: LoopDependencyAnalysis.hpp:133
A derived class from LoopDependency for loop carried dependency associated with loop induction variab...
Definition: LoopDependencyAnalysis.hpp:162
iterator_range< dep_iterator > mem_deps()
Definition: LoopDependencyAnalysis.hpp:214
Value * getDef()
Definition: LoopDependencyAnalysis.hpp:83
Instruction * getDefInst()
Definition: LoopDependencyAnalysis.hpp:87
Value * step
Definition: LoopDependencyAnalysis.hpp:174
static bool classof(const LoopDependency *LD)
Definition: LoopDependencyAnalysis.hpp:149
int distance
Definition: LoopDependencyAnalysis.hpp:109
LoopDependency(DepKind kind, Value *def, Value *init, PHINode *phi, int distance)
Construct a new Loop Dependency object for normal loop carried dependency.
Definition: LoopDependencyAnalysis.hpp:66
DepKind getKind() const
Definition: LoopDependencyAnalysis.hpp:71
DepList lc_dep_list
Definition: LoopDependencyAnalysis.hpp:248
int getNumMemDep()
Definition: LoopDependencyAnalysis.hpp:222
SimpleLoopDependency(Instruction *def, Value *init, PHINode *phi)
Definition: LoopDependencyAnalysis.hpp:119
A loop pass to analyze memory access for decoupling.
Definition: LoopDependencyAnalysis.hpp:256