diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index 4ae039d7539..07e736da691 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -292,13 +292,19 @@ function.

initialization value is not important.

-  RegisterPass<Hello> X("hello", "Hello World Pass");
+  RegisterPass<Hello> X("hello", "Hello World Pass",
+                        false /* Only looks at CFG */,
+                        false /* Analysis Pass */);
 }  // end of anonymous namespace
 

Lastly, we register our class Hello, giving it a command line -argument "hello", and a name "Hello World Pass".

+argument "hello", and a name "Hello World Pass". +Last two RegisterPass arguments are optional. Their default value is false. +If a pass walks CFG without modifying it then third argument is set to true. +If a pass is an analysis pass, for example dominator tree pass, then true +is supplied as fourth argument.

As a whole, the .cpp file looks like:

diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 1b7fa75e6a2..ce305d5875e 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -664,7 +664,7 @@ public: static char ID; // Pass ID, replacement for typeid DominatorTreeBase* DT; - DominatorTree() : FunctionPass(intptr_t(&ID), true) { + DominatorTree() : FunctionPass(intptr_t(&ID)) { DT = new DominatorTreeBase(false); } @@ -837,7 +837,7 @@ protected: public: DominanceFrontierBase(intptr_t ID, bool isPostDom) - : FunctionPass(ID, true), IsPostDominators(isPostDom) {} + : FunctionPass(ID), IsPostDominators(isPostDom) {} /// getRoots - Return the root blocks of the current CFG. This may include /// multiple blocks if we are computing post dominators. For forward diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 6a128c80886..b0d38c509c1 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -25,7 +25,7 @@ class FindUsedTypes : public ModulePass { std::set UsedTypes; public: static char ID; // Pass identification, replacement for typeid - FindUsedTypes() : ModulePass((intptr_t)&ID, true) {} + FindUsedTypes() : ModulePass((intptr_t)&ID) {} /// getTypes - After the pass has been run, return the set containing all of /// the types used in the module. diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 42d27feaec4..8b85e7c08b1 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -47,7 +47,7 @@ class IntervalPartition : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - IntervalPartition() : FunctionPass((intptr_t)&ID, true), RootInterval(0) {} + IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {} // run - Calculate the interval partition for this function virtual bool runOnFunction(Function &F); diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index cc2b10eb53f..ab7cb7e03e5 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -879,7 +879,7 @@ class LoopInfo : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - LoopInfo() : FunctionPass(intptr_t(&ID), true) { + LoopInfo() : FunctionPass(intptr_t(&ID)) { LI = new LoopInfoBase(); } @@ -919,6 +919,9 @@ public: return LI->isLoopHeader(BB); } + /// isAnalysis - Return true if this pass is implementing an analysis pass. + bool isAnalysis() const { return true; } + /// runOnFunction - Calculate the natural loop information. /// virtual bool runOnFunction(Function &F); diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 8ebbbafb585..c0cdce2f1a5 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -29,7 +29,7 @@ class PMStack; class LoopPass : public Pass { public: - explicit LoopPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit LoopPass(intptr_t pid) : Pass(pid) {} // runOnLoop - This method should be implemented by the subclass to perform // whatever action is necessary for the specfied Loop. diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h index c683a6b74b8..c6ef41ff240 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -66,7 +66,7 @@ class MemoryDependenceAnalysis : public FunctionPass { static Instruction* const Dirty; static char ID; // Class identification, replacement for typeinfo - MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID, true) {} + MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID) {} /// Pass Implementation stuff. This doesn't do any analysis. /// diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index f20f050a9b3..07910e9538c 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -25,7 +25,7 @@ struct PostDominatorTree : public FunctionPass { static char ID; // Pass identification, replacement for typeid DominatorTreeBase* DT; - PostDominatorTree() : FunctionPass((intptr_t)&ID, true) { + PostDominatorTree() : FunctionPass((intptr_t)&ID) { DT = new DominatorTreeBase(true); } diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 5894d8c3f33..4d9d5e5fc04 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -192,7 +192,7 @@ namespace llvm { void *Impl; // ScalarEvolution uses the pimpl pattern public: static char ID; // Pass identification, replacement for typeid - ScalarEvolution() : FunctionPass((intptr_t)&ID, true), Impl(0) {} + ScalarEvolution() : FunctionPass((intptr_t)&ID), Impl(0) {} /// getSCEV - Return a SCEV expression handle for the full generality of the /// specified expression. diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index f2190e67211..26005059dee 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -31,7 +31,7 @@ class PMStack; struct CallGraphSCCPass : public Pass { - explicit CallGraphSCCPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit CallGraphSCCPass(intptr_t pid) : Pass(pid) {} /// doInitialization - This method is called before the SCC's of the program /// has been processed, allowing the pass to do initialization as necessary. diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 07355da2d18..a0ffcde4da1 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -73,7 +73,6 @@ enum PassManagerType { class Pass { AnalysisResolver *Resolver; // Used to resolve analysis intptr_t PassID; - bool isAnalysisPass; // True if this pass is an analysis pass. // AnalysisImpls - This keeps track of which passes implement the interfaces // that are required by the current pass (to implement getAnalysis()). // @@ -82,14 +81,11 @@ class Pass { void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(intptr_t pid, bool AP = false) : Resolver(0), PassID(pid), - isAnalysisPass(AP) {} - explicit Pass(const void *pid, bool AP = false) : Resolver(0), - PassID((intptr_t)pid), - isAnalysisPass(AP) {} + explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {} + explicit Pass(const void *pid) : Resolver(0), + PassID((intptr_t)pid) {} virtual ~Pass(); - bool isAnalysis() const { return isAnalysisPass; } /// getPassName - Return a nice clean name for a pass. This usually /// implemented in terms of the name that is registered by one of the /// Registration templates, but can be overloaded directly. @@ -231,8 +227,8 @@ public: return PMT_ModulePassManager; } - explicit ModulePass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} - explicit ModulePass(const void *pid, bool AP = false) : Pass(pid, AP) {} + explicit ModulePass(intptr_t pid) : Pass(pid) {} + explicit ModulePass(const void *pid) : Pass(pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -257,9 +253,9 @@ public: /// bool runOnModule(Module &M) { return false; } - explicit ImmutablePass(intptr_t pid, bool AP = false) : ModulePass(pid, AP) {} - explicit ImmutablePass(const void *pid, bool AP = false) - : ModulePass(pid, AP) {} + explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {} + explicit ImmutablePass(const void *pid) + : ModulePass(pid) {} // Force out-of-line virtual method. virtual ~ImmutablePass(); @@ -276,8 +272,8 @@ public: /// class FunctionPass : public Pass { public: - explicit FunctionPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} - explicit FunctionPass(const void *pid, bool AP = false) : Pass(pid, AP) {} + explicit FunctionPass(intptr_t pid) : Pass(pid) {} + explicit FunctionPass(const void *pid) : Pass(pid) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. @@ -328,8 +324,8 @@ public: /// class BasicBlockPass : public Pass { public: - explicit BasicBlockPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} - explicit BasicBlockPass(const void *pid, bool AP = false) : Pass(pid, AP) {} + explicit BasicBlockPass(intptr_t pid) : Pass(pid) {} + explicit BasicBlockPass(const void *pid) : Pass(pid) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 1ddc2df53da..68fd901048f 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -39,6 +39,7 @@ class PassInfo { const char *PassArgument; // Command Line argument to run this pass intptr_t PassID; bool IsCFGOnlyPass; // Pass only looks at the CFG. + bool IsAnalysis; // True if an analysis pass. bool IsAnalysisGroup; // True if an analysis group. std::vector ItfImpl;// Interfaces implemented by this pass @@ -48,9 +49,10 @@ public: /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. PassInfo(const char *name, const char *arg, intptr_t pi, - Pass *(*normal)() = 0, bool isCFGOnly = false) + Pass *(*normal)() = 0, bool isCFGOnly = false, bool isAnalysis = false) : PassName(name), PassArgument(arg), PassID(pi), - IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) { + IsCFGOnlyPass(isCFGOnly), + IsAnalysis(isAnalysis), IsAnalysisGroup(false), NormalCtor(normal) { } /// getPassName - Return the friendly name for the pass, never returns null @@ -72,6 +74,7 @@ public: /// pass. /// bool isAnalysisGroup() const { return IsAnalysisGroup; } + bool isAnalysis() const { return IsAnalysis; } void SetIsAnalysisGroup() { IsAnalysisGroup = true; } /// isCFGOnlyPass - return true if this pass only looks at the CFG for the @@ -140,8 +143,9 @@ struct RegisterPassBase { typedef Pass* (*NormalCtor_t)(); RegisterPassBase(const char *Name, const char *Arg, intptr_t TI, - NormalCtor_t NormalCtor = 0, bool CFGOnly = false) - : PIObj(Name, Arg, TI, NormalCtor, CFGOnly) { + NormalCtor_t NormalCtor = 0, bool CFGOnly = false, + bool IsAnalysis = false) + : PIObj(Name, Arg, TI, NormalCtor, CFGOnly, IsAnalysis) { registerPass(); } explicit RegisterPassBase(intptr_t TI) @@ -164,9 +168,11 @@ template struct RegisterPass : public RegisterPassBase { // Register Pass using default constructor... - RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false) + RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false, + bool IsAnalysis = false) : RegisterPassBase(Name, PassArg, intptr_t(&PassName::ID), - RegisterPassBase::NormalCtor_t(callDefaultCtor), CFGOnly) { + RegisterPassBase::NormalCtor_t(callDefaultCtor), + CFGOnly, IsAnalysis) { } }; diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index df3a66c6606..3f8f1fc56ba 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -35,7 +35,7 @@ namespace { Module *M; public: static char ID; // Class identification, replacement for typeinfo - AliasAnalysisCounter() : ModulePass((intptr_t) &ID, true) { + AliasAnalysisCounter() : ModulePass((intptr_t) &ID) { No = May = Must = 0; NoMR = JustRef = JustMod = MR = 0; } @@ -116,7 +116,7 @@ namespace { char AliasAnalysisCounter::ID = 0; RegisterPass - X("count-aa", "Count Alias Analysis Query Responses"); + X("count-aa", "Count Alias Analysis Query Responses", true, true); RegisterAnalysisGroup Y(X); } diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index 648760a2b73..868de34c1f6 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -52,7 +52,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid - AAEval() : FunctionPass((intptr_t)&ID, true) {} + AAEval() : FunctionPass((intptr_t)&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); @@ -76,7 +76,7 @@ namespace { char AAEval::ID = 0; RegisterPass - X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator"); + X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator", true, true); } FunctionPass *llvm::createAAEvalPass() { return new AAEval(); } diff --git a/lib/Analysis/AliasDebugger.cpp b/lib/Analysis/AliasDebugger.cpp index 76dfe073375..7f4e418c27d 100644 --- a/lib/Analysis/AliasDebugger.cpp +++ b/lib/Analysis/AliasDebugger.cpp @@ -41,7 +41,7 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo - AliasDebugger() : ModulePass((intptr_t)&ID, true) {} + AliasDebugger() : ModulePass((intptr_t)&ID) {} bool runOnModule(Module &M) { InitializeAliasAnalysis(this); // set up super class @@ -123,7 +123,7 @@ namespace { }; char AliasDebugger::ID = 0; - RegisterPass X("debug-aa", "AA use debugger"); + RegisterPass X("debug-aa", "AA use debugger", true, true); RegisterAnalysisGroup Y(X); } diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index a6f9227fd1c..5a3e126cf8d 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -551,7 +551,7 @@ namespace { AliasSetTracker *Tracker; public: static char ID; // Pass identification, replacement for typeid - AliasSetPrinter() : FunctionPass((intptr_t)&ID, true) {} + AliasSetPrinter() : FunctionPass((intptr_t)&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -569,5 +569,5 @@ namespace { } }; char AliasSetPrinter::ID = 0; - RegisterPass X("print-alias-sets", "Alias Set Printer"); + RegisterPass X("print-alias-sets", "Alias Set Printer", true, true); } diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 866c8100abb..eab3ec332ee 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -83,7 +83,7 @@ namespace { // Register this pass... char NoAA::ID = 0; RegisterPass - U("no-aa", "No Alias Analysis (always returns 'may' alias)"); + U("no-aa", "No Alias Analysis (always returns 'may' alias)", true, true); // Declare that we implement the AliasAnalysis interface RegisterAnalysisGroup V(U); @@ -128,7 +128,7 @@ namespace { // Register this pass... char BasicAliasAnalysis::ID = 0; RegisterPass - X("basicaa", "Basic Alias Analysis (default AA impl)"); + X("basicaa", "Basic Alias Analysis (default AA impl)", true, true); // Declare that we implement the AliasAnalysis interface RegisterAnalysisGroup Y(X); diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index b4840dc3f14..b3253777fc3 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -92,7 +92,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { namespace { struct VISIBILITY_HIDDEN CFGViewer : public FunctionPass { static char ID; // Pass identifcation, replacement for typeid - CFGViewer() : FunctionPass((intptr_t)&ID, true) {} + CFGViewer() : FunctionPass((intptr_t)&ID) {} virtual bool runOnFunction(Function &F) { F.viewCFG(); @@ -108,11 +108,11 @@ namespace { char CFGViewer::ID = 0; RegisterPass V0("view-cfg", - "View CFG of function"); + "View CFG of function", true, true); struct VISIBILITY_HIDDEN CFGOnlyViewer : public FunctionPass { static char ID; // Pass identifcation, replacement for typeid - CFGOnlyViewer() : FunctionPass((intptr_t)&ID, true) {} + CFGOnlyViewer() : FunctionPass((intptr_t)&ID) {} virtual bool runOnFunction(Function &F) { CFGOnly = true; @@ -130,12 +130,12 @@ namespace { char CFGOnlyViewer::ID = 0; RegisterPass V1("view-cfg-only", - "View CFG of function (with no function bodies)"); + "View CFG of function (with no function bodies)", true, true); struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass { static char ID; // Pass identification, replacement for typeid CFGPrinter() : FunctionPass((intptr_t)&ID) {} - explicit CFGPrinter(intptr_t pid) : FunctionPass(pid, true) {} + explicit CFGPrinter(intptr_t pid) : FunctionPass(pid) {} virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getName() + ".dot"; @@ -159,7 +159,7 @@ namespace { char CFGPrinter::ID = 0; RegisterPass P1("print-cfg", - "Print CFG of function to 'dot' file"); + "Print CFG of function to 'dot' file", true, true); struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter { static char ID; // Pass identification, replacement for typeid @@ -181,7 +181,7 @@ namespace { char CFGOnlyPrinter::ID = 0; RegisterPass P2("print-cfg-only", - "Print CFG of function to 'dot' file (with no function bodies)"); + "Print CFG of function to 'dot' file (with no function bodies)", true, true); } /// viewCFG - This function is meant for use from the debugger. You can just diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index d77997bb397..b34b50ed645 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -430,7 +430,7 @@ namespace { public: static char ID; - Andersens() : ModulePass((intptr_t)&ID, true) {} + Andersens() : ModulePass((intptr_t)&ID) {} bool runOnModule(Module &M) { InitializeAliasAnalysis(this); @@ -602,7 +602,8 @@ namespace { char Andersens::ID = 0; RegisterPass X("anders-aa", - "Andersen's Interprocedural Alias Analysis"); + "Andersen's Interprocedural Alias Analysis", true, + true); RegisterAnalysisGroup Y(X); // Initialize Timestamp Counter (static). diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index cb24df6c359..5c5418ba250 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -191,7 +191,7 @@ private: }; RegisterAnalysisGroup X("Call Graph"); -RegisterPass Y("basiccg", "Basic CallGraph Construction"); +RegisterPass Y("basiccg", "Basic CallGraph Construction", false, true); RegisterAnalysisGroup Z(Y); } //End anonymous namespace diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp index 34c126f5d45..4d44e5384d1 100644 --- a/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/lib/Analysis/IPA/FindUsedTypes.cpp @@ -23,7 +23,7 @@ using namespace llvm; char FindUsedTypes::ID = 0; static RegisterPass -X("printusedtypes", "Find Used Types"); +X("printusedtypes", "Find Used Types", true, true); // IncorporateType - Incorporate one type and all of its subtypes into the // collection of used types. diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index a08db7bf420..17fce9d62ad 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -84,7 +84,7 @@ namespace { public: static char ID; - GlobalsModRef() : ModulePass((intptr_t)&ID, true) {} + GlobalsModRef() : ModulePass((intptr_t)&ID) {} bool runOnModule(Module &M) { InitializeAliasAnalysis(this); // set up super class @@ -149,7 +149,8 @@ namespace { char GlobalsModRef::ID = 0; RegisterPass X("globalsmodref-aa", - "Simple mod/ref analysis for globals"); + "Simple mod/ref analysis for globals", true, + true); RegisterAnalysisGroup Y(X); } diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index 2eae5c369ab..2e0e8c6fcc9 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -52,7 +52,7 @@ namespace { } public: static char ID; // Pass identification, replacement for typeid - InstCount() : FunctionPass((intptr_t)&ID, true) {} + InstCount() : FunctionPass((intptr_t)&ID) {} virtual bool runOnFunction(Function &F); @@ -65,7 +65,7 @@ namespace { char InstCount::ID = 0; RegisterPass X("instcount", - "Counts the various types of Instructions"); + "Counts the various types of Instructions", true, true); } FunctionPass *llvm::createInstCountPass() { return new InstCount(); } diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp index e73b40b63ed..a430cffc358 100644 --- a/lib/Analysis/IntervalPartition.cpp +++ b/lib/Analysis/IntervalPartition.cpp @@ -17,7 +17,7 @@ using namespace llvm; char IntervalPartition::ID = 0; static RegisterPass -X("intervals", "Interval Partition Construction", true); +X("intervals", "Interval Partition Construction", true, true); //===----------------------------------------------------------------------===// // IntervalPartition Implementation diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp index 6b8775bb1a8..f9bf7ba57f7 100644 --- a/lib/Analysis/LoadValueNumbering.cpp +++ b/lib/Analysis/LoadValueNumbering.cpp @@ -41,7 +41,7 @@ namespace { // FIXME: This should not be a FunctionPass. struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering { static char ID; // Class identification, replacement for typeinfo - LoadVN() : FunctionPass((intptr_t)&ID, true) {} + LoadVN() : FunctionPass((intptr_t)&ID) {} /// Pass Implementation stuff. This doesn't do any analysis. /// @@ -85,7 +85,7 @@ namespace { char LoadVN::ID = 0; // Register this pass... - RegisterPass X("load-vn", "Load Value Numbering"); + RegisterPass X("load-vn", "Load Value Numbering", true, true); // Declare that we implement the ValueNumbering interface RegisterAnalysisGroup Y(X); diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index e136f2930f6..e067c1768fe 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -29,7 +29,7 @@ using namespace llvm; char LoopInfo::ID = 0; static RegisterPass -X("loops", "Natural Loop Construction", true); +X("loops", "Natural Loop Construction", true, true); //===----------------------------------------------------------------------===// // Loop implementation diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 22c454fae15..80f7fe831c9 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -48,7 +48,7 @@ Instruction* const MemoryDependenceAnalysis::Dirty = (Instruction*)-5; // Register this pass... static RegisterPass X("memdep", - "Memory Dependence Analysis"); + "Memory Dependence Analysis", true, true); void MemoryDependenceAnalysis::ping(Instruction *D) { for (depMapType::iterator I = depGraphLocal.begin(), E = depGraphLocal.end(); diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index f72d971c9e7..8bfa0692b9a 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -26,7 +26,7 @@ using namespace llvm; char PostDominatorTree::ID = 0; char PostDominanceFrontier::ID = 0; static RegisterPass -F("postdomtree", "Post-Dominator Tree Construction", true); +F("postdomtree", "Post-Dominator Tree Construction", true, true); bool PostDominatorTree::runOnFunction(Function &F) { DT->recalculate(F); @@ -38,7 +38,7 @@ bool PostDominatorTree::runOnFunction(Function &F) { //===----------------------------------------------------------------------===// static RegisterPass -H("postdomfrontier", "Post-Dominance Frontier Construction", true); +H("postdomfrontier", "Post-Dominance Frontier Construction", true, true); const DominanceFrontier::DomSetType & PostDominanceFrontier::calculate(const PostDominatorTree &DT, diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp index 9e90c943581..e5b557ec887 100644 --- a/lib/Analysis/ProfileInfo.cpp +++ b/lib/Analysis/ProfileInfo.cpp @@ -93,7 +93,7 @@ namespace { char NoProfileInfo::ID = 0; // Register this pass... RegisterPass - X("no-profile", "No Profile Information"); + X("no-profile", "No Profile Information", true, true); // Declare that we implement the ProfileInfo interface RegisterAnalysisGroup Y(X); diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index 12b18f736c2..9efb312d78f 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -34,7 +34,7 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo explicit LoaderPass(const std::string &filename = "") - : ModulePass((intptr_t)&ID, true), Filename(filename) { + : ModulePass((intptr_t)&ID), Filename(filename) { if (filename.empty()) Filename = ProfileInfoFilename; } @@ -52,7 +52,7 @@ namespace { char LoaderPass::ID = 0; RegisterPass - X("profile-loader", "Load profile information from llvmprof.out"); + X("profile-loader", "Load profile information from llvmprof.out", true, true); RegisterAnalysisGroup Y(X); } // End of anonymous namespace diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 0db02d98c20..6c51abd1471 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -103,7 +103,7 @@ MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden, namespace { RegisterPass - R("scalar-evolution", "Scalar Evolution Analysis"); + R("scalar-evolution", "Scalar Evolution Analysis", true, true); } char ScalarEvolution::ID = 0; diff --git a/lib/Analysis/ValueNumbering.cpp b/lib/Analysis/ValueNumbering.cpp index 743d811c755..b9964153801 100644 --- a/lib/Analysis/ValueNumbering.cpp +++ b/lib/Analysis/ValueNumbering.cpp @@ -68,7 +68,7 @@ namespace { char BasicVN::ID = 0; // Register this pass... RegisterPass - X("basicvn", "Basic Value Numbering (default GVN impl)"); + X("basicvn", "Basic Value Numbering (default GVN impl)", true, true); // Declare that we implement the ValueNumbering interface RegisterAnalysisGroup Y(X); diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 64332a0df56..0a98fb790d6 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -33,7 +33,8 @@ using namespace llvm; // Handle the Pass registration stuff necessary to use TargetData's. namespace { // Register the default SparcV9 implementation... - RegisterPass X("targetdata", "Target Data Layout"); + RegisterPass X("targetdata", "Target Data Layout", false, + true); } char TargetData::ID = 0; diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index ceb1df8c638..28f772f93f6 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -54,7 +54,7 @@ TEMPLATE_INSTANTIATION(class DominatorTreeBase); char DominatorTree::ID = 0; static RegisterPass -E("domtree", "Dominator Tree Construction", true); +E("domtree", "Dominator Tree Construction", true, true); bool DominatorTree::runOnFunction(Function &F) { DT->recalculate(F); @@ -68,7 +68,7 @@ bool DominatorTree::runOnFunction(Function &F) { char DominanceFrontier::ID = 0; static RegisterPass -G("domfrontier", "Dominance Frontier Construction", true); +G("domfrontier", "Dominance Frontier Construction", true, true); // NewBB is split and now it has one successor. Update dominace frontier to // reflect this change. diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 7db6aa2643d..6c8d0624e68 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -426,11 +426,14 @@ void PMTopLevelManager::schedulePass(Pass *P) { // Give pass a chance to prepare the stage. P->preparePassManager(activeStack); +#if 1 // If P is an analysis pass and it is available then do not // generate the analysis again. Stale analysis info should not be // available at this point. - if (P->isAnalysis() && findAnalysisPass(P->getPassInfo())) + if (P->getPassInfo() && + P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) return; +#endif AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage);