diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index c9770a7e45c..4c16daffc0a 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -39,6 +39,9 @@ public: // whatever action is necessary for the specified Loop. virtual bool runOnLoop(Loop *L, LPPassManager &LPM) = 0; + using llvm::Pass::doInitialization; + using llvm::Pass::doFinalization; + // Initialization and finalization hooks. virtual bool doInitialization(Loop *L, LPPassManager &LPM) { return false; diff --git a/include/llvm/Analysis/RegionPass.h b/include/llvm/Analysis/RegionPass.h index 6ed12e5db52..7d450887f0d 100644 --- a/include/llvm/Analysis/RegionPass.h +++ b/include/llvm/Analysis/RegionPass.h @@ -57,6 +57,9 @@ public: /// @return The pass to print the LLVM IR in the region. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; + using llvm::Pass::doInitialization; + using llvm::Pass::doFinalization; + virtual bool doInitialization(Region *R, RGPassManager &RGM) { return false; } virtual bool doFinalization() { return false; } //@} diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index 8958ad2fc1e..4446777669a 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -39,6 +39,9 @@ public: /// corresponding to a CallGraph. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; + using llvm::Pass::doInitialization; + using llvm::Pass::doFinalization; + /// doInitialization - This method is called before the SCC's of the program /// has been processed, allowing the pass to do initialization as necessary. virtual bool doInitialization(CallGraph &CG) { diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 545638e7057..2d8c26def82 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -180,12 +180,6 @@ public: const MCObjectFileInfo *MOFI); ~MachineModuleInfo(); - using ModulePass::doInitialization; - bool doInitialization(); - - using ModulePass::doFinalization; - bool doFinalization(); - /// EndFunction - Discard function meta information. /// void EndFunction(); diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index e92e31b1e9c..35ec022516a 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -104,6 +104,16 @@ public: return PassID; } + /// doInitialization - Virtual method overridden by subclasses to do + /// any necessary initialization before any pass is run. + /// + virtual bool doInitialization(Module &) { return false; } + + /// doFinalization - Virtual method overriden by subclasses to do any + /// necessary clean up after all passes have run. + /// + virtual bool doFinalization(Module &) { return false; } + /// 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 /// necessary to implement this method. Beware that the module pointer MAY be @@ -227,20 +237,10 @@ public: /// createPrinterPass - Get a module printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; - /// doInitialization - Virtual method overridden by subclasses to do - /// any necessary initialization before any pass is run. - /// - virtual bool doInitialization(Module &) { return false; } - /// runOnModule - Virtual method overriden by subclasses to process the module /// being operated on. virtual bool runOnModule(Module &M) = 0; - /// doFinalization - Virtual method overriden by subclasses to do any - /// necessary clean up after all passes have run. - /// - virtual bool doFinalization(Module &) { return false; } - virtual void assignPassManager(PMStack &PMS, PassManagerType T); @@ -297,21 +297,11 @@ public: /// createPrinterPass - Get a function printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; - /// doInitialization - Virtual method overridden by subclasses to do - /// any necessary per-module initialization. - /// - virtual bool doInitialization(Module &); - /// runOnFunction - Virtual method overriden by subclasses to do the /// per-function processing of the pass. /// virtual bool runOnFunction(Function &F) = 0; - /// doFinalization - Virtual method overriden by subclasses to do any post - /// processing needed after all passes have run. - /// - virtual bool doFinalization(Module &); - virtual void assignPassManager(PMStack &PMS, PassManagerType T); @@ -338,10 +328,8 @@ public: /// createPrinterPass - Get a basic block printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; - /// doInitialization - Virtual method overridden by subclasses to do - /// any necessary per-module initialization. - /// - virtual bool doInitialization(Module &); + using llvm::Pass::doInitialization; + using llvm::Pass::doFinalization; /// doInitialization - Virtual method overridden by BasicBlockPass subclasses /// to do any necessary per-function initialization. @@ -358,11 +346,6 @@ public: /// virtual bool doFinalization(Function &); - /// doFinalization - Virtual method overriden by subclasses to do any post - /// processing needed after all passes have run. - /// - virtual bool doFinalization(Module &); - virtual void assignPassManager(PMStack &PMS, PassManagerType T); diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index ddfd11b8e53..7cd8f61c45c 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -281,21 +281,6 @@ MachineModuleInfo::~MachineModuleInfo() { AddrLabelSymbols = 0; } -/// doInitialization - Initialize the state for a new module. -/// -bool MachineModuleInfo::doInitialization() { - assert(AddrLabelSymbols == 0 && "Improperly initialized"); - return false; -} - -/// doFinalization - Tear down the state after completion of a module. -/// -bool MachineModuleInfo::doFinalization() { - delete AddrLabelSymbols; - AddrLabelSymbols = 0; - return false; -} - /// EndFunction - Discard function meta information. /// void MachineModuleInfo::EndFunction() { diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 9d0ed488425..ec448e6420d 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -133,16 +133,6 @@ Pass *FunctionPass::createPrinterPass(raw_ostream &O, return createPrintFunctionPass(Banner, &O); } -bool FunctionPass::doInitialization(Module &) { - // By default, don't do anything. - return false; -} - -bool FunctionPass::doFinalization(Module &) { - // By default, don't do anything. - return false; -} - PassManagerType FunctionPass::getPotentialPassManagerType() const { return PMT_FunctionPassManager; } @@ -157,11 +147,6 @@ Pass *BasicBlockPass::createPrinterPass(raw_ostream &O, llvm_unreachable("BasicBlockPass printing unsupported."); } -bool BasicBlockPass::doInitialization(Module &) { - // By default, don't do anything. - return false; -} - bool BasicBlockPass::doInitialization(Function &) { // By default, don't do anything. return false; @@ -172,11 +157,6 @@ bool BasicBlockPass::doFinalization(Function &) { return false; } -bool BasicBlockPass::doFinalization(Module &) { - // By default, don't do anything. - return false; -} - PassManagerType BasicBlockPass::getPotentialPassManagerType() const { return PMT_BasicBlockPassManager; } diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 069bd356ad7..875ab5cad7d 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -309,6 +309,9 @@ public: /// whether any of the passes modifies the module, and if so, return true. bool runOnModule(Module &M); + using llvm::Pass::doInitialization; + using llvm::Pass::doFinalization; + /// doInitialization - Run all of the initializers for the module passes. /// bool doInitialization(); @@ -402,6 +405,9 @@ public: /// whether any of the passes modifies the module, and if so, return true. bool run(Module &M); + using llvm::Pass::doInitialization; + using llvm::Pass::doFinalization; + /// doInitialization - Run all of the initializers for the module passes. /// bool doInitialization();