diff options
Diffstat (limited to 'lib/Transforms')
21 files changed, 119 insertions, 153 deletions
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp index 26cf5ca04f..f6e6109ea5 100644 --- a/lib/Transforms/HoistPHIConstants.cpp +++ b/lib/Transforms/HoistPHIConstants.cpp @@ -74,8 +74,8 @@ static bool doHoistPHIConstants(Function *M) { } namespace { - struct HoistPHIConstants : public MethodPass { - virtual bool runOnMethod(Function *F) { return doHoistPHIConstants(F); } + struct HoistPHIConstants : public FunctionPass { + virtual bool runOnFunction(Function *F) { return doHoistPHIConstants(F); } }; } diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index ef51105a47..ee28b13a2c 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -58,8 +58,8 @@ bool mergeDuplicateConstants(Module *M, unsigned &ConstantNo, } namespace { - // FIXME: ConstantMerge should not be a methodPass!!! - class ConstantMerge : public MethodPass { + // FIXME: ConstantMerge should not be a FunctionPass!!! + class ConstantMerge : public FunctionPass { protected: std::map<Constant*, GlobalVariable*> Constants; unsigned LastConstantSeen; @@ -73,7 +73,7 @@ namespace { return ::mergeDuplicateConstants(M, LastConstantSeen, Constants); } - bool runOnMethod(Function *) { return false; } + bool runOnFunction(Function *) { return false; } // doFinalization - Clean up internal state for this module // @@ -85,10 +85,10 @@ namespace { }; struct DynamicConstantMerge : public ConstantMerge { - // runOnMethod - Check to see if any globals have been added to the + // runOnFunction - Check to see if any globals have been added to the // global list for the module. If so, eliminate them. // - bool runOnMethod(Function *F) { + bool runOnFunction(Function *F) { return ::mergeDuplicateConstants(F->getParent(), LastConstantSeen, Constants); } diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index 4f2e24d462..3ba6057fad 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -35,7 +35,7 @@ using std::cerr; static const Type *PtrSByte = 0; // 'sbyte*' type namespace { - struct CleanupGCCOutput : public MethodPass { + struct CleanupGCCOutput : public FunctionPass { // 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. @@ -46,18 +46,15 @@ namespace { // runOnFunction - This method simplifies the specified function hopefully. // - bool runOnMethod(Function *F); + bool runOnFunction(Function *F); // doPassFinalization - Strip out type names that are unused by the program bool doFinalization(Module *M); - // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job... + // getAnalysisUsage - This function needs FindUsedTypes to do its job... // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - // FIXME: Invalidates the CFG - Required.push_back(FindUsedTypes::ID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(FindUsedTypes::ID); } }; } @@ -246,7 +243,7 @@ static inline void RefactorPredecessor(BasicBlock *BB, BasicBlock *Pred) { } -// runOnMethod - Loop through the function and fix problems with the PHI nodes +// runOnFunction - Loop through the function and fix problems with the PHI nodes // in the current function. The problem is that PHI nodes might exist with // multiple entries for the same predecessor. GCC sometimes generates code that // looks like this: @@ -262,7 +259,7 @@ static inline void RefactorPredecessor(BasicBlock *BB, BasicBlock *Pred) { // bb8: %reg119 = phi uint [ 0, %bbX ], [ 1, %bb7 ] // // -bool CleanupGCCOutput::runOnMethod(Function *M) { +bool CleanupGCCOutput::runOnFunction(Function *M) { bool Changed = false; // Don't use iterators because invalidation gets messy... for (unsigned MI = 0; MI < M->size(); ++MI) { diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index ae9bd39270..cd9c35f058 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -1,6 +1,7 @@ //===-- GlobalDCE.cpp - DCE unreachable internal functions ----------------===// // // This transform is designed to eliminate unreachable internal globals +// FIXME: GlobalDCE should update the callgraph, not destroy it! // //===----------------------------------------------------------------------===// @@ -55,16 +56,12 @@ namespace { return RemoveUnreachableFunctions(M, getAnalysis<CallGraph>()); } - // getAnalysisUsageInfo - This function works on the call graph of a module. + // getAnalysisUsage - This function works on the call graph of a module. // It is capable of updating the call graph to reflect the new state of the // module. // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Required.push_back(CallGraph::ID); - // FIXME: This should update the callgraph, not destroy it! - Destroyed.push_back(CallGraph::ID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(CallGraph::ID); } }; } diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 7f96278265..fcb1e4fa40 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -53,7 +53,7 @@ static inline void RemapInstruction(Instruction *I, } } -// InlineMethod - This function forcibly inlines the called function into the +// InlineFunction - This function forcibly inlines the called function into the // basic block of the caller. This returns false if it is not possible to // inline this call. The program is still in a well defined state if this // occurs though. @@ -63,8 +63,8 @@ static inline void RemapInstruction(Instruction *I, // exists in the instruction stream. Similiarly this will inline a recursive // function by one level. // -bool InlineMethod(BasicBlock::iterator CIIt) { - assert(isa<CallInst>(*CIIt) && "InlineMethod only works on CallInst nodes!"); +bool InlineFunction(BasicBlock::iterator CIIt) { + assert(isa<CallInst>(*CIIt) && "InlineFunction only works on CallInst nodes"); assert((*CIIt)->getParent() && "Instruction not embedded in basic block!"); assert((*CIIt)->getParent()->getParent() && "Instruction not in function!"); @@ -209,7 +209,7 @@ bool InlineMethod(BasicBlock::iterator CIIt) { return true; } -bool InlineMethod(CallInst *CI) { +bool InlineFunction(CallInst *CI) { assert(CI->getParent() && "CallInst not embeded in BasicBlock!"); BasicBlock *PBB = CI->getParent(); @@ -217,12 +217,12 @@ bool InlineMethod(CallInst *CI) { assert(CallIt != PBB->end() && "CallInst has parent that doesn't contain CallInst?!?"); - return InlineMethod(CallIt); + return InlineFunction(CallIt); } static inline bool ShouldInlineFunction(const CallInst *CI, const Function *F) { assert(CI->getParent() && CI->getParent()->getParent() && - "Call not embedded into a method!"); + "Call not embedded into a function!"); // Don't inline a recursive call. if (CI->getParent()->getParent() == F) return false; @@ -244,7 +244,7 @@ static inline bool DoFunctionInlining(BasicBlock *BB) { // Check to see if we should inline this function Function *F = CI->getCalledFunction(); if (F && ShouldInlineFunction(CI, F)) - return InlineMethod(I); + return InlineFunction(I); } } return false; @@ -270,11 +270,11 @@ static bool doFunctionInlining(Function *F) { } namespace { - struct FunctionInlining : public MethodPass { - virtual bool runOnMethod(Function *F) { + struct FunctionInlining : public FunctionPass { + virtual bool runOnFunction(Function *F) { return doFunctionInlining(F); } }; } -Pass *createMethodInliningPass() { return new FunctionInlining(); } +Pass *createFunctionInliningPass() { return new FunctionInlining(); } diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index b5dd937f7e..2a6d18460d 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -28,12 +28,6 @@ using std::map; using std::vector; -//FIXME: These headers are only included because the analyses are killed!!! -#include "llvm/Analysis/CallGraph.h" -#include "llvm/Analysis/FindUsedTypes.h" -#include "llvm/Analysis/FindUnsafePointerTypes.h" -//FIXME end - // To enable debugging, uncomment this... //#define DEBUG_MST(x) x @@ -273,7 +267,7 @@ void MutateStructTypes::processGlobals(Module *M) { if (Meth->hasName()) Meth->setName("OLD."+Meth->getName()); - // Insert the new function into the method list... to be filled in later.. + // Insert the new function into the function list... to be filled in later M->getFunctionList().push_back(NewMeth); // Keep track of the association... @@ -325,10 +319,10 @@ void MutateStructTypes::removeDeadGlobals(Module *M) { -// transformMethod - This transforms the instructions of the function to use the -// new types. +// transformFunction - This transforms the instructions of the function to use +// the new types. // -void MutateStructTypes::transformMethod(Function *m) { +void MutateStructTypes::transformFunction(Function *m) { const Function *M = m; map<const GlobalValue*, GlobalValue*>::iterator GMI = GlobalMap.find(M); if (GMI == GlobalMap.end()) @@ -518,19 +512,9 @@ bool MutateStructTypes::run(Module *M) { processGlobals(M); for_each(M->begin(), M->end(), - bind_obj(this, &MutateStructTypes::transformMethod)); + bind_obj(this, &MutateStructTypes::transformFunction)); removeDeadGlobals(M); return true; } -// getAnalysisUsageInfo - This function needs the results of the -// FindUsedTypes and FindUnsafePointerTypes analysis passes... -// -void MutateStructTypes::getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Destroyed.push_back(FindUsedTypes::ID); - Destroyed.push_back(FindUnsafePointerTypes::ID); - Destroyed.push_back(CallGraph::ID); -} diff --git a/lib/Transforms/IPO/OldPoolAllocate.cpp b/lib/Transforms/IPO/OldPoolAllocate.cpp index 43683e4c35..bd67fe1cc9 100644 --- a/lib/Transforms/IPO/OldPoolAllocate.cpp +++ b/lib/Transforms/IPO/OldPoolAllocate.cpp @@ -234,12 +234,11 @@ namespace { bool run(Module *M); - // getAnalysisUsageInfo - This function requires data structure information + // getAnalysisUsage - This function requires data structure information // to be able to see what is pool allocatable. // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &,Pass::AnalysisSet &) { - Required.push_back(DataStructure::ID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(DataStructure::ID); } public: diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index 5c64aa3537..33e0289504 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -1,4 +1,4 @@ -//===- SimpleStructMutation.cpp - Swap structure elements around ---*- C++ -*--=// +//===- SimpleStructMutation.cpp - Swap structure elements around -*- C++ -*--=// // // This pass does a simple transformation that swaps all of the elements of the // struct types in the program around. @@ -31,15 +31,13 @@ namespace { return Changed; } - // getAnalysisUsageInfo - This function needs the results of the + // getAnalysisUsage - This function needs the results of the // FindUsedTypes and FindUnsafePointerTypes analysis passes... // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Required.push_back(FindUsedTypes::ID); - Required.push_back(FindUnsafePointerTypes::ID); - MutateStructTypes::getAnalysisUsageInfo(Required, Destroyed, Provided); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(FindUsedTypes::ID); + AU.addRequired(FindUnsafePointerTypes::ID); + MutateStructTypes::getAnalysisUsage(AU); } private: diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index aa2cfdd218..860119e206 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -37,17 +37,15 @@ using std::vector; -class ProfilePaths: public MethodPass { +class ProfilePaths: public FunctionPass { public: - bool runOnMethod(Function *M); + bool runOnFunction(Function *F); // Before this pass, make sure that there is only one // entry and only one exit node for the function in the CFG of the function // - void ProfilePaths::getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Requires.push_back(UnifyMethodExitNodes::ID); + void ProfilePaths::getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(UnifyMethodExitNodes::ID); } }; @@ -68,7 +66,7 @@ static Node *findBB(std::set<Node *> &st, BasicBlock *BB){ } //Per function pass for inserting counters and trigger code -bool ProfilePaths::runOnMethod(Function *M){ +bool ProfilePaths::runOnFunction(Function *M){ //Transform the cfg s.t. we have just one exit node BasicBlock *ExitNode = getAnalysis<UnifyMethodExitNodes>().getExitNode(); diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index 12fc84b347..d05d33dc72 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -23,7 +23,7 @@ using std::vector; using std::string; namespace { - class InsertTraceCode : public MethodPass { + class InsertTraceCode : public FunctionPass { bool TraceBasicBlockExits, TraceFunctionExits; Function *PrintfFunc; public: @@ -46,14 +46,14 @@ namespace { // runOnFunction - This method does the work. // - bool runOnMethod(Function *F) { + bool runOnFunction(Function *F) { return doit(F, TraceBasicBlockExits, TraceFunctionExits, PrintfFunc); } }; } // end anonymous namespace -Pass *createTraceValuesPassForMethod() { // Just trace functions +Pass *createTraceValuesPassForFunction() { // Just trace functions return new InsertTraceCode(false, true); } diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index 51d863d10d..f556cedcd8 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -440,7 +440,7 @@ static bool DoRaisePass(Function *F) { } -// RaisePointerReferences::doit - Raise a method representation to a higher +// RaisePointerReferences::doit - Raise a function representation to a higher // level. // static bool doRPR(Function *F) { @@ -458,7 +458,7 @@ static bool doRPR(Function *F) { cerr << "Looping: \n" << F; #endif - // Iterate over the method, refining it, until it converges on a stable + // Iterate over the function, refining it, until it converges on a stable // state LocalChange = false; while (DoRaisePass(F)) LocalChange = true; @@ -470,8 +470,8 @@ static bool doRPR(Function *F) { } namespace { - struct RaisePointerReferences : public MethodPass { - virtual bool runOnMethod(Function *F) { return doRPR(F); } + struct RaisePointerReferences : public FunctionPass { + virtual bool runOnFunction(Function *F) { return doRPR(F); } }; } diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index c129b5c5a8..71069c617c 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -29,7 +29,7 @@ using std::cerr; // It's public interface consists of a constructor and a doADCE() method. // class ADCE { - Function *M; // The method that we are working on... + Function *M; // The function that we are working on std::vector<Instruction*> WorkList; // Instructions that just became live std::set<Instruction*> LiveSet; // The set of live instructions bool MadeChanges; @@ -38,11 +38,11 @@ class ADCE { // The public interface for this class // public: - // ADCE Ctor - Save the method to operate on... - inline ADCE(Function *m) : M(m), MadeChanges(false) {} + // ADCE Ctor - Save the function to operate on... + inline ADCE(Function *f) : M(f), MadeChanges(false) {} // doADCE() - Run the Agressive Dead Code Elimination algorithm, returning - // true if the method was modified. + // true if the function was modified. bool doADCE(cfg::DominanceFrontier &CDG); //===--------------------------------------------------------------------===// @@ -75,14 +75,14 @@ private: // doADCE() - Run the Agressive Dead Code Elimination algorithm, returning -// true if the method was modified. +// true if the function was modified. // bool ADCE::doADCE(cfg::DominanceFrontier &CDG) { #ifdef DEBUG_ADCE cerr << "Function: " << M; #endif - // Iterate over all of the instructions in the method, eliminating trivially + // Iterate over all of the instructions in the function, eliminating trivially // dead instructions, and marking instructions live that are known to be // needed. Perform the walk in depth first order so that we avoid marking any // instructions live in basic blocks that are unreachable. These blocks will @@ -173,7 +173,7 @@ bool ADCE::doADCE(cfg::DominanceFrontier &CDG) { if (EntryBlock && EntryBlock != M->front()) { if (isa<PHINode>(EntryBlock->front())) { // Cannot make the first block be a block with a PHI node in it! Instead, - // strip the first basic block of the method to contain no instructions, + // strip the first basic block of the function to contain no instructions, // then add a simple branch to the "real" entry node... // BasicBlock *E = M->front(); @@ -191,9 +191,9 @@ bool ADCE::doADCE(cfg::DominanceFrontier &CDG) { } else { - // We need to move the new entry block to be the first bb of the method. + // We need to move the new entry block to be the first bb of the function Function::iterator EBI = find(M->begin(), M->end(), EntryBlock); - std::swap(*EBI, *M->begin());// Exchange old location with start of method + std::swap(*EBI, *M->begin()); // Exchange old location with start of fn MadeChanges = true; } } @@ -289,19 +289,17 @@ BasicBlock *ADCE::fixupCFG(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks, } namespace { - struct AgressiveDCE : public MethodPass { + struct AgressiveDCE : public FunctionPass { // doADCE - Execute the Agressive Dead Code Elimination Algorithm // - virtual bool runOnMethod(Function *M) { - return ADCE(M).doADCE( + virtual bool runOnFunction(Function *F) { + return ADCE(F).doADCE( getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID)); } - // getAnalysisUsageInfo - We require post dominance frontiers (aka Control + // getAnalysisUsage - We require post dominance frontiers (aka Control // Dependence Graph) - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Requires.push_back(cfg::DominanceFrontier::PostDomID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(cfg::DominanceFrontier::PostDomID); } }; } diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index 26d5c7d43e..a8cd02fed0 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -211,8 +211,8 @@ static bool DoConstPropPass(Function *F) { } namespace { - struct ConstantPropogation : public MethodPass { - inline bool runOnMethod(Function *F) { + struct ConstantPropogation : public FunctionPass { + inline bool runOnFunction(Function *F) { bool Modified = false; // Fold constants until we make no progress... diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 6169730ce8..0d6f293cd0 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -9,7 +9,7 @@ // predecessor only has one successor. // * Eliminates PHI nodes for basic blocks with a single predecessor // * Eliminates a basic block that only contains an unconditional branch -// * Eliminates method prototypes that are not referenced +// * Eliminates function prototypes that are not referenced // // TODO: This should REALLY be worklist driven instead of iterative. Right now, // we scan linearly through values, removing unused ones as we go. The problem @@ -163,13 +163,13 @@ static bool PropogatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { // iterator that designates the first element remaining after the block that // was deleted. // -// WARNING: The entry node of a method may not be simplified. +// WARNING: The entry node of a function may not be simplified. // bool SimplifyCFG(Function::iterator &BBIt) { BasicBlock *BB = *BBIt; Function *M = BB->getParent(); - assert(BB && BB->getParent() && "Block not embedded in method!"); + assert(BB && BB->getParent() && "Block not embedded in function!"); assert(BB->getTerminator() && "Degenerate basic block encountered!"); assert(BB->getParent()->front() != BB && "Can't Simplify entry block!"); @@ -258,7 +258,7 @@ bool SimplifyCFG(Function::iterator &BBIt) { Pred->getInstList().push_back(Def); // Add to end... } - // Remove basic block from the method... and advance iterator to the + // Remove basic block from the function... and advance iterator to the // next valid block... BB = M->getBasicBlocks().remove(BBIt); @@ -303,7 +303,7 @@ static bool DoDCEPass(Function *F) { } // Remove unused global values - This removes unused global values of no -// possible value. This currently includes unused method prototypes and +// possible value. This currently includes unused function prototypes and // unitialized global variables. // static bool RemoveUnusedGlobalValues(Module *Mod) { @@ -313,7 +313,7 @@ static bool RemoveUnusedGlobalValues(Module *Mod) { Function *Meth = *MI; if (Meth->isExternal() && Meth->use_size() == 0) { // No references to prototype? - //cerr << "Removing method proto: " << Meth->getName() << endl; + //cerr << "Removing function proto: " << Meth->getName() << endl; delete Mod->getFunctionList().remove(MI); // Remove prototype // Remove moves iterator to point to the next one automatically Changed = true; @@ -339,7 +339,7 @@ static bool RemoveUnusedGlobalValues(Module *Mod) { } namespace { - struct DeadCodeElimination : public MethodPass { + struct DeadCodeElimination : public FunctionPass { // Pass Interface... virtual bool doInitialization(Module *M) { @@ -349,7 +349,7 @@ namespace { // It is possible that we may require multiple passes over the code to fully // eliminate dead code. Iterate until we are done. // - virtual bool runOnMethod(Function *F) { + virtual bool runOnFunction(Function *F) { bool Changed = false; while (DoDCEPass(F)) Changed = true; return Changed; diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index 390cd953ef..0ec72c65e0 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -1,4 +1,4 @@ -//===- llvm/Transforms/DecomposeMultiDimRefs.cpp - Lower array refs to 1D -----=// +//===- llvm/Transforms/DecomposeMultiDimRefs.cpp - Lower array refs to 1D ---=// // // DecomposeMultiDimRefs - // Convert multi-dimensional references consisting of any combination @@ -7,7 +7,7 @@ // has at most one index (except structure references, // which need an extra leading index of [0]). // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/DecomposeMultiDimRefs.h" #include "llvm/ConstantVals.h" @@ -171,9 +171,13 @@ doDecomposeMultiDimRefs(Function *F) namespace { - struct DecomposeMultiDimRefsPass : public MethodPass { - virtual bool runOnMethod(Function *F) { return doDecomposeMultiDimRefs(F); } + struct DecomposeMultiDimRefsPass : public FunctionPass { + virtual bool runOnFunction(Function *F) { + return doDecomposeMultiDimRefs(F); + } }; } -Pass *createDecomposeMultiDimRefsPass() { return new DecomposeMultiDimRefsPass(); } +Pass *createDecomposeMultiDimRefsPass() { + return new DecomposeMultiDimRefsPass(); +} diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index a388025531..40ee5c7f83 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -188,7 +188,7 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) { } static bool doit(Function *M, cfg::LoopInfo &Loops) { - // Induction Variables live in the header nodes of the loops of the method... + // Induction Variables live in the header nodes of the loops of the function return reduce_apply_bool(Loops.getTopLevelLoops().begin(), Loops.getTopLevelLoops().end(), std::bind1st(std::ptr_fun(TransformLoop), &Loops)); @@ -196,15 +196,13 @@ static bool doit(Function *M, cfg::LoopInfo &Loops) { namespace { - struct InductionVariableSimplify : public MethodPass { - virtual bool runOnMethod(Function *F) { + struct InductionVariableSimplify : public FunctionPass { + virtual bool runOnFunction(Function *F) { return doit(F, getAnalysis<cfg::LoopInfo>()); } - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Required.push_back(cfg::LoopInfo::ID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(cfg::LoopInfo::ID); } }; } diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp index 9931a6b5d7..8e559a3d6c 100644 --- a/lib/Transforms/Scalar/InductionVars.cpp +++ b/lib/Transforms/Scalar/InductionVars.cpp @@ -183,7 +183,7 @@ static PHINode *InjectSimpleInductionVariable(cfg::Interval *Int) { Function *M = Header->getParent(); if (M->hasSymbolTable()) { - // Only name the induction variable if the method isn't stripped. + // Only name the induction variable if the function isn't stripped. PHIName = "ind_var"; AddName = "ind_var_next"; } @@ -353,7 +353,7 @@ static bool ProcessInterval(cfg::Interval *Int) { // static bool ProcessIntervalPartition(cfg::IntervalPartition &IP) { // This currently just prints out information about the interval structure - // of the method... + // of the function... #if 0 static unsigned N = 0; cerr << "\n***********Interval Partition #" << (++N) << "************\n\n"; @@ -398,17 +398,14 @@ bool InductionVariableCannonicalize::doIt(Function *M, } -bool InductionVariableCannonicalize::runOnMethod(Function *F) { +bool InductionVariableCannonicalize::runOnFunction(Function *F) { return doIt(F, getAnalysis<cfg::IntervalPartition>()); } -// getAnalysisUsageInfo - This function works on the call graph of a module. +// getAnalysisUsage - This function works on the call graph of a module. // It is capable of updating the call graph to reflect the new state of the // module. // -void InductionVariableCannonicalize::getAnalysisUsageInfo( - Pass::AnalysisSet &Required, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Required.push_back(cfg::IntervalPartition::ID); +void InductionVariableCannonicalize::getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(cfg::IntervalPartition::ID); } diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index c2fa84c21f..dea024442d 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -27,7 +27,7 @@ namespace { - class InstCombiner : public MethodPass, + class InstCombiner : public FunctionPass, public InstVisitor<InstCombiner, Instruction*> { // Worklist of all of the instructions that need to be simplified. std::vector<Instruction*> WorkList; @@ -44,7 +44,7 @@ namespace { public: - virtual bool runOnMethod(Function *F); + virtual bool runOnFunction(Function *F); // Visitation implementation - Implement instruction combining for different // instruction types. The semantics are as follows: @@ -205,7 +205,7 @@ Instruction *InstCombiner::visitMemAccessInst(MemAccessInst *MAI) { } -bool InstCombiner::runOnMethod(Function *F) { +bool InstCombiner::runOnFunction(Function *F) { bool Changed = false; WorkList.insert(WorkList.end(), inst_begin(F), inst_end(F)); diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 51a827d14b..e723fc833b 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -34,9 +34,7 @@ using std::cerr; // InstVal class - This class represents the different lattice values that an -// instruction may occupy. It is a simple class with value semantics. The -// potential constant value that is pointed to is owned by the constant pool -// for the method being optimized. +// instruction may occupy. It is a simple class with value semantics. // class InstVal { enum { @@ -83,7 +81,7 @@ public: // SCCP Class // // This class does all of the work of Sparse Conditional Constant Propogation. -// It's public interface consists of a constructor and a doSCCP() method. +// It's public interface consists of a constructor and a doSCCP() function. // class SCCP : public InstVisitor<SCCP> { Function *M; // The function that we are working on @@ -99,11 +97,11 @@ class SCCP : public InstVisitor<SCCP> { // public: - // SCCP Ctor - Save the method to operate on... + // SCCP Ctor - Save the function to operate on... inline SCCP(Function *f) : M(f) {} // doSCCP() - Run the Sparse Conditional Constant Propogation algorithm, and - // return true if the method was modified. + // return true if the function was modified. bool doSCCP(); //===--------------------------------------------------------------------===// @@ -212,10 +210,10 @@ private: // doSCCP() - Run the Sparse Conditional Constant Propogation algorithm, and -// return true if the method was modified. +// return true if the function was modified. // bool SCCP::doSCCP() { - // Mark the first block of the method as being executable... + // Mark the first block of the function as being executable... markExecutable(M->front()); // Process the work lists until their are empty! @@ -264,7 +262,7 @@ bool SCCP::doSCCP() { #endif - // Iterate over all of the instructions in a method, replacing them with + // Iterate over all of the instructions in a function, replacing them with // constants if we have found them to be of constant values. // bool MadeChanges = false; @@ -467,8 +465,8 @@ namespace { // SCCPPass - Use Sparse Conditional Constant Propogation // to prove whether a value is constant and whether blocks are used. // - struct SCCPPass : public MethodPass { - inline bool runOnMethod(Function *F) { + struct SCCPPass : public FunctionPass { + inline bool runOnFunction(Function *F) { SCCP S(F); return S.doSCCP(); } diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp index a026fd673a..36b465ebb6 100644 --- a/lib/Transforms/Scalar/SymbolStripping.cpp +++ b/lib/Transforms/Scalar/SymbolStripping.cpp @@ -60,8 +60,8 @@ static bool doStripGlobalSymbols(Module *M) { } namespace { - struct SymbolStripping : public MethodPass { - virtual bool runOnMethod(Function *F) { + struct SymbolStripping : public FunctionPass { + virtual bool runOnFunction(Function *F) { return doSymbolStripping(F); } }; diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 6f220f8604..8726ed43e3 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -309,22 +309,20 @@ bool PromoteInstance::queuePhiNode(BasicBlock *bb, int i /*the alloca*/) namespace { - struct PromotePass : public MethodPass { + struct PromotePass : public FunctionPass { - // runOnMethod - To run this pass, first we calculate the alloca + // runOnFunction - To run this pass, first we calculate the alloca // instructions that are safe for promotion, then we promote each one. // - virtual bool runOnMethod(Function *F) { + virtual bool runOnFunction(Function *F) { return (bool)PromoteInstance(F, getAnalysis<DominanceFrontier>()); } - // getAnalysisUsageInfo - We need dominance frontiers + // getAnalysisUsage - We need dominance frontiers // - virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Requires.push_back(DominanceFrontier::ID); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(DominanceFrontier::ID); } }; } |