llvm.org GIT mirror llvm / c37e6c0
[C++11] Add 'override' keyword to virtual methods that override their base class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202945 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 6 years ago
45 changed file(s) with 260 addition(s) and 262 deletion(s). Raw diff Collapse all Expand all
281281 /// notified whenever a Value is deleted.
282282 class ASTCallbackVH : public CallbackVH {
283283 AliasSetTracker *AST;
284 virtual void deleted();
285 virtual void allUsesReplacedWith(Value *);
284 void deleted() override;
285 void allUsesReplacedWith(Value *) override;
286286 public:
287287 ASTCallbackVH(Value *V, AliasSetTracker *AST = 0);
288288 ASTCallbackVH &operator=(Value *V);
3636
3737 ~BlockFrequencyInfo();
3838
39 void getAnalysisUsage(AnalysisUsage &AU) const;
39 void getAnalysisUsage(AnalysisUsage &AU) const override;
4040
41 bool runOnFunction(Function &F);
42 void print(raw_ostream &O, const Module *M) const;
41 bool runOnFunction(Function &F) override;
42 void print(raw_ostream &O, const Module *M) const override;
4343 const Function *getFunction() const;
4444 void view() const;
4545
4444 initializeBranchProbabilityInfoPass(*PassRegistry::getPassRegistry());
4545 }
4646
47 void getAnalysisUsage(AnalysisUsage &AU) const;
48 bool runOnFunction(Function &F);
49 void print(raw_ostream &OS, const Module *M = 0) const;
47 void getAnalysisUsage(AnalysisUsage &AU) const override;
48 bool runOnFunction(Function &F) override;
49 void print(raw_ostream &OS, const Module *M = 0) const override;
5050
5151 /// \brief Get an edge's probability, relative to other out-edges of the Src.
5252 ///
380380 // Implementation of the ModulePass interface needed here.
381381 //
382382
383 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
384 virtual bool runOnModule(Module &M);
385 virtual void releaseMemory();
386
387 void print(raw_ostream &o, const Module *) const;
383 void getAnalysisUsage(AnalysisUsage &AU) const override;
384 bool runOnModule(Module &M) override;
385 void releaseMemory() override;
386
387 void print(raw_ostream &o, const Module *) const override;
388388 void dump() const;
389389 };
390390
3636
3737 /// createPrinterPass - Get a pass that prints the Module
3838 /// corresponding to a CallGraph.
39 Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const;
39 Pass *createPrinterPass(raw_ostream &O,
40 const std::string &Banner) const override;
4041
4142 using llvm::Pass::doInitialization;
4243 using llvm::Pass::doFinalization;
6465 }
6566
6667 /// Assign pass manager to manager this pass
67 virtual void assignPassManager(PMStack &PMS,
68 PassManagerType PMT);
68 void assignPassManager(PMStack &PMS, PassManagerType PMT) override;
6969
7070 /// Return what kind of Pass Manager can manage this pass.
71 virtual PassManagerType getPotentialPassManagerType() const {
71 PassManagerType getPotentialPassManagerType() const override {
7272 return PMT_CallGraphPassManager;
7373 }
7474
7575 /// getAnalysisUsage - For this class, we declare that we require and preserve
7676 /// the call graph. If the derived class implements this method, it should
7777 /// always explicitly call the implementation here.
78 virtual void getAnalysisUsage(AnalysisUsage &Info) const;
78 void getAnalysisUsage(AnalysisUsage &Info) const override;
7979 };
8080
8181 /// CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
3434 DOTGraphTraitsViewer(StringRef GraphName, char &ID)
3535 : FunctionPass(ID), Name(GraphName) {}
3636
37 virtual bool runOnFunction(Function &F) {
37 bool runOnFunction(Function &F) override {
3838 GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis());
3939 std::string GraphName = DOTGraphTraits::getGraphName(Graph);
4040 std::string Title = GraphName + " for '" + F.getName().str() + "' function";
4444 return false;
4545 }
4646
47 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
47 void getAnalysisUsage(AnalysisUsage &AU) const override {
4848 AU.setPreservesAll();
4949 AU.addRequired();
5050 }
6161 DOTGraphTraitsPrinter(StringRef GraphName, char &ID)
6262 : FunctionPass(ID), Name(GraphName) {}
6363
64 virtual bool runOnFunction(Function &F) {
64 bool runOnFunction(Function &F) override {
6565 GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis());
6666 std::string Filename = Name + "." + F.getName().str() + ".dot";
6767 std::string ErrorInfo;
8181 return false;
8282 }
8383
84 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
84 void getAnalysisUsage(AnalysisUsage &AU) const override {
8585 AU.setPreservesAll();
8686 AU.addRequired();
8787 }
9898 DOTGraphTraitsModuleViewer(StringRef GraphName, char &ID)
9999 : ModulePass(ID), Name(GraphName) {}
100100
101 virtual bool runOnModule(Module &M) {
101 bool runOnModule(Module &M) override {
102102 GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis());
103103 std::string Title = DOTGraphTraits::getGraphName(Graph);
104104
107107 return false;
108108 }
109109
110 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
110 void getAnalysisUsage(AnalysisUsage &AU) const override {
111111 AU.setPreservesAll();
112112 AU.addRequired();
113113 }
124124 DOTGraphTraitsModulePrinter(StringRef GraphName, char &ID)
125125 : ModulePass(ID), Name(GraphName) {}
126126
127 virtual bool runOnModule(Module &M) {
127 bool runOnModule(Module &M) override {
128128 GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis());
129129 std::string Filename = Name + ".dot";
130130 std::string ErrorInfo;
143143 return false;
144144 }
145145
146 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
146 void getAnalysisUsage(AnalysisUsage &AU) const override {
147147 AU.setPreservesAll();
148148 AU.addRequired();
149149 }
226226
227227 /// isLoopIndependent - Returns true if this is a loop-independent
228228 /// dependence.
229 bool isLoopIndependent() const { return LoopIndependent; }
229 bool isLoopIndependent() const override { return LoopIndependent; }
230230
231231 /// isConfused - Returns true if this dependence is confused
232232 /// (the compiler understands nothing and makes worst-case
233233 /// assumptions).
234 bool isConfused() const { return false; }
234 bool isConfused() const override { return false; }
235235
236236 /// isConsistent - Returns true if this dependence is consistent
237237 /// (occurs every time the source and destination are executed).
238 bool isConsistent() const { return Consistent; }
238 bool isConsistent() const override { return Consistent; }
239239
240240 /// getLevels - Returns the number of common loops surrounding the
241241 /// source and destination of the dependence.
242 unsigned getLevels() const { return Levels; }
242 unsigned getLevels() const override { return Levels; }
243243
244244 /// getDirection - Returns the direction associated with a particular
245245 /// level.
246 unsigned getDirection(unsigned Level) const;
246 unsigned getDirection(unsigned Level) const override;
247247
248248 /// getDistance - Returns the distance (or NULL) associated with a
249249 /// particular level.
250 const SCEV *getDistance(unsigned Level) const;
250 const SCEV *getDistance(unsigned Level) const override;
251251
252252 /// isPeelFirst - Returns true if peeling the first iteration from
253253 /// this loop will break this dependence.
254 bool isPeelFirst(unsigned Level) const;
254 bool isPeelFirst(unsigned Level) const override;
255255
256256 /// isPeelLast - Returns true if peeling the last iteration from
257257 /// this loop will break this dependence.
258 bool isPeelLast(unsigned Level) const;
258 bool isPeelLast(unsigned Level) const override;
259259
260260 /// isSplitable - Returns true if splitting the loop will break
261261 /// the dependence.
262 bool isSplitable(unsigned Level) const;
262 bool isSplitable(unsigned Level) const override;
263263
264264 /// isScalar - Returns true if a particular level is scalar; that is,
265265 /// if no subscript in the source or destination mention the induction
266266 /// variable associated with the loop at this level.
267 bool isScalar(unsigned Level) const;
267 bool isScalar(unsigned Level) const override;
268268 private:
269269 unsigned short Levels;
270270 bool LoopIndependent;
917917 initializeDependenceAnalysisPass(*PassRegistry::getPassRegistry());
918918 }
919919
920 bool runOnFunction(Function &F);
921 void releaseMemory();
922 void getAnalysisUsage(AnalysisUsage &) const;
923 void print(raw_ostream &, const Module * = 0) const;
920 bool runOnFunction(Function &F) override;
921 void releaseMemory() override;
922 void getAnalysisUsage(AnalysisUsage &) const override;
923 void print(raw_ostream &, const Module * = 0) const override;
924924 }; // class DependenceAnalysis
925925
926926 /// createDependenceAnalysisPass - This creates an instance of the
5050 ///
5151 bool isPostDominator() const { return IsPostDominators; }
5252
53 virtual void releaseMemory() { Frontiers.clear(); }
53 void releaseMemory() override { Frontiers.clear(); }
5454
5555 // Accessor interface:
5656 typedef DomSetMapType::iterator iterator;
141141
142142 /// print - Convert to human readable form
143143 ///
144 virtual void print(raw_ostream &OS, const Module* = 0) const;
144 void print(raw_ostream &OS, const Module* = 0) const override;
145145
146146 /// dump - Dump the dominance frontier to dbgs().
147147 void dump() const;
166166 return Roots[0];
167167 }
168168
169 virtual bool runOnFunction(Function &) {
169 bool runOnFunction(Function &) override {
170170 Frontiers.clear();
171171 DominatorTree &DT = getAnalysis().getDomTree();
172172 Roots = DT.getRoots();
175175 return false;
176176 }
177177
178 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
178 void getAnalysisUsage(AnalysisUsage &AU) const override {
179179 AU.setPreservesAll();
180180 AU.addRequired();
181181 }
3838 /// passed in, then the types are printed symbolically if possible, using the
3939 /// symbol table from the module.
4040 ///
41 void print(raw_ostream &o, const Module *M) const;
41 void print(raw_ostream &o, const Module *M) const override;
4242
4343 private:
4444 /// IncorporateType - Incorporate one type and all of its subtypes into the
5252
5353 public:
5454 /// run - This incorporates all types used by the specified module
55 bool runOnModule(Module &M);
55 bool runOnModule(Module &M) override;
5656
5757 /// getAnalysisUsage - We do not modify anything.
58 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
58 void getAnalysisUsage(AnalysisUsage &AU) const override {
5959 AU.setPreservesAll();
6060 }
6161 };
8585
8686 /// Deleted - Implementation of CallbackVH virtual function to
8787 /// receive notification when the User is deleted.
88 virtual void deleted();
88 void deleted() override;
8989 };
9090
9191 template<> struct ilist_traits
128128 /// we are interested in.
129129 ilist IVUses;
130130
131 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
131 void getAnalysisUsage(AnalysisUsage &AU) const override;
132132
133 virtual bool runOnLoop(Loop *L, LPPassManager &LPM);
133 bool runOnLoop(Loop *L, LPPassManager &LPM) override;
134134
135 virtual void releaseMemory();
135 void releaseMemory() override;
136136
137137 public:
138138 static char ID; // Pass ID, replacement for typeid
168168 return Processed.count(Inst);
169169 }
170170
171 void print(raw_ostream &OS, const Module* = 0) const;
171 void print(raw_ostream &OS, const Module* = 0) const override;
172172
173173 /// dump - This method is used for debugging.
174174 void dump() const;
107107 ~InlineCostAnalysis();
108108
109109 // Pass interface implementation.
110 void getAnalysisUsage(AnalysisUsage &AU) const;
111 bool runOnSCC(CallGraphSCC &SCC);
110 void getAnalysisUsage(AnalysisUsage &AU) const override;
111 bool runOnSCC(CallGraphSCC &SCC) override;
112112
113113 /// \brief Get an InlineCost object representing the cost of inlining this
114114 /// callsite.
5252 }
5353
5454 // run - Calculate the interval partition for this function
55 virtual bool runOnFunction(Function &F);
55 bool runOnFunction(Function &F) override;
5656
5757 // IntervalPartition ctor - Build a reduced interval partition from an
5858 // existing interval graph. This takes an additional boolean parameter to
6161 IntervalPartition(IntervalPartition &I, bool);
6262
6363 // print - Show contents in human readable format...
64 virtual void print(raw_ostream &O, const Module* = 0) const;
64 void print(raw_ostream &O, const Module* = 0) const override;
6565
6666 // getRootInterval() - Return the root interval that contains the starting
6767 // block of the function.
8080 }
8181
8282 // getAnalysisUsage - Implement the Pass API
83 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
83 void getAnalysisUsage(AnalysisUsage &AU) const override {
8484 AU.setPreservesAll();
8585 }
8686
8888 const std::vector &getIntervals() const { return Intervals; }
8989
9090 // releaseMemory - Reset state back to before function was analyzed
91 void releaseMemory();
91 void releaseMemory() override;
9292
9393 private:
9494 // addIntervalToPartition - Add an interval to the internal list of intervals,
6868 void eraseBlock(BasicBlock *BB);
6969
7070 // Implementation boilerplate.
71
72 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
73 virtual void releaseMemory();
74 virtual bool runOnFunction(Function &F);
71
72 void getAnalysisUsage(AnalysisUsage &AU) const override;
73 void releaseMemory() override;
74 bool runOnFunction(Function &F) override;
7575 };
7676
7777 } // end namespace llvm
3737 ~LibCallAliasAnalysis();
3838
3939 ModRefResult getModRefInfo(ImmutableCallSite CS,
40 const Location &Loc);
41
40 const Location &Loc) override;
41
4242 ModRefResult getModRefInfo(ImmutableCallSite CS1,
43 ImmutableCallSite CS2) {
43 ImmutableCallSite CS2) override {
4444 // TODO: Could compare two direct calls against each other if we cared to.
4545 return AliasAnalysis::getModRefInfo(CS1, CS2);
4646 }
47
48 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
49
50 virtual bool runOnFunction(Function &F) {
47
48 void getAnalysisUsage(AnalysisUsage &AU) const override;
49
50 bool runOnFunction(Function &F) override {
5151 InitializeAliasAnalysis(this); // set up super class
5252 return false;
5353 }
5656 /// an analysis interface through multiple inheritance. If needed, it
5757 /// should override this to adjust the this pointer as needed for the
5858 /// specified pass info.
59 virtual void *getAdjustedAnalysisPointer(const void *PI) {
59 void *getAdjustedAnalysisPointer(const void *PI) override {
6060 if (PI == &AliasAnalysis::ID)
6161 return (AliasAnalysis*)this;
6262 return this;
653653
654654 /// runOnFunction - Calculate the natural loop information.
655655 ///
656 virtual bool runOnFunction(Function &F);
657
658 virtual void verifyAnalysis() const;
659
660 virtual void releaseMemory() { LI.releaseMemory(); }
661
662 virtual void print(raw_ostream &O, const Module* M = 0) const;
663
664 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
656 bool runOnFunction(Function &F) override;
657
658 void verifyAnalysis() const override;
659
660 void releaseMemory() override { LI.releaseMemory(); }
661
662 void print(raw_ostream &O, const Module* M = 0) const override;
663
664 void getAnalysisUsage(AnalysisUsage &AU) const override;
665665
666666 /// removeLoop - This removes the specified top-level loop from this loop info
667667 /// object. The loop is not deleted, as it will presumably be inserted into
3131
3232 /// getPrinterPass - Get a pass to print the function corresponding
3333 /// to a Loop.
34 Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const;
34 Pass *createPrinterPass(raw_ostream &O,
35 const std::string &Banner) const override;
3536
3637 // runOnLoop - This method should be implemented by the subclass to perform
3738 // whatever action is necessary for the specified Loop.
5556 // LPPassManager passes. In such case, pop LPPassManager from the
5657 // stack. This will force assignPassManager() to create new
5758 // LPPassManger as expected.
58 void preparePassManager(PMStack &PMS);
59 void preparePassManager(PMStack &PMS) override;
5960
6061 /// Assign pass manager to manage this pass
61 virtual void assignPassManager(PMStack &PMS,
62 PassManagerType PMT);
62 void assignPassManager(PMStack &PMS, PassManagerType PMT) override;
6363
6464 /// Return what kind of Pass Manager can manage this pass.
65 virtual PassManagerType getPotentialPassManagerType() const {
65 PassManagerType getPotentialPassManagerType() const override {
6666 return PMT_LoopPassManager;
6767 }
6868
9494
9595 /// run - Execute all of the passes scheduled for execution. Keep track of
9696 /// whether any of the passes modifies the module, and if so, return true.
97 bool runOnFunction(Function &F);
97 bool runOnFunction(Function &F) override;
9898
9999 /// Pass Manager itself does not invalidate any analysis info.
100100 // LPPassManager needs LoopInfo.
101 void getAnalysisUsage(AnalysisUsage &Info) const;
101 void getAnalysisUsage(AnalysisUsage &Info) const override;
102102
103 virtual const char *getPassName() const {
103 const char *getPassName() const override {
104104 return "Loop Pass Manager";
105105 }
106106
107 virtual PMDataManager *getAsPMDataManager() { return this; }
108 virtual Pass *getAsPass() { return this; }
107 PMDataManager *getAsPMDataManager() override { return this; }
108 Pass *getAsPass() override { return this; }
109109
110110 /// Print passes managed by this manager
111 void dumpPassStructure(unsigned Offset);
111 void dumpPassStructure(unsigned Offset) override;
112112
113113 LoopPass *getContainedPass(unsigned N) {
114114 assert(N < PassVector.size() && "Pass number out of range!");
116116 return LP;
117117 }
118118
119 virtual PassManagerType getPassManagerType() const {
119 PassManagerType getPassManagerType() const override {
120120 return PMT_LoopPassManager;
121121 }
122122
331331 static char ID;
332332
333333 /// Pass Implementation stuff. This doesn't do any analysis eagerly.
334 bool runOnFunction(Function &);
334 bool runOnFunction(Function &) override;
335335
336336 /// Clean up memory in between runs
337 void releaseMemory();
337 void releaseMemory() override;
338338
339339 /// getAnalysisUsage - Does not modify anything. It uses Value Numbering
340340 /// and Alias Analysis.
341341 ///
342 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
342 void getAnalysisUsage(AnalysisUsage &AU) const override;
343343
344344 /// getDependency - Return the instruction on which a memory operation
345345 /// depends. See the class comment for more details. It is illegal to call
3131
3232 ~PostDominatorTree();
3333
34 virtual bool runOnFunction(Function &F);
34 bool runOnFunction(Function &F) override;
3535
36 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
36 void getAnalysisUsage(AnalysisUsage &AU) const override {
3737 AU.setPreservesAll();
3838 }
3939
8484 DT->getDescendants(R, Result);
8585 }
8686
87 virtual void releaseMemory() {
87 void releaseMemory() override {
8888 DT->releaseMemory();
8989 }
9090
91 virtual void print(raw_ostream &OS, const Module*) const;
91 void print(raw_ostream &OS, const Module*) const override;
9292 };
9393
9494 FunctionPass* createPostDomTree();
647647 // Calculate - detecte all regions in function and build the region tree.
648648 void Calculate(Function& F);
649649
650 void releaseMemory();
650 void releaseMemory() override;
651651
652652 // updateStatistics - Update statistic about created regions.
653653 void updateStatistics(Region *R);
664664
665665 /// @name FunctionPass interface
666666 //@{
667 virtual bool runOnFunction(Function &F);
668 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
669 virtual void print(raw_ostream &OS, const Module *) const;
670 virtual void verifyAnalysis() const;
667 bool runOnFunction(Function &F) override;
668 void getAnalysisUsage(AnalysisUsage &AU) const override;
669 void print(raw_ostream &OS, const Module *) const override;
670 void verifyAnalysis() const override;
671671 //@}
672672
673673 /// @brief Get the smallest region that contains a BasicBlock.
5454 /// @param Banner The banner to separate different printed passes.
5555 ///
5656 /// @return The pass to print the LLVM IR in the region.
57 Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const;
57 Pass *createPrinterPass(raw_ostream &O,
58 const std::string &Banner) const override;
5859
5960 using llvm::Pass::doInitialization;
6061 using llvm::Pass::doFinalization;
6768 /// @name PassManager API
6869 ///
6970 //@{
70 void preparePassManager(PMStack &PMS);
71 void preparePassManager(PMStack &PMS) override;
7172
72 virtual void assignPassManager(PMStack &PMS,
73 PassManagerType PMT = PMT_RegionPassManager);
73 void assignPassManager(PMStack &PMS,
74 PassManagerType PMT = PMT_RegionPassManager) override;
7475
75 virtual PassManagerType getPotentialPassManagerType() const {
76 PassManagerType getPotentialPassManagerType() const override {
7677 return PMT_RegionPassManager;
7778 }
7879 //@}
9394 /// @brief Execute all of the passes scheduled for execution.
9495 ///
9596 /// @return True if any of the passes modifies the function.
96 bool runOnFunction(Function &F);
97 bool runOnFunction(Function &F) override;
9798
9899 /// Pass Manager itself does not invalidate any analysis info.
99100 /// RGPassManager needs RegionInfo.
100 void getAnalysisUsage(AnalysisUsage &Info) const;
101 void getAnalysisUsage(AnalysisUsage &Info) const override;
101102
102 virtual const char *getPassName() const {
103 const char *getPassName() const override {
103104 return "Region Pass Manager";
104105 }
105106
106 virtual PMDataManager *getAsPMDataManager() { return this; }
107 virtual Pass *getAsPass() { return this; }
107 PMDataManager *getAsPMDataManager() override { return this; }
108 Pass *getAsPass() override { return this; }
108109
109110 /// @brief Print passes managed by this manager.
110 void dumpPassStructure(unsigned Offset);
111 void dumpPassStructure(unsigned Offset) override;
111112
112113 /// @brief Get passes contained by this manager.
113114 Pass *getContainedPass(unsigned N) {
116117 return FP;
117118 }
118119
119 virtual PassManagerType getPassManagerType() const {
120 PassManagerType getPassManagerType() const override {
120121 return PMT_RegionPassManager;
121122 }
122123 };
206206 /// notified whenever a Value is deleted.
207207 class SCEVCallbackVH : public CallbackVH {
208208 ScalarEvolution *SE;
209 virtual void deleted();
210 virtual void allUsesReplacedWith(Value *New);
209 void deleted() override;
210 void allUsesReplacedWith(Value *New) override;
211211 public:
212212 SCEVCallbackVH(Value *V, ScalarEvolution *SE = 0);
213213 };
893893 /// indirect operand.
894894 bool hasOperand(const SCEV *S, const SCEV *Op) const;
895895
896 virtual bool runOnFunction(Function &F);
897 virtual void releaseMemory();
898 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
899 virtual void print(raw_ostream &OS, const Module* = 0) const;
900 virtual void verifyAnalysis() const;
896 bool runOnFunction(Function &F) override;
897 void releaseMemory() override;
898 void getAnalysisUsage(AnalysisUsage &AU) const override;
899 void print(raw_ostream &OS, const Module* = 0) const override;
900 void verifyAnalysis() const override;
901901
902902 private:
903903 /// Compute the backedge taken count knowing the interval difference, the
409409 friend class ScalarEvolution;
410410
411411 // Implement CallbackVH.
412 virtual void deleted();
413 virtual void allUsesReplacedWith(Value *New);
412 void deleted() override;
413 void allUsesReplacedWith(Value *New) override;
414414
415415 /// SE - The parent ScalarEvolution value. This is used to update
416416 /// the parent's maps when the value associated with a SCEVUnknown
280280 struct AnalysisResultModel
281281 false> : AnalysisResultConcept {
282282 AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
283 virtual AnalysisResultModel *clone() {
283 AnalysisResultModel *clone() override {
284284 return new AnalysisResultModel(Result);
285285 }
286286
289289 // FIXME: We should actually use two different concepts for analysis results
290290 // rather than two different models, and avoid the indirect function call for
291291 // ones that use the trivial behavior.
292 virtual bool invalidate(IRUnitT, const PreservedAnalyses &PA) {
292 bool invalidate(IRUnitT, const PreservedAnalyses &PA) override {
293293 return !PA.preserved(PassT::ID());
294294 }
295295
369369 CapturesBefore(const Instruction *I, DominatorTree *DT)
370370 : BeforeHere(I), DT(DT), Captured(false) {}
371371
372 void tooManyUses() { Captured = true; }
373
374 bool shouldExplore(Use *U) {
372 void tooManyUses() override { Captured = true; }
373
374 bool shouldExplore(Use *U) override {
375375 Instruction *I = cast(U->getUser());
376376 BasicBlock *BB = I->getParent();
377377 // We explore this usage only if the usage can reach "BeforeHere".
387387 return true;
388388 }
389389
390 bool captured(Use *U) {
390 bool captured(Use *U) override {
391391 Instruction *I = cast(U->getUser());
392392 BasicBlock *BB = I->getParent();
393393 // Same logic as in shouldExplore.
7373 }
7474 }
7575
76 bool runOnModule(Module &M) {
76 bool runOnModule(Module &M) override {
7777 this->M = &M;
7878 InitializeAliasAnalysis(this);
7979 return false;
8080 }
8181
82 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
82 void getAnalysisUsage(AnalysisUsage &AU) const override {
8383 AliasAnalysis::getAnalysisUsage(AU);
8484 AU.addRequired();
8585 AU.setPreservesAll();
8989 /// an analysis interface through multiple inheritance. If needed, it
9090 /// should override this to adjust the this pointer as needed for the
9191 /// specified pass info.
92 virtual void *getAdjustedAnalysisPointer(AnalysisID PI) {
92 void *getAdjustedAnalysisPointer(AnalysisID PI) override {
9393 if (PI == &AliasAnalysis::ID)
9494 return (AliasAnalysis*)this;
9595 return this;
9696 }
9797
9898 // FIXME: We could count these too...
99 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) {
99 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override {
100100 return getAnalysis().pointsToConstantMemory(Loc, OrLocal);
101101 }
102102
103103 // Forwarding functions: just delegate to a real AA implementation, counting
104104 // the number of responses...
105 AliasResult alias(const Location &LocA, const Location &LocB);
105 AliasResult alias(const Location &LocA, const Location &LocB) override;
106106
107107 ModRefResult getModRefInfo(ImmutableCallSite CS,
108 const Location &Loc);
108 const Location &Loc) override;
109109 ModRefResult getModRefInfo(ImmutableCallSite CS1,
110 ImmutableCallSite CS2) {
110 ImmutableCallSite CS2) override {
111111 return AliasAnalysis::getModRefInfo(CS1,CS2);
112112 }
113113 };
5555 initializeAAEvalPass(*PassRegistry::getPassRegistry());
5656 }
5757
58 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
58 void getAnalysisUsage(AnalysisUsage &AU) const override {
5959 AU.addRequired();
6060 AU.setPreservesAll();
6161 }
6262
63 bool doInitialization(Module &M) {
63 bool doInitialization(Module &M) override {
6464 NoAlias = MayAlias = PartialAlias = MustAlias = 0;
6565 NoModRef = Mod = Ref = ModRef = 0;
6666
7272 return false;
7373 }
7474
75 bool runOnFunction(Function &F);
76 bool doFinalization(Module &M);
75 bool runOnFunction(Function &F) override;
76 bool doFinalization(Module &M) override;
7777 };
7878 }
7979
4242 initializeAliasDebuggerPass(*PassRegistry::getPassRegistry());
4343 }
4444
45 bool runOnModule(Module &M) {
45 bool runOnModule(Module &M) override {
4646 InitializeAliasAnalysis(this); // set up super class
4747
4848 for(Module::global_iterator I = M.global_begin(),
7575 return false;
7676 }
7777
78 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
78 void getAnalysisUsage(AnalysisUsage &AU) const override {
7979 AliasAnalysis::getAnalysisUsage(AU);
8080 AU.setPreservesAll(); // Does not transform code
8181 }
8484 /// an analysis interface through multiple inheritance. If needed, it
8585 /// should override this to adjust the this pointer as needed for the
8686 /// specified pass info.
87 virtual void *getAdjustedAnalysisPointer(AnalysisID PI) {
87 void *getAdjustedAnalysisPointer(AnalysisID PI) override {
8888 if (PI == &AliasAnalysis::ID)
8989 return (AliasAnalysis*)this;
9090 return this;
9393 //------------------------------------------------
9494 // Implement the AliasAnalysis API
9595 //
96 AliasResult alias(const Location &LocA, const Location &LocB) {
96 AliasResult alias(const Location &LocA, const Location &LocB) override {
9797 assert(Vals.find(LocA.Ptr) != Vals.end() &&
9898 "Never seen value in AA before");
9999 assert(Vals.find(LocB.Ptr) != Vals.end() &&
102102 }
103103
104104 ModRefResult getModRefInfo(ImmutableCallSite CS,
105 const Location &Loc) {
105 const Location &Loc) override {
106106 assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before");
107107 return AliasAnalysis::getModRefInfo(CS, Loc);
108108 }
109109
110110 ModRefResult getModRefInfo(ImmutableCallSite CS1,
111 ImmutableCallSite CS2) {
111 ImmutableCallSite CS2) override {
112112 return AliasAnalysis::getModRefInfo(CS1,CS2);
113113 }
114
115 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) {
114
115 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override {
116116 assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before");
117117 return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
118118 }
119119
120 virtual void deleteValue(Value *V) {
120 void deleteValue(Value *V) override {
121121 assert(Vals.find(V) != Vals.end() && "Never seen value in AA before");
122122 AliasAnalysis::deleteValue(V);
123123 }
124 virtual void copyValue(Value *From, Value *To) {
124 void copyValue(Value *From, Value *To) override {
125125 Vals.insert(To);
126126 AliasAnalysis::copyValue(From, To);
127127 }
626626 initializeAliasSetPrinterPass(*PassRegistry::getPassRegistry());
627627 }
628628
629 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
629 void getAnalysisUsage(AnalysisUsage &AU) const override {
630630 AU.setPreservesAll();
631631 AU.addRequired();
632632 }
633633
634 virtual bool runOnFunction(Function &F) {
634 bool runOnFunction(Function &F) override {
635635 Tracker = new AliasSetTracker(getAnalysis());
636636
637637 for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
443443 initializeBasicAliasAnalysisPass(*PassRegistry::getPassRegistry());
444444 }
445445
446 virtual void initializePass() {
446 void initializePass() override {
447447 InitializeAliasAnalysis(this);
448448 }
449449
450 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
450 void getAnalysisUsage(AnalysisUsage &AU) const override {
451451 AU.addRequired();
452452 AU.addRequired();
453453 }
454454
455 virtual AliasResult alias(const Location &LocA,
456 const Location &LocB) {
455 AliasResult alias(const Location &LocA, const Location &LocB) override {
457456 assert(AliasCache.empty() && "AliasCache must be cleared after use!");
458457 assert(notDifferentParent(LocA.Ptr, LocB.Ptr) &&
459458 "BasicAliasAnalysis doesn't support interprocedural queries.");
468467 return Alias;
469468 }
470469
471 virtual ModRefResult getModRefInfo(ImmutableCallSite CS,
472 const Location &Loc);
473
474 virtual ModRefResult getModRefInfo(ImmutableCallSite CS1,
475 ImmutableCallSite CS2) {
470 ModRefResult getModRefInfo(ImmutableCallSite CS,
471 const Location &Loc) override;
472
473 ModRefResult getModRefInfo(ImmutableCallSite CS1,
474 ImmutableCallSite CS2) override {
476475 // The AliasAnalysis base class has some smarts, lets use them.
477476 return AliasAnalysis::getModRefInfo(CS1, CS2);
478477 }
479478
480479 /// pointsToConstantMemory - Chase pointers until we find a (constant
481480 /// global) or not.
482 virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal);
481 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override;
483482
484483 /// getModRefBehavior - Return the behavior when calling the given
485484 /// call site.
486 virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS);
485 ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
487486
488487 /// getModRefBehavior - Return the behavior when calling the given function.
489488 /// For use when the call site is not known.
490 virtual ModRefBehavior getModRefBehavior(const Function *F);
489 ModRefBehavior getModRefBehavior(const Function *F) override;
491490
492491 /// getAdjustedAnalysisPointer - This method is used when a pass implements
493492 /// an analysis interface through multiple inheritance. If needed, it
494493 /// should override this to adjust the this pointer as needed for the
495494 /// specified pass info.
496 virtual void *getAdjustedAnalysisPointer(const void *ID) {
495 void *getAdjustedAnalysisPointer(const void *ID) override {
497496 if (ID == &AliasAnalysis::ID)
498497 return (AliasAnalysis*)this;
499498 return this;
2727 initializeCFGOnlyViewerPass(*PassRegistry::getPassRegistry());
2828 }
2929
30 virtual bool runOnFunction(Function &F) {
30 bool runOnFunction(Function &F) override {
3131 F.viewCFG();
3232 return false;
3333 }
3434
35 void print(raw_ostream &OS, const Module* = 0) const {}
35 void print(raw_ostream &OS, const Module* = 0) const override {}
3636
37 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
37 void getAnalysisUsage(AnalysisUsage &AU) const override {
3838 AU.setPreservesAll();
3939 }
4040 };
5050 initializeCFGOnlyViewerPass(*PassRegistry::getPassRegistry());
5151 }
5252
53 virtual bool runOnFunction(Function &F) {
53 bool runOnFunction(Function &F) override {
5454 F.viewCFGOnly();
5555 return false;
5656 }
5757
58 void print(raw_ostream &OS, const Module* = 0) const {}
58 void print(raw_ostream &OS, const Module* = 0) const override {}
5959
60 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
60 void getAnalysisUsage(AnalysisUsage &AU) const override {
6161 AU.setPreservesAll();
6262 }
6363 };
7474 initializeCFGPrinterPass(*PassRegistry::getPassRegistry());
7575 }
7676
77 virtual bool runOnFunction(Function &F) {
77 bool runOnFunction(Function &F) override {
7878 std::string Filename = "cfg." + F.getName().str() + ".dot";
7979 errs() << "Writing '" << Filename << "'...";
8080
8989 return false;
9090 }
9191
92 void print(raw_ostream &OS, const Module* = 0) const {}
92 void print(raw_ostream &OS, const Module* = 0) const override {}
9393
94 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
94 void getAnalysisUsage(AnalysisUsage &AU) const override {
9595 AU.setPreservesAll();
9696 }
9797 };
107107 CFGOnlyPrinter() : FunctionPass(ID) {
108108 initializeCFGOnlyPrinterPass(*PassRegistry::getPassRegistry());
109109 }
110
111 virtual bool runOnFunction(Function &F) {
110
111 bool runOnFunction(Function &F) override {
112112 std::string Filename = "cfg." + F.getName().str() + ".dot";
113113 errs() << "Writing '" << Filename << "'...";
114114
122122 errs() << "\n";
123123 return false;
124124 }
125 void print(raw_ostream &OS, const Module* = 0) const {}
125 void print(raw_ostream &OS, const Module* = 0) const override {}
126126
127 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
127 void getAnalysisUsage(AnalysisUsage &AU) const override {
128128 AU.setPreservesAll();
129129 }
130130 };
3434 explicit SimpleCaptureTracker(bool ReturnCaptures)
3535 : ReturnCaptures(ReturnCaptures), Captured(false) {}
3636
37 void tooManyUses() { Captured = true; }
37 void tooManyUses() override { Captured = true; }
3838
39 bool captured(Use *U) {
39 bool captured(Use *U) override {
4040 if (isa(U->getUser()) && !ReturnCaptures)
4141 return false;
4242
5252 unsigned getInstructionCost(const Instruction *I) const;
5353
5454 private:
55 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
56 virtual bool runOnFunction(Function &F);
57 virtual void print(raw_ostream &OS, const Module*) const;
55 void getAnalysisUsage(AnalysisUsage &AU) const override;
56 bool runOnFunction(Function &F) override;
57 void print(raw_ostream &OS, const Module*) const override;
5858
5959 /// The function that we analyze.
6060 Function *F;
4848 Delinearization() : FunctionPass(ID) {
4949 initializeDelinearizationPass(*PassRegistry::getPassRegistry());
5050 }
51 virtual bool runOnFunction(Function &F);
52 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
53 virtual void print(raw_ostream &O, const Module *M = 0) const;
51 bool runOnFunction(Function &F) override;
52 void getAnalysisUsage(AnalysisUsage &AU) const override;
53 void print(raw_ostream &O, const Module *M = 0) const override;
5454 };
5555
5656 } // end anonymous namespace
4848
4949 /// run - Execute all of the passes scheduled for execution. Keep track of
5050 /// whether any of the passes modifies the module, and if so, return true.
51 bool runOnModule(Module &M);
51 bool runOnModule(Module &M) override;
5252
5353 using ModulePass::doInitialization;
5454 using ModulePass::doFinalization;
5757 bool doFinalization(CallGraph &CG);
5858
5959 /// Pass Manager itself does not invalidate any analysis info.
60 void getAnalysisUsage(AnalysisUsage &Info) const {
60 void getAnalysisUsage(AnalysisUsage &Info) const override {
6161 // CGPassManager walks SCC and it needs CallGraph.
6262 Info.addRequired();
6363 Info.setPreservesAll();
6464 }
6565
66 virtual const char *getPassName() const {
66 const char *getPassName() const override {
6767 return "CallGraph Pass Manager";
6868 }
6969
70 virtual PMDataManager *getAsPMDataManager() { return this; }
71 virtual Pass *getAsPass() { return this; }
70 PMDataManager *getAsPMDataManager() override { return this; }
71 Pass *getAsPass() override { return this; }
7272
7373 // Print passes managed by this manager
74 void dumpPassStructure(unsigned Offset) {
74 void dumpPassStructure(unsigned Offset) override {
7575 errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
7676 for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
7777 Pass *P = getContainedPass(Index);
8585 return static_cast(PassVector[N]);
8686 }
8787
88 virtual PassManagerType getPassManagerType() const {
88 PassManagerType getPassManagerType() const override {
8989 return PMT_CallGraphPassManager;
9090 }
9191
589589 static char ID;
590590 PrintCallGraphPass(const std::string &B, raw_ostream &o)
591591 : CallGraphSCCPass(ID), Banner(B), Out(o) {}
592
593 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
592
593 void getAnalysisUsage(AnalysisUsage &AU) const override {
594594 AU.setPreservesAll();
595595 }
596
597 bool runOnSCC(CallGraphSCC &SCC) {
596
597 bool runOnSCC(CallGraphSCC &SCC) override {
598598 Out << Banner;
599599 for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I)
600600 (*I)->getFunction()->print(Out);
9393 initializeGlobalsModRefPass(*PassRegistry::getPassRegistry());
9494 }
9595
96 bool runOnModule(Module &M) {
96 bool runOnModule(Module &M) override {
9797 InitializeAliasAnalysis(this);
9898
9999 // Find non-addr taken globals.
104104 return false;
105105 }
106106
107 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
107 void getAnalysisUsage(AnalysisUsage &AU) const override {
108108 AliasAnalysis::getAnalysisUsage(AU);
109109 AU.addRequired();
110110 AU.setPreservesAll(); // Does not transform code
113113 //------------------------------------------------
114114 // Implement the AliasAnalysis API
115115 //
116 AliasResult alias(const Location &LocA, const Location &LocB);
116 AliasResult alias(const Location &LocA, const Location &LocB) override;
117117 ModRefResult getModRefInfo(ImmutableCallSite CS,
118 const Location &Loc);
118 const Location &Loc) override;
119119 ModRefResult getModRefInfo(ImmutableCallSite CS1,
120 ImmutableCallSite CS2) {
120 ImmutableCallSite CS2) override {
121121 return AliasAnalysis::getModRefInfo(CS1, CS2);
122122 }
123123
124124 /// getModRefBehavior - Return the behavior of the specified function if
125125 /// called from the specified call site. The call site may be null in which
126126 /// case the most generic behavior of this function should be returned.
127 ModRefBehavior getModRefBehavior(const Function *F) {
127 ModRefBehavior getModRefBehavior(const Function *F) override {
128128 ModRefBehavior Min = UnknownModRefBehavior;
129129
130130 if (FunctionRecord *FR = getFunctionInfo(F)) {
140140 /// getModRefBehavior - Return the behavior of the specified function if
141141 /// called from the specified call site. The call site may be null in which
142142 /// case the most generic behavior of this function should be returned.
143 ModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
143 ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
144144 ModRefBehavior Min = UnknownModRefBehavior;
145145
146146 if (const Function* F = CS.getCalledFunction())
154154 return ModRefBehavior(AliasAnalysis::getModRefBehavior(CS) & Min);
155155 }
156156
157 virtual void deleteValue(Value *V);
158 virtual void copyValue(Value *From, Value *To);
159 virtual void addEscapingUse(Use &U);
157 void deleteValue(Value *V) override;
158 void copyValue(Value *From, Value *To) override;
159 void addEscapingUse(Use &U) override;
160160
161161 /// getAdjustedAnalysisPointer - This method is used when a pass implements
162162 /// an analysis interface through multiple inheritance. If needed, it
163163 /// should override this to adjust the this pointer as needed for the
164164 /// specified pass info.
165 virtual void *getAdjustedAnalysisPointer(AnalysisID PI) {
165 void *getAdjustedAnalysisPointer(AnalysisID PI) override {
166166 if (PI == &AliasAnalysis::ID)
167167 return (AliasAnalysis*)this;
168168 return this;
5454 initializeInstCountPass(*PassRegistry::getPassRegistry());
5555 }
5656
57 virtual bool runOnFunction(Function &F);
57 bool runOnFunction(Function &F) override;
5858
59 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
59 void getAnalysisUsage(AnalysisUsage &AU) const override {
6060 AU.setPreservesAll();
6161 }
62 virtual void print(raw_ostream &O, const Module *M) const {}
62 void print(raw_ostream &O, const Module *M) const override {}
6363
6464 };
6565 }
301301
302302 LVIValueHandle(Value *V, LazyValueInfoCache *P)
303303 : CallbackVH(V), Parent(P) { }
304
305 void deleted();
306 void allUsesReplacedWith(Value *V) {
304
305 void deleted() override;
306 void allUsesReplacedWith(Value *V) override {
307307 deleted();
308308 }
309309 };
112112 initializeLintPass(*PassRegistry::getPassRegistry());
113113 }
114114
115 virtual bool runOnFunction(Function &F);
116
117 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
115 bool runOnFunction(Function &F) override;
116
117 void getAnalysisUsage(AnalysisUsage &AU) const override {
118118 AU.setPreservesAll();
119119 AU.addRequired();
120120 AU.addRequired();
121121 AU.addRequired();
122122 }
123 virtual void print(raw_ostream &O, const Module *M) const {}
123 void print(raw_ostream &O, const Module *M) const override {}
124124
125125 void WriteValue(const Value *V) {
126126 if (!V) return;
3232 PrintLoopPass(const std::string &B, raw_ostream &o)
3333 : LoopPass(ID), Banner(B), Out(o) {}
3434
35 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
35 void getAnalysisUsage(AnalysisUsage &AU) const override {
3636 AU.setPreservesAll();
3737 }
3838
39 bool runOnLoop(Loop *L, LPPassManager &) {
39 bool runOnLoop(Loop *L, LPPassManager &) override {
4040 Out << Banner;
4141 for (Loop::block_iterator b = L->block_begin(), be = L->block_end();
4242 b != be;
4343 initializeMemDepPrinterPass(*PassRegistry::getPassRegistry());
4444 }
4545
46 virtual bool runOnFunction(Function &F);
46 bool runOnFunction(Function &F) override;
4747
48 void print(raw_ostream &OS, const Module * = 0) const;
48 void print(raw_ostream &OS, const Module * = 0) const override;
4949
50 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
50 void getAnalysisUsage(AnalysisUsage &AU) const override {
5151 AU.addRequiredTransitive();
5252 AU.addRequiredTransitive();
5353 AU.setPreservesAll();
5454 }
5555
56 virtual void releaseMemory() {
56 void releaseMemory() override {
5757 Deps.clear();
5858 F = 0;
5959 }
3232 initializeModuleDebugInfoPrinterPass(*PassRegistry::getPassRegistry());
3333 }
3434
35 virtual bool runOnModule(Module &M);
35 bool runOnModule(Module &M) override;
3636
37 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
37 void getAnalysisUsage(AnalysisUsage &AU) const override {
3838 AU.setPreservesAll();
3939 }
40 virtual void print(raw_ostream &O, const Module *M) const;
40 void print(raw_ostream &O, const Module *M) const override;
4141 };
4242 }
4343
2929 initializeNoAAPass(*PassRegistry::getPassRegistry());
3030 }
3131
32 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
33 }
32 void getAnalysisUsage(AnalysisUsage &AU) const override {}
3433
35 virtual void initializePass() {
34 void initializePass() override {
3635 // Note: NoAA does not call InitializeAliasAnalysis because it's
3736 // special and does not support chaining.
3837 DataLayoutPass *DLP = getAnalysisIfAvailable();
3938 DL = DLP ? &DLP->getDataLayout() : 0;
4039 }
4140
42 virtual AliasResult alias(const Location &LocA, const Location &LocB) {
41 AliasResult alias(const Location &LocA, const Location &LocB) override {
4342 return MayAlias;
4443 }
4544
46 virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
45 ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
4746 return UnknownModRefBehavior;
4847 }
49 virtual ModRefBehavior getModRefBehavior(const Function *F) {
48 ModRefBehavior getModRefBehavior(const Function *F) override {
5049 return UnknownModRefBehavior;
5150 }
5251
53 virtual bool pointsToConstantMemory(const Location &Loc,
54 bool OrLocal) {
52 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override {
5553 return false;
5654 }
57 virtual ModRefResult getModRefInfo(ImmutableCallSite CS,
58 const Location &Loc) {
55 ModRefResult getModRefInfo(ImmutableCallSite CS,
56 const Location &Loc) override {
5957 return ModRef;
6058 }
61 virtual ModRefResult getModRefInfo(ImmutableCallSite CS1,
62 ImmutableCallSite CS2) {
59 ModRefResult getModRefInfo(ImmutableCallSite CS1,
60 ImmutableCallSite CS2) override {
6361 return ModRef;
6462 }
6563
66 virtual void deleteValue(Value *V) {}
67 virtual void copyValue(Value *From, Value *To) {}
68 virtual void addEscapingUse(Use &U) {}
69
64 void deleteValue(Value *V) override {}
65 void copyValue(Value *From, Value *To) override {}
66 void addEscapingUse(Use &U) override {}
67
7068 /// getAdjustedAnalysisPointer - This method is used when a pass implements
7169 /// an analysis interface through multiple inheritance. If needed, it
7270 /// should override this to adjust the this pointer as needed for the
7371 /// specified pass info.
74 virtual void *getAdjustedAnalysisPointer(const void *ID) {
72 void *getAdjustedAnalysisPointer(const void *ID) override {
7573 if (ID == &AliasAnalysis::ID)
7674 return (AliasAnalysis*)this;
7775 return this;
188188 PrintRegionPass(const std::string &B, raw_ostream &o)
189189 : RegionPass(ID), Banner(B), Out(o) {}
190190
191 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
191 void getAnalysisUsage(AnalysisUsage &AU) const override {
192192 AU.setPreservesAll();
193193 }
194194
195 virtual bool runOnRegion(Region *R, RGPassManager &RGM) {
195 bool runOnRegion(Region *R, RGPassManager &RGM) override {
196196 Out << Banner;
197197 for (const auto &BB : R->blocks())
198198 BB->print(Out);
4242 /// an analysis interface through multiple inheritance. If needed, it
4343 /// should override this to adjust the this pointer as needed for the
4444 /// specified pass info.
45 virtual void *getAdjustedAnalysisPointer(AnalysisID PI) {
45 void *getAdjustedAnalysisPointer(AnalysisID PI) override {
4646 if (PI == &AliasAnalysis::ID)
4747 return (AliasAnalysis*)this;
4848 return this;
4949 }
5050
5151 private:
52 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
53 virtual bool runOnFunction(Function &F);
54 virtual AliasResult alias(const Location &LocA, const Location &LocB);
52 void getAnalysisUsage(AnalysisUsage &AU) const override;
53 bool runOnFunction(Function &F) override;
54 AliasResult alias(const Location &LocA, const Location &LocB) override;
5555
5656 Value *GetBaseValue(const SCEV *S);
5757 };
280280 initializeTypeBasedAliasAnalysisPass(*PassRegistry::getPassRegistry());
281281 }
282282
283 virtual void initializePass() {
283 void initializePass() override {
284284 InitializeAliasAnalysis(this);
285285 }
286286
288288 /// an analysis interface through multiple inheritance. If needed, it
289289 /// should override this to adjust the this pointer as needed for the
290290 /// specified pass info.
291 virtual void *getAdjustedAnalysisPointer(const void *PI) {
291 void *getAdjustedAnalysisPointer(const void *PI) override {
292292 if (PI == &AliasAnalysis::ID)
293293 return (AliasAnalysis*)this;
294294 return this;
298298 bool PathAliases(const MDNode *A, const MDNode *B) const;
299299
300300 private:
301 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
302 virtual AliasResult alias(const Location &LocA, const Location &LocB);
303 virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal);
304 virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS);
305 virtual ModRefBehavior getModRefBehavior(const Function *F);
306 virtual ModRefResult getModRefInfo(ImmutableCallSite CS,
307 const Location &Loc);
308 virtual ModRefResult getModRefInfo(ImmutableCallSite CS1,
309 ImmutableCallSite CS2);
301 void getAnalysisUsage(AnalysisUsage &AU) const override;
302 AliasResult alias(const Location &LocA, const Location &LocB) override;
303 bool pointsToConstantMemory(const Location &Loc, bool OrLocal) override;
304 ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
305 ModRefBehavior getModRefBehavior(const Function *F) override;
306 ModRefResult getModRefInfo(ImmutableCallSite CS,
307 const Location &Loc) override;
308 ModRefResult getModRefInfo(ImmutableCallSite CS1,
309 ImmutableCallSite CS2) override;
310310 };
311311 } // End of anonymous namespace
312312