summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/CallGraph.h6
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h14
-rw-r--r--include/llvm/Analysis/FindUnsafePointerTypes.h4
-rw-r--r--include/llvm/Analysis/FindUsedTypes.h4
-rw-r--r--include/llvm/Assembly/PrintModulePass.h4
-rw-r--r--include/llvm/Bytecode/WriteBytecodePass.h4
-rw-r--r--include/llvm/CallGraphSCCPass.h4
-rw-r--r--include/llvm/Pass.h36
-rw-r--r--include/llvm/PassManager.h1
9 files changed, 46 insertions, 31 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 8f2c302389..446ea500d4 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -64,7 +64,7 @@ class CallGraphNode;
//===----------------------------------------------------------------------===//
// CallGraph class definition
//
-class CallGraph : public Pass {
+class CallGraph : public ModulePass {
Module *Mod; // The module this call graph represents
typedef std::map<const Function *, CallGraphNode *> FunctionMapTy;
@@ -150,8 +150,8 @@ public:
CallGraph() : Root(0), CallsExternalNode(0) {}
~CallGraph() { destroy(); }
- // run - Compute the call graph for the specified module.
- virtual bool run(Module &M);
+ // runOnModule - Compute the call graph for the specified module.
+ virtual bool runOnModule(Module &M);
// getAnalysisUsage - This obviously provides a call graph
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index 9351ed4c98..34575a2db8 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -40,14 +40,14 @@ namespace DataStructureAnalysis {
// FIXME: This should be a Function pass that can be USED by a Pass, and would
// be automatically preserved. Until we can do that, this is a Pass.
//
-class LocalDataStructures : public Pass {
+class LocalDataStructures : public ModulePass {
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph;
public:
~LocalDataStructures() { releaseMemory(); }
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
bool hasGraph(const Function &F) const {
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
@@ -86,7 +86,7 @@ public:
/// data structure graphs for all of the functions in the program. This pass
/// only performs a "Bottom Up" propagation (hence the name).
///
-class BUDataStructures : public Pass {
+class BUDataStructures : public ModulePass {
protected:
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
@@ -95,7 +95,7 @@ protected:
public:
~BUDataStructures() { releaseMemory(); }
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
bool hasGraph(const Function &F) const {
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
@@ -149,7 +149,7 @@ private:
/// for each function using the closed graphs for the callers computed
/// by the bottom-up pass.
///
-class TDDataStructures : public Pass {
+class TDDataStructures : public ModulePass {
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
hash_set<Function*> ArgsRemainIncomplete;
@@ -157,7 +157,7 @@ class TDDataStructures : public Pass {
public:
~TDDataStructures() { releaseMyMemory(); }
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
bool hasGraph(const Function &F) const {
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
@@ -207,7 +207,7 @@ private:
/// allocation.
///
struct CompleteBUDataStructures : public BUDataStructures {
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
bool hasGraph(const Function &F) const {
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h
index a2306021f9..2d453f087a 100644
--- a/include/llvm/Analysis/FindUnsafePointerTypes.h
+++ b/include/llvm/Analysis/FindUnsafePointerTypes.h
@@ -31,7 +31,7 @@ namespace llvm {
class PointerType;
-struct FindUnsafePointerTypes : public Pass {
+struct FindUnsafePointerTypes : public ModulePass {
// UnsafeTypes - Set of types that are not safe to transform.
std::set<PointerType*> UnsafeTypes;
public:
@@ -44,7 +44,7 @@ public:
/// values of various types. If they are deemed to be 'unsafe' note that the
/// type is not safe to transform.
///
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
/// print - Loop over the results of the analysis, printing out unsafe types.
///
diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h
index 69471791ab..143d6ce031 100644
--- a/include/llvm/Analysis/FindUsedTypes.h
+++ b/include/llvm/Analysis/FindUsedTypes.h
@@ -21,7 +21,7 @@ namespace llvm {
class Type;
-class FindUsedTypes : public Pass {
+class FindUsedTypes : public ModulePass {
std::set<const Type *> UsedTypes;
public:
/// getTypes - After the pass has been run, return the set containing all of
@@ -47,7 +47,7 @@ private:
public:
/// run - This incorporates all types used by the specified module
- bool run(Module &M);
+ bool runOnModule(Module &M);
/// getAnalysisUsage - We do not modify anything.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h
index fc7e6f48a5..102701fde2 100644
--- a/include/llvm/Assembly/PrintModulePass.h
+++ b/include/llvm/Assembly/PrintModulePass.h
@@ -24,7 +24,7 @@
namespace llvm {
-class PrintModulePass : public Pass {
+class PrintModulePass : public ModulePass {
std::ostream *Out; // ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
public:
@@ -37,7 +37,7 @@ public:
if (DeleteStream) delete Out;
}
- bool run(Module &M) {
+ bool runOnModule(Module &M) {
(*Out) << M << std::flush;
return false;
}
diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h
index b8863e6b47..5b6325d521 100644
--- a/include/llvm/Bytecode/WriteBytecodePass.h
+++ b/include/llvm/Bytecode/WriteBytecodePass.h
@@ -21,7 +21,7 @@
namespace llvm {
-class WriteBytecodePass : public Pass {
+class WriteBytecodePass : public ModulePass {
std::ostream *Out; // ostream to print on
bool DeleteStream;
public:
@@ -34,7 +34,7 @@ public:
if (DeleteStream) delete Out;
}
- bool run(Module &M) {
+ bool runOnModule(Module &M) {
WriteBytecodeToFile(&M, *Out);
return false;
}
diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h
index b7fba387ea..389a80c9e3 100644
--- a/include/llvm/CallGraphSCCPass.h
+++ b/include/llvm/CallGraphSCCPass.h
@@ -28,7 +28,7 @@ namespace llvm {
class CallGraphNode;
class CallGraph;
-struct CallGraphSCCPass : public Pass {
+struct CallGraphSCCPass : public ModulePass {
/// doInitialization - This method is called before the SCC's of the program
/// has been processed, allowing the pass to do initialization as necessary.
@@ -52,7 +52,7 @@ struct CallGraphSCCPass : public Pass {
/// run - Run this pass, returning true if a modification was made to the
/// module argument. This is implemented in terms of the runOnSCC method.
///
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
/// getAnalysisUsage - For this class, we declare that we require and preserve
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index 08496c5d2e..77f630c316 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -84,10 +84,10 @@ public:
///
const PassInfo *getPassInfo() const;
- /// run - Run this pass, returning true if a modification was made to the
+ /// runPass - Run this pass, returning true if a modification was made to the
/// module argument. This should be implemented by all concrete subclasses.
///
- virtual bool run(Module &M) = 0;
+ virtual bool runPass(Module &M) = 0;
/// print - Print out the internal state of the pass. This is called by
/// Analyze to print out the contents of an analysis. Otherwise it is not
@@ -200,13 +200,27 @@ private:
friend class PassManagerT<Module>;
friend class PassManagerT<Function>;
friend class PassManagerT<BasicBlock>;
- virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU);
};
inline std::ostream &operator<<(std::ostream &OS, const Pass &P) {
P.print(OS, 0); return OS;
}
+//===----------------------------------------------------------------------===//
+/// ModulePass class - This class is used to implement unstructured
+/// interprocedural optimizations and analyses. ModulePass's may do anything
+/// they want to the program.
+///
+struct ModulePass : public Pass {
+
+ /// runOnModule - Virtual method overriden by subclasses to process the module
+ /// being operated on.
+ virtual bool runOnModule(Module &M) = 0;
+
+ bool runPass(Module &M) { return runOnModule(M); }
+
+ virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU);
+};
//===----------------------------------------------------------------------===//
@@ -214,7 +228,7 @@ inline std::ostream &operator<<(std::ostream &OS, const Pass &P) {
/// not need to be run. This is useful for things like target information and
/// "basic" versions of AnalysisGroups.
///
-struct ImmutablePass : public Pass {
+struct ImmutablePass : public ModulePass {
/// initializePass - This method may be overriden by immutable passes to allow
/// them to perform various initialization actions they require. This is
/// primarily because an ImmutablePass can "require" another ImmutablePass,
@@ -225,14 +239,13 @@ struct ImmutablePass : public Pass {
/// ImmutablePasses are never run.
///
- virtual bool run(Module &M) { return false; }
+ virtual bool runOnModule(Module &M) { return false; }
private:
friend class PassManagerT<Module>;
virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU);
};
-
//===----------------------------------------------------------------------===//
/// FunctionPass class - This class is used to implement most global
/// optimizations. Optimizations should subclass this class if they meet the
@@ -242,7 +255,7 @@ private:
/// 2. Optimizing a function does not cause the addition or removal of any
/// functions in the module
///
-struct FunctionPass : public Pass {
+struct FunctionPass : public ModulePass {
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
@@ -258,10 +271,11 @@ struct FunctionPass : public Pass {
///
virtual bool doFinalization(Module &M) { return false; }
- /// run - On a module, we run this pass by initializing, ronOnFunction'ing
- /// once for every function in the module, then by finalizing.
+ /// runOnModule - On a module, we run this pass by initializing,
+ /// ronOnFunction'ing once for every function in the module, then by
+ /// finalizing.
///
- virtual bool run(Module &M);
+ virtual bool runOnModule(Module &M);
/// run - On a function, we simply initialize, run the function, then
/// finalize.
@@ -323,7 +337,7 @@ struct BasicBlockPass : public FunctionPass {
/// To run directly on the basic block, we initialize, runOnBasicBlock, then
/// finalize.
///
- bool run(BasicBlock &BB);
+ bool runPass(BasicBlock &BB);
private:
friend class PassManagerT<Function>;
diff --git a/include/llvm/PassManager.h b/include/llvm/PassManager.h
index b1d369b925..1b77c875d9 100644
--- a/include/llvm/PassManager.h
+++ b/include/llvm/PassManager.h
@@ -20,6 +20,7 @@
namespace llvm {
class Pass;
+class ModulePass;
class Module;
class ModuleProvider;
template<class UnitType> class PassManagerT;