Mercurial > hg > CbC > CbC_llvm
comparison include/llvm/Analysis/LoopPass.h @ 77:54457678186b LLVM3.6
LLVM 3.6
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Sep 2014 22:06:00 +0900 |
parents | 95c75e76d11b |
children | 60c9769439b8 |
comparison
equal
deleted
inserted
replaced
34:e874dbf0ad9d | 77:54457678186b |
---|---|
30 public: | 30 public: |
31 explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {} | 31 explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {} |
32 | 32 |
33 /// getPrinterPass - Get a pass to print the function corresponding | 33 /// getPrinterPass - Get a pass to print the function corresponding |
34 /// to a Loop. | 34 /// to a Loop. |
35 Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; | 35 Pass *createPrinterPass(raw_ostream &O, |
36 const std::string &Banner) const override; | |
36 | 37 |
37 // runOnLoop - This method should be implemented by the subclass to perform | 38 // runOnLoop - This method should be implemented by the subclass to perform |
38 // whatever action is necessary for the specified Loop. | 39 // whatever action is necessary for the specified Loop. |
39 virtual bool runOnLoop(Loop *L, LPPassManager &LPM) = 0; | 40 virtual bool runOnLoop(Loop *L, LPPassManager &LPM) = 0; |
40 | 41 |
54 // available. This pass P is not suitable for a LPPassManager if P | 55 // available. This pass P is not suitable for a LPPassManager if P |
55 // is not preserving higher level analysis info used by other | 56 // is not preserving higher level analysis info used by other |
56 // LPPassManager passes. In such case, pop LPPassManager from the | 57 // LPPassManager passes. In such case, pop LPPassManager from the |
57 // stack. This will force assignPassManager() to create new | 58 // stack. This will force assignPassManager() to create new |
58 // LPPassManger as expected. | 59 // LPPassManger as expected. |
59 void preparePassManager(PMStack &PMS); | 60 void preparePassManager(PMStack &PMS) override; |
60 | 61 |
61 /// Assign pass manager to manage this pass | 62 /// Assign pass manager to manage this pass |
62 virtual void assignPassManager(PMStack &PMS, | 63 void assignPassManager(PMStack &PMS, PassManagerType PMT) override; |
63 PassManagerType PMT); | |
64 | 64 |
65 /// Return what kind of Pass Manager can manage this pass. | 65 /// Return what kind of Pass Manager can manage this pass. |
66 virtual PassManagerType getPotentialPassManagerType() const { | 66 PassManagerType getPotentialPassManagerType() const override { |
67 return PMT_LoopPassManager; | 67 return PMT_LoopPassManager; |
68 } | 68 } |
69 | 69 |
70 //===--------------------------------------------------------------------===// | 70 //===--------------------------------------------------------------------===// |
71 /// SimpleAnalysis - Provides simple interface to update analysis info | 71 /// SimpleAnalysis - Provides simple interface to update analysis info |
79 /// cloneBasicBlockAnalysis - Clone analysis info associated with basic block. | 79 /// cloneBasicBlockAnalysis - Clone analysis info associated with basic block. |
80 virtual void cloneBasicBlockAnalysis(BasicBlock *F, BasicBlock *T, Loop *L) {} | 80 virtual void cloneBasicBlockAnalysis(BasicBlock *F, BasicBlock *T, Loop *L) {} |
81 | 81 |
82 /// deleteAnalysisValue - Delete analysis info associated with value V. | 82 /// deleteAnalysisValue - Delete analysis info associated with value V. |
83 virtual void deleteAnalysisValue(Value *V, Loop *L) {} | 83 virtual void deleteAnalysisValue(Value *V, Loop *L) {} |
84 | |
85 protected: | |
86 /// skipOptnoneFunction - Containing function has Attribute::OptimizeNone | |
87 /// and most transformation passes should skip it. | |
88 bool skipOptnoneFunction(const Loop *L) const; | |
84 }; | 89 }; |
85 | 90 |
86 class LPPassManager : public FunctionPass, public PMDataManager { | 91 class LPPassManager : public FunctionPass, public PMDataManager { |
87 public: | 92 public: |
88 static char ID; | 93 static char ID; |
89 explicit LPPassManager(); | 94 explicit LPPassManager(); |
90 | 95 |
91 /// run - Execute all of the passes scheduled for execution. Keep track of | 96 /// run - Execute all of the passes scheduled for execution. Keep track of |
92 /// whether any of the passes modifies the module, and if so, return true. | 97 /// whether any of the passes modifies the module, and if so, return true. |
93 bool runOnFunction(Function &F); | 98 bool runOnFunction(Function &F) override; |
94 | 99 |
95 /// Pass Manager itself does not invalidate any analysis info. | 100 /// Pass Manager itself does not invalidate any analysis info. |
96 // LPPassManager needs LoopInfo. | 101 // LPPassManager needs LoopInfo. |
97 void getAnalysisUsage(AnalysisUsage &Info) const; | 102 void getAnalysisUsage(AnalysisUsage &Info) const override; |
98 | 103 |
99 virtual const char *getPassName() const { | 104 const char *getPassName() const override { |
100 return "Loop Pass Manager"; | 105 return "Loop Pass Manager"; |
101 } | 106 } |
102 | 107 |
103 virtual PMDataManager *getAsPMDataManager() { return this; } | 108 PMDataManager *getAsPMDataManager() override { return this; } |
104 virtual Pass *getAsPass() { return this; } | 109 Pass *getAsPass() override { return this; } |
105 | 110 |
106 /// Print passes managed by this manager | 111 /// Print passes managed by this manager |
107 void dumpPassStructure(unsigned Offset); | 112 void dumpPassStructure(unsigned Offset) override; |
108 | 113 |
109 LoopPass *getContainedPass(unsigned N) { | 114 LoopPass *getContainedPass(unsigned N) { |
110 assert(N < PassVector.size() && "Pass number out of range!"); | 115 assert(N < PassVector.size() && "Pass number out of range!"); |
111 LoopPass *LP = static_cast<LoopPass *>(PassVector[N]); | 116 LoopPass *LP = static_cast<LoopPass *>(PassVector[N]); |
112 return LP; | 117 return LP; |
113 } | 118 } |
114 | 119 |
115 virtual PassManagerType getPassManagerType() const { | 120 PassManagerType getPassManagerType() const override { |
116 return PMT_LoopPassManager; | 121 return PMT_LoopPassManager; |
117 } | 122 } |
118 | 123 |
119 public: | 124 public: |
120 // Delete loop from the loop queue and loop nest (LoopInfo). | 125 // Delete loop from the loop queue and loop nest (LoopInfo). |