diff options
62 files changed, 609 insertions, 650 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 3c8b2c4107..61693876c4 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -118,11 +118,10 @@ public: // run - Compute the call graph for the specified module. virtual bool run(Module *TheModule); - // getAnalysisUsageInfo - This obviously provides a call graph - virtual void getAnalysisUsageInfo(AnalysisSet &Required, - AnalysisSet &Destroyed, - AnalysisSet &Provided) { - Provided.push_back(ID); + // getAnalysisUsage - This obviously provides a call graph + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); } // releaseMemory - Data structures can be large, so free memory agressively. diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index 2d21545aeb..90a4b5df23 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -485,11 +485,10 @@ public: // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); - // getAnalysisUsageInfo - This obviously provides a call graph - virtual void getAnalysisUsageInfo(AnalysisSet &Required, - AnalysisSet &Destroyed, - AnalysisSet &Provided) { - Provided.push_back(ID); + // getAnalysisUsage - This obviously provides a call graph + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); } }; diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index 2d21545aeb..90a4b5df23 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -485,11 +485,10 @@ public: // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); - // getAnalysisUsageInfo - This obviously provides a call graph - virtual void getAnalysisUsageInfo(AnalysisSet &Required, - AnalysisSet &Destroyed, - AnalysisSet &Provided) { - Provided.push_back(ID); + // getAnalysisUsage - This obviously provides a call graph + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); } }; diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index d860ec5504..1f35331b92 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -1,13 +1,13 @@ //===- llvm/Analysis/Dominators.h - Dominator Info Calculation ---*- C++ -*--=// // // This file defines the following classes: -// 1. DominatorSet: Calculates the [reverse] dominator set for a method +// 1. DominatorSet: Calculates the [reverse] dominator set for a function // 2. ImmediateDominators: Calculates and holds a mapping between BasicBlocks // and their immediate dominator. // 3. DominatorTree: Represent the ImmediateDominator as an explicit tree // structure. // 4. DominanceFrontier: Calculate and hold the dominance frontier for a -// method. +// function. // // These data structures are listed in increasing order of complexity. It // takes longer to calculate the dominator frontier, for example, than the @@ -28,7 +28,7 @@ namespace cfg { // DominatorBase - Base class that other, more interesting dominator analyses // inherit from. // -class DominatorBase : public MethodPass { +class DominatorBase : public FunctionPass { protected: BasicBlock *Root; const bool IsPostDominators; @@ -45,7 +45,7 @@ public: //===----------------------------------------------------------------------===// // // DominatorSet - Maintain a set<const BasicBlock*> for every basic block in a -// method, that represents the blocks that dominate the block. +// function, that represents the blocks that dominate the block. // class DominatorSet : public DominatorBase { public: @@ -59,14 +59,14 @@ private: void calcPostDominatorSet(Function *F); public: // DominatorSet ctor - Build either the dominator set or the post-dominator - // set for a method... + // set for a function... // static AnalysisID ID; // Build dominator set static AnalysisID PostDomID; // Build postdominator set DominatorSet(AnalysisID id) : DominatorBase(id == PostDomID) {} - virtual bool runOnMethod(Function *F); + virtual bool runOnFunction(Function *F); // Accessor interface: typedef DomSetMapType::const_iterator const_iterator; @@ -83,7 +83,7 @@ public: // inline const DomSetType &getDominators(const BasicBlock *BB) const { const_iterator I = find(BB); - assert(I != end() && "BB not in method!"); + assert(I != end() && "BB not in function!"); return I->second; } @@ -93,19 +93,17 @@ public: return getDominators(B).count(A) != 0; } - // getAnalysisUsageInfo - This obviously provides a dominator set, but it also - // uses the UnifyMethodExitNode pass if building post-dominators + // getAnalysisUsage - This obviously provides a dominator set, but it also + // uses the UnifyFunctionExitNode pass if building post-dominators // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided); + virtual void getAnalysisUsage(AnalysisUsage &AU) const; }; //===----------------------------------------------------------------------===// // // ImmediateDominators - Calculate the immediate dominator for each node in a -// method. +// function. // class ImmediateDominators : public DominatorBase { std::map<const BasicBlock*, const BasicBlock*> IDoms; @@ -113,14 +111,14 @@ class ImmediateDominators : public DominatorBase { public: // ImmediateDominators ctor - Calculate the idom or post-idom mapping, - // for a method... + // for a function... // static AnalysisID ID; // Build immediate dominators static AnalysisID PostDomID; // Build immediate postdominators ImmediateDominators(AnalysisID id) : DominatorBase(id == PostDomID) {} - virtual bool runOnMethod(Function *F) { + virtual bool runOnFunction(Function *F) { IDoms.clear(); // Reset from the last time we were run... DominatorSet *DS; if (isPostDominator()) @@ -149,18 +147,17 @@ public: return I != IDoms.end() ? I->second : 0; } - // getAnalysisUsageInfo - This obviously provides a dominator tree, but it + // getAnalysisUsage - This obviously provides a dominator tree, but it // can only do so with the input of dominator sets // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); if (isPostDominator()) { - Requires.push_back(DominatorSet::PostDomID); - Provided.push_back(PostDomID); + AU.addRequired(DominatorSet::PostDomID); + AU.addProvided(PostDomID); } else { - Requires.push_back(DominatorSet::ID); - Provided.push_back(ID); + AU.addRequired(DominatorSet::ID); + AU.addProvided(ID); } } }; @@ -168,7 +165,7 @@ public: //===----------------------------------------------------------------------===// // -// DominatorTree - Calculate the immediate dominator tree for a method. +// DominatorTree - Calculate the immediate dominator tree for a function. // class DominatorTree : public DominatorBase { class Node2; @@ -213,7 +210,7 @@ public: DominatorTree(AnalysisID id) : DominatorBase(id == PostDomID) {} ~DominatorTree() { reset(); } - virtual bool runOnMethod(Function *F) { + virtual bool runOnFunction(Function *F) { reset(); DominatorSet *DS; if (isPostDominator()) @@ -230,18 +227,17 @@ public: return (i != Nodes.end()) ? i->second : 0; } - // getAnalysisUsageInfo - This obviously provides a dominator tree, but it + // getAnalysisUsage - This obviously provides a dominator tree, but it // uses dominator sets // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); if (isPostDominator()) { - Requires.push_back(DominatorSet::PostDomID); - Provided.push_back(PostDomID); + AU.addRequired(DominatorSet::PostDomID); + AU.addProvided(PostDomID); } else { - Requires.push_back(DominatorSet::ID); - Provided.push_back(ID); + AU.addRequired(DominatorSet::ID); + AU.addProvided(ID); } } }; @@ -249,7 +245,7 @@ public: //===----------------------------------------------------------------------===// // -// DominanceFrontier - Calculate the dominance frontiers for a method. +// DominanceFrontier - Calculate the dominance frontiers for a function. // class DominanceFrontier : public DominatorBase { public: @@ -263,14 +259,14 @@ private: const DominatorTree::Node *Node); public: - // DominatorFrontier ctor - Compute dominator frontiers for a method + // DominatorFrontier ctor - Compute dominator frontiers for a function // static AnalysisID ID; // Build dominator frontier static AnalysisID PostDomID; // Build postdominator frontier DominanceFrontier(AnalysisID id) : DominatorBase(id == PostDomID) {} - virtual bool runOnMethod(Function *) { + virtual bool runOnFunction(Function *) { Frontiers.clear(); DominatorTree *DT; if (isPostDominator()) @@ -292,18 +288,17 @@ public: inline const_iterator end() const { return Frontiers.end(); } inline const_iterator find(const BasicBlock* B) const { return Frontiers.find(B); } - // getAnalysisUsageInfo - This obviously provides a dominator tree, but it + // getAnalysisUsage - This obviously provides the dominance frontier, but it // uses dominator sets // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); if (isPostDominator()) { - Requires.push_back(DominatorTree::PostDomID); - Provided.push_back(PostDomID); + AU.addRequired(DominatorTree::PostDomID); + AU.addProvided(PostDomID); } else { - Requires.push_back(DominatorTree::ID); - Provided.push_back(ID); + AU.addRequired(DominatorTree::ID); + AU.addProvided(ID); } } }; diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index cd34676727..82cc28a06f 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -1,4 +1,4 @@ -//===- llvm/Analysis/SafePointerAccess.h - Check pointer safety ---*- C++ -*-=// +//===- llvm/Analysis/FindUnsafePointerTypes.h - Unsafe pointers ---*- C++ -*-=// // // This file defines a pass that can be used to determine, interprocedurally, // which pointer types are accessed unsafely in a program. If there is an @@ -10,12 +10,12 @@ // // Additionally, this analysis exports a hidden command line argument that (when // enabled) prints out the reasons a type was determined to be unsafe. Just add -// -unsafeptrinst to the command line of the tool you want to get it. +// -printunsafeptrinst to the command line of the tool you want to get it. // //===----------------------------------------------------------------------===// -#ifndef LLVM_ANALYSIS_SAFEPOINTERACCESS_H -#define LLVM_ANALYSIS_SAFEPOINTERACCESS_H +#ifndef LLVM_ANALYSIS_UNSAFEPOINTERTYPES_H +#define LLVM_ANALYSIS_UNSAFEPOINTERTYPES_H #include "llvm/Pass.h" #include <set> @@ -46,11 +46,12 @@ public: // void printResults(const Module *Mod, std::ostream &o) const; - // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job... + // getAnalysisUsage - Of course, we provide ourself... // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); + } }; #endif diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index bbaf8dff6b..5c02b2cc5f 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -52,11 +52,12 @@ public: // bool run(Module *M); - // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job... + // getAnalysisUsage - Of course, we provide ourself... // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); + } }; #endif diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 10f53173bc..d31b5fd750 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -1,7 +1,7 @@ //===- IntervalPartition.h - Interval partition Calculation ------*- C++ -*--=// // // This file contains the declaration of the cfg::IntervalPartition class, which -// calculates and represents the interval partition of a method, or a +// calculates and represents the interval partition of a function, or a // preexisting interval partition. // // In this way, the interval partition may be used to reduce a flow graph down @@ -24,12 +24,12 @@ namespace cfg { //===----------------------------------------------------------------------===// // // IntervalPartition - This class builds and holds an "interval partition" for -// a method. This partition divides the control flow graph into a set of +// a function. This partition divides the control flow graph into a set of // maximal intervals, as defined with the properties above. Intuitively, a // BasicBlock is a (possibly nonexistent) loop with a "tail" of non looping // nodes following it. // -class IntervalPartition : public MethodPass, public std::vector<Interval*> { +class IntervalPartition : public FunctionPass, public std::vector<Interval*> { typedef std::map<BasicBlock*, Interval*> IntervalMapTy; IntervalMapTy IntervalMap; @@ -41,8 +41,8 @@ public: IntervalPartition(AnalysisID AID) : RootInterval(0) { assert(AID == ID); } - // run - Calculate the interval partition for this method - virtual bool runOnMethod(Function *F); + // run - Calculate the interval partition for this function + virtual bool runOnFunction(Function *F); // IntervalPartition ctor - Build a reduced interval partition from an // existing interval graph. This takes an additional boolean parameter to @@ -54,7 +54,7 @@ public: ~IntervalPartition() { destroy(); } // getRootInterval() - Return the root interval that contains the starting - // block of the method. + // block of the function. inline Interval *getRootInterval() { return RootInterval; } // isDegeneratePartition() - Returns true if the interval partition contains @@ -69,15 +69,14 @@ public: return I != IntervalMap.end() ? I->second : 0; } - // getAnalysisUsageInfo - Implement the Pass API - virtual void getAnalysisUsageInfo(AnalysisSet &Required, - AnalysisSet &Destroyed, - AnalysisSet &Provided) { - Provided.push_back(ID); + // getAnalysisUsage - Implement the Pass API + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); } private: - // destroy - Reset state back to before method was analyzed + // destroy - Reset state back to before function was analyzed void destroy(); // addIntervalToPartition - Add an interval to the internal list of intervals, diff --git a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h index 435f177045..eabae4bddc 100644 --- a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h +++ b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h @@ -1,15 +1,15 @@ -/* Title: MethodLiveVarInfo.h -*- C++ -*- +/* Title: FunctionLiveVarInfo.h -*- C++ -*- Author: Ruchira Sasanka Date: Jun 30, 01 Purpose: - This is the interface for live variable info of a method that is required + This is the interface for live variable info of a function that is required by any other part of the compiler It must be called like: - MethodLiveVarInfo MLVI(Function *); // initializes data structures - MLVI.analyze(); // do the actural live variable anal + FunctionLiveVarInfo FLVI(Function *); // initializes data structures + FLVI.analyze(); // do the actural live variable anal After the analysis, getInSetOfBB or getOutSetofBB can be called to get live var info of a BB. @@ -79,7 +79,7 @@ enum LiveVarDebugLevel_t { extern cl::Enum<LiveVarDebugLevel_t> DEBUG_LV; -class MethodLiveVarInfo : public MethodPass { +class MethodLiveVarInfo : public FunctionPass { // Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst std::map<const MachineInstr *, const ValueSet *> MInst2LVSetBI; @@ -105,19 +105,18 @@ public: MethodLiveVarInfo(AnalysisID id = ID) { assert(id == ID); } - // --------- Implement the MethodPass interface ---------------------- + // --------- Implement the FunctionPass interface ---------------------- - // runOnMethod - Perform analysis, update internal data structures. - virtual bool runOnMethod(Function *F); + // runOnFunction - Perform analysis, update internal data structures. + virtual bool runOnFunction(Function *F); // releaseMemory - After LiveVariable analysis has been used, forget! virtual void releaseMemory(); - // getAnalysisUsageInfo - Provide self! - virtual void getAnalysisUsageInfo(AnalysisSet &Required, - AnalysisSet &Destroyed, - AnalysisSet &Provided) { - Provided.push_back(ID); + // getAnalysisUsage - Provide self! + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addProvided(ID); } // --------- Functions to access analysis results ------------------- diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 5b6000d450..6c9468c7d3 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -62,9 +62,9 @@ private: //===----------------------------------------------------------------------===// // LoopInfo - This class builds and contains al |