[llvm-commits] [llvm] r169164 - in /llvm/trunk: include/llvm/Analysis/LoopPass.h include/llvm/Analysis/RegionPass.h include/llvm/CallGraphSCCPass.h include/llvm/CodeGen/MachineModuleInfo.h include/llvm/Pass.h lib/CodeGen/MachineModuleInfo.cpp lib/VMCore/Pass.cpp lib/VMCore/PassManager.cpp
Pedro Artigas
partigas at apple.com
Mon Dec 3 13:56:57 PST 2012
Author: partigas
Date: Mon Dec 3 15:56:57 2012
New Revision: 169164
URL: http://llvm.org/viewvc/llvm-project?rev=169164&view=rev
Log:
moves doInitialization and doFinalization to the Pass class and removes some unreachable code in MachineModuleInfo
reviewed by Evan Cheng <evan.cheng at apple.com>
Modified:
llvm/trunk/include/llvm/Analysis/LoopPass.h
llvm/trunk/include/llvm/Analysis/RegionPass.h
llvm/trunk/include/llvm/CallGraphSCCPass.h
llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
llvm/trunk/include/llvm/Pass.h
llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
llvm/trunk/lib/VMCore/Pass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopPass.h?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopPass.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopPass.h Mon Dec 3 15:56:57 2012
@@ -39,6 +39,9 @@
// 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;
Modified: llvm/trunk/include/llvm/Analysis/RegionPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/RegionPass.h?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/RegionPass.h (original)
+++ llvm/trunk/include/llvm/Analysis/RegionPass.h Mon Dec 3 15:56:57 2012
@@ -57,6 +57,9 @@
/// @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; }
//@}
Modified: llvm/trunk/include/llvm/CallGraphSCCPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CallGraphSCCPass.h?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CallGraphSCCPass.h (original)
+++ llvm/trunk/include/llvm/CallGraphSCCPass.h Mon Dec 3 15:56:57 2012
@@ -39,6 +39,9 @@
/// 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) {
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Mon Dec 3 15:56:57 2012
@@ -180,12 +180,6 @@
const MCObjectFileInfo *MOFI);
~MachineModuleInfo();
- using ModulePass::doInitialization;
- bool doInitialization();
-
- using ModulePass::doFinalization;
- bool doFinalization();
-
/// EndFunction - Discard function meta information.
///
void EndFunction();
Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Mon Dec 3 15:56:57 2012
@@ -104,6 +104,16 @@
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 @@
/// 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 @@
/// 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 @@
/// 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 @@
///
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);
Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Dec 3 15:56:57 2012
@@ -281,21 +281,6 @@
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() {
Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Mon Dec 3 15:56:57 2012
@@ -133,16 +133,6 @@
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 @@
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 @@
return false;
}
-bool BasicBlockPass::doFinalization(Module &) {
- // By default, don't do anything.
- return false;
-}
-
PassManagerType BasicBlockPass::getPotentialPassManagerType() const {
return PMT_BasicBlockPassManager;
}
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=169164&r1=169163&r2=169164&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Dec 3 15:56:57 2012
@@ -309,6 +309,9 @@
/// 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 @@
/// 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();
More information about the llvm-commits
mailing list