summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-09-20 04:48:05 +0000
committerChris Lattner <sabre@nondot.org>2004-09-20 04:48:05 +0000
commitb12914bfc0f76a7a48357162d5f4c39a1343e69b (patch)
tree00bff0412482165a6d7d60775e4aeb6ebe3b4628 /lib/Transforms/IPO
parentbba61c07ddca19f72b13dd5a410358d296ed1d6a (diff)
downloadllvm-b12914bfc0f76a7a48357162d5f4c39a1343e69b.tar.gz
llvm-b12914bfc0f76a7a48357162d5f4c39a1343e69b.tar.bz2
llvm-b12914bfc0f76a7a48357162d5f4c39a1343e69b.tar.xz
'Pass' should now not be derived from by clients. Instead, they should derive
from ModulePass. Instead of implementing Pass::run, then should implement ModulePass::runOnModule. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16436 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp2
-rw-r--r--lib/Transforms/IPO/ConstantMerge.cpp8
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp10
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp8
-rw-r--r--lib/Transforms/IPO/ExtractFunction.cpp6
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp8
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp8
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp8
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp8
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp2
-rw-r--r--lib/Transforms/IPO/Internalize.cpp6
-rw-r--r--lib/Transforms/IPO/LoopExtractor.cpp10
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp16
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp2
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp8
15 files changed, 53 insertions, 57 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 7b5def4284..85339bf9a7 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -75,7 +75,7 @@ namespace {
"Promote 'by reference' arguments to scalars");
}
-Pass *llvm::createArgumentPromotionPass() {
+ModulePass *llvm::createArgumentPromotionPass() {
return new ArgPromotion();
}
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index 9f3c10959c..27e1955ab2 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -26,19 +26,19 @@ using namespace llvm;
namespace {
Statistic<> NumMerged("constmerge", "Number of global constants merged");
- struct ConstantMerge : public Pass {
+ struct ConstantMerge : public ModulePass {
// run - For this pass, process all of the globals in the module,
// eliminating duplicate constants.
//
- bool run(Module &M);
+ bool runOnModule(Module &M);
};
RegisterOpt<ConstantMerge> X("constmerge","Merge Duplicate Global Constants");
}
-Pass *llvm::createConstantMergePass() { return new ConstantMerge(); }
+ModulePass *llvm::createConstantMergePass() { return new ConstantMerge(); }
-bool ConstantMerge::run(Module &M) {
+bool ConstantMerge::runOnModule(Module &M) {
std::map<Constant*, GlobalVariable*> CMap;
// Replacements - This vector contains a list of replacements to perform.
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index cde186c38d..e4b7a3ee61 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -38,7 +38,7 @@ namespace {
/// DAE - The dead argument elimination pass.
///
- class DAE : public Pass {
+ class DAE : public ModulePass {
/// Liveness enum - During our initial pass over the program, we determine
/// that things are either definately alive, definately dead, or in need of
/// interprocedural analysis (MaybeLive).
@@ -75,7 +75,7 @@ namespace {
std::multimap<Function*, CallSite> CallSites;
public:
- bool run(Module &M);
+ bool runOnModule(Module &M);
virtual bool ShouldHackArguments() const { return false; }
@@ -106,8 +106,8 @@ namespace {
/// createDeadArgEliminationPass - This pass removes arguments from functions
/// which are not used by the body of the function.
///
-Pass *llvm::createDeadArgEliminationPass() { return new DAE(); }
-Pass *llvm::createDeadArgHackingPass() { return new DAH(); }
+ModulePass *llvm::createDeadArgEliminationPass() { return new DAE(); }
+ModulePass *llvm::createDeadArgHackingPass() { return new DAH(); }
static inline bool CallPassesValueThoughVararg(Instruction *Call,
const Value *Arg) {
@@ -484,7 +484,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
F->getParent()->getFunctionList().erase(F);
}
-bool DAE::run(Module &M) {
+bool DAE::runOnModule(Module &M) {
// First phase: loop through the module, determining which arguments are live.
// We assume all arguments are dead unless proven otherwise (allowing us to
// determine that dead arguments passed into recursive functions are dead).
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index e2d475daf9..9b1a919465 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -21,14 +21,14 @@
using namespace llvm;
namespace {
- struct DTE : public Pass {
+ struct DTE : public ModulePass {
// doPassInitialization - For this pass, it removes global symbol table
// entries for primitive types. These are never used for linking in GCC and
// they make the output uglier to look at, so we nuke them.
//
// Also, initialize instance variables.
//
- bool run(Module &M);
+ bool runOnModule(Module &M);
// getAnalysisUsage - This function needs FindUsedTypes to do its job...
//
@@ -41,7 +41,7 @@ namespace {
NumKilled("deadtypeelim", "Number of unused typenames removed from symtab");
}
-Pass *llvm::createDeadTypeEliminationPass() {
+ModulePass *llvm::createDeadTypeEliminationPass() {
return new DTE();
}
@@ -65,7 +65,7 @@ static inline bool ShouldNukeSymtabEntry(const Type *Ty){
// uglier to look at, so we nuke them. Also eliminate types that are never used
// in the entire program as indicated by FindUsedTypes.
//
-bool DTE::run(Module &M) {
+bool DTE::runOnModule(Module &M) {
bool Changed = false;
SymbolTable &ST = M.getSymbolTable();
diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp
index 41b796035b..1b92fd1df8 100644
--- a/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/lib/Transforms/IPO/ExtractFunction.cpp
@@ -17,7 +17,7 @@
using namespace llvm;
namespace {
- class FunctionExtractorPass : public Pass {
+ class FunctionExtractorPass : public ModulePass {
Function *Named;
bool deleteFunc;
public:
@@ -28,7 +28,7 @@ namespace {
FunctionExtractorPass(Function *F = 0, bool deleteFn = true)
: Named(F), deleteFunc(deleteFn) {}
- bool run(Module &M) {
+ bool runOnModule(Module &M) {
if (Named == 0) {
Named = M.getMainFunction();
if (Named == 0) return false; // No function to extract
@@ -112,6 +112,6 @@ namespace {
RegisterPass<FunctionExtractorPass> X("extract", "Function Extractor");
}
-Pass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn) {
+ModulePass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn) {
return new FunctionExtractorPass(F, deleteFn);
}
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 006d33cf51..3450662181 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -35,17 +35,17 @@ namespace {
Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved");
Statistic<> NumGlobals("funcresolve", "Number of global variables resolved");
- struct FunctionResolvingPass : public Pass {
+ struct FunctionResolvingPass : public ModulePass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<TargetData>();
}
- bool run(Module &M);
+ bool runOnModule(Module &M);
};
RegisterOpt<FunctionResolvingPass> X("funcresolve", "Resolve Functions");
}
-Pass *llvm::createFunctionResolvingPass() {
+ModulePass *llvm::createFunctionResolvingPass() {
return new FunctionResolvingPass();
}
@@ -293,7 +293,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
return false;
}
-bool FunctionResolvingPass::run(Module &M) {
+bool FunctionResolvingPass::runOnModule(Module &M) {
std::map<std::string, std::vector<GlobalValue*> > Globals;
// Loop over the globals, adding them to the Globals map. We use a two pass
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index ea5201cd23..cdf994aeb4 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -27,11 +27,11 @@ namespace {
Statistic<> NumFunctions("globaldce","Number of functions removed");
Statistic<> NumVariables("globaldce","Number of global variables removed");
- struct GlobalDCE : public Pass {
+ struct GlobalDCE : public ModulePass {
// run - Do the GlobalDCE pass on the specified module, optionally updating
// the specified callgraph to reflect the changes.
//
- bool run(Module &M);
+ bool runOnModule(Module &M);
private:
std::set<GlobalValue*> AliveGlobals;
@@ -47,9 +47,9 @@ namespace {
RegisterOpt<GlobalDCE> X("globaldce", "Dead Global Elimination");
}
-Pass *llvm::createGlobalDCEPass() { return new GlobalDCE(); }
+ModulePass *llvm::createGlobalDCEPass() { return new GlobalDCE(); }
-bool GlobalDCE::run(Module &M) {
+bool GlobalDCE::runOnModule(Module &M) {
bool Changed = false;
// Loop over the module, adding globals which are obviously necessary.
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index dd9894cd19..f37be86e1e 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -31,14 +31,14 @@ using namespace llvm;
namespace {
Statistic<> NumMarked("constify", "Number of globals marked constant");
- struct Constifier : public Pass {
- bool run(Module &M);
+ struct Constifier : public ModulePass {
+ bool runOnModule(Module &M);
};
RegisterOpt<Constifier> X("constify", "Global Constifier");
}
-Pass *llvm::createGlobalConstifierPass() { return new Constifier(); }
+ModulePass *llvm::createGlobalConstifierPass() { return new Constifier(); }
/// A lot of global constants are stored only in trivially dead setter
/// functions. Because we don't want to cycle between globaldce and this pass,
@@ -81,7 +81,7 @@ static bool isStoredThrough(Value *V, std::set<PHINode*> &PHIUsers) {
return false;
}
-bool Constifier::run(Module &M) {
+bool Constifier::runOnModule(Module &M) {
bool Changed = false;
std::set<PHINode*> PHIUsers;
for (Module::giterator GV = M.gbegin(), E = M.gend(); GV != E; ++GV)
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index 74a0a9b699..64d1df8354 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -29,17 +29,17 @@ namespace {
/// IPCP - The interprocedural constant propagation pass
///
- struct IPCP : public Pass {
- bool run(Module &M);
+ struct IPCP : public ModulePass {
+ bool runOnModule(Module &M);
private:
bool processFunction(Function &F);
};
RegisterOpt<IPCP> X("ipconstprop", "Interprocedural constant propagation");
}
-Pass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
+ModulePass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
-bool IPCP::run(Module &M) {
+bool IPCP::runOnModule(Module &M) {
bool Changed = false;
bool LocalChange = true;
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 1722fe52e0..6a43143d87 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -66,7 +66,7 @@ namespace {
RegisterOpt<SimpleInliner> X("inline", "Function Integration/Inlining");
}
-Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
+ModulePass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
// CountCodeReductionForConstant - Figure out an approximation for how many
// instructions will be constant folded if the specified value is constant.
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index c6b75b1be9..5e436aa215 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -39,7 +39,7 @@ namespace {
cl::desc("A list of symbol names to preserve"),
cl::CommaSeparated);
- class InternalizePass : public Pass {
+ class InternalizePass : public ModulePass {
std::set<std::string> ExternalNames;
public:
InternalizePass() {
@@ -65,7 +65,7 @@ namespace {
}
}
- virtual bool run(Module &M) {
+ virtual bool runOnModule(Module &M) {
// If no list or file of symbols was specified, check to see if there is a
// "main" symbol defined in the module. If so, use it, otherwise do not
// internalize the module, it must be a library or something.
@@ -117,6 +117,6 @@ namespace {
RegisterOpt<InternalizePass> X("internalize", "Internalize Global Symbols");
} // end anonymous namespace
-Pass *llvm::createInternalizePass() {
+ModulePass *llvm::createInternalizePass() {
return new InternalizePass();
}
diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp
index e1ce290526..1bdb5c272a 100644
--- a/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/lib/Transforms/IPO/LoopExtractor.cpp
@@ -126,7 +126,7 @@ bool LoopExtractor::runOnFunction(Function &F) {
// createSingleLoopExtractorPass - This pass extracts one natural loop from the
// program into a function if it can. This is used by bugpoint.
//
-Pass *llvm::createSingleLoopExtractorPass() {
+ModulePass *llvm::createSingleLoopExtractorPass() {
return new SingleLoopExtractor();
}
@@ -135,13 +135,13 @@ namespace {
/// BlockExtractorPass - This pass is used by bugpoint to extract all blocks
/// from the module into their own functions except for those specified by the
/// BlocksToNotExtract list.
- class BlockExtractorPass : public Pass {
+ class BlockExtractorPass : public ModulePass {
std::vector<BasicBlock*> BlocksToNotExtract;
public:
BlockExtractorPass(std::vector<BasicBlock*> &B) : BlocksToNotExtract(B) {}
BlockExtractorPass() {}
- bool run(Module &M);
+ bool runOnModule(Module &M);
};
RegisterOpt<BlockExtractorPass>
XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
@@ -150,11 +150,11 @@ namespace {
// createBlockExtractorPass - This pass extracts all blocks (except those
// specified in the argument list) from the functions in the module.
//
-Pass *llvm::createBlockExtractorPass(std::vector<BasicBlock*> &BTNE) {
+ModulePass *llvm::createBlockExtractorPass(std::vector<BasicBlock*> &BTNE) {
return new BlockExtractorPass(BTNE);
}
-bool BlockExtractorPass::run(Module &M) {
+bool BlockExtractorPass::runOnModule(Module &M) {
std::set<BasicBlock*> TranslatedBlocksToNotExtract;
for (unsigned i = 0, e = BlocksToNotExtract.size(); i != e; ++i) {
BasicBlock *BB = BlocksToNotExtract[i];
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index ebd0500cba..4ad89b583c 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -64,7 +64,7 @@ namespace {
// class because it works on a module as a whole, not a function at a
// time.
- class LowerSetJmp : public Pass,
+ class LowerSetJmp : public ModulePass,
public InstVisitor<LowerSetJmp> {
// LLVM library functions...
Function* InitSJMap; // __llvm_sjljeh_init_setjmpmap
@@ -119,7 +119,7 @@ namespace {
void visitReturnInst(ReturnInst& RI);
void visitUnwindInst(UnwindInst& UI);
- bool run(Module& M);
+ bool runOnModule(Module& M);
bool doInitialization(Module& M);
};
@@ -129,8 +129,7 @@ namespace {
// run - Run the transformation on the program. We grab the function
// prototypes for longjmp and setjmp. If they are used in the program,
// then we can go directly to the places they're at and transform them.
-bool LowerSetJmp::run(Module& M)
-{
+bool LowerSetJmp::runOnModule(Module& M) {
bool Changed = false;
// These are what the functions are called.
@@ -509,8 +508,7 @@ void LowerSetJmp::visitInvokeInst(InvokeInst& II)
// visitReturnInst - We want to destroy the setjmp map upon exit from the
// function.
-void LowerSetJmp::visitReturnInst(ReturnInst& RI)
-{
+void LowerSetJmp::visitReturnInst(ReturnInst &RI) {
Function* Func = RI.getParent()->getParent();
new CallInst(DestroySJMap, make_vector<Value*>(GetSetJmpMap(Func), 0),
"", &RI);
@@ -518,15 +516,13 @@ void LowerSetJmp::visitReturnInst(ReturnInst& RI)
// visitUnwindInst - We want to destroy the setjmp map upon exit from the
// function.
-void LowerSetJmp::visitUnwindInst(UnwindInst& UI)
-{
+void LowerSetJmp::visitUnwindInst(UnwindInst &UI) {
Function* Func = UI.getParent()->getParent();
new CallInst(DestroySJMap, make_vector<Value*>(GetSetJmpMap(Func), 0),
"", &UI);
}
-Pass* llvm::createLowerSetJmpPass()
-{
+ModulePass *llvm::createLowerSetJmpPass() {
return new LowerSetJmp();
}
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 43b9acff73..36423c8e3e 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -38,7 +38,7 @@ namespace {
RegisterOpt<PruneEH> X("prune-eh", "Remove unused exception handling info");
}
-Pass *llvm::createPruneEHPass() { return new PruneEH(); }
+ModulePass *llvm::createPruneEHPass() { return new PruneEH(); }
bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index 42edb7e05d..d91d23fd18 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -28,7 +28,7 @@ namespace {
// RaiseAllocations - Turn %malloc and %free calls into the appropriate
// instruction.
//
- class RaiseAllocations : public Pass {
+ class RaiseAllocations : public ModulePass {
Function *MallocFunc; // Functions in the module we are processing
Function *FreeFunc; // Initialized by doPassInitializationVirt
public:
@@ -41,7 +41,7 @@ namespace {
// run - This method does the actual work of converting instructions over.
//
- bool run(Module &M);
+ bool runOnModule(Module &M);
};
RegisterOpt<RaiseAllocations>
@@ -50,7 +50,7 @@ namespace {
// createRaiseAllocationsPass - The interface to this file...
-Pass *llvm::createRaiseAllocationsPass() {
+ModulePass *llvm::createRaiseAllocationsPass() {
return new RaiseAllocations();
}
@@ -114,7 +114,7 @@ void RaiseAllocations::doInitialization(Module &M) {
// run - Transform calls into instructions...
//
-bool RaiseAllocations::run(Module &M) {
+bool RaiseAllocations::runOnModule(Module &M) {
// Find the malloc/free prototypes...
doInitialization(M);