diff options
Diffstat (limited to 'lib/Transforms')
22 files changed, 63 insertions, 10 deletions
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp index e969ac24b3..05480ea950 100644 --- a/lib/Transforms/HoistPHIConstants.cpp +++ b/lib/Transforms/HoistPHIConstants.cpp @@ -75,6 +75,8 @@ static bool doHoistPHIConstants(Function *M) { namespace { struct HoistPHIConstants : public FunctionPass { + const char *getPassName() const { return "Hoist Constants from PHI Nodes"; } + virtual bool runOnFunction(Function *F) { return doHoistPHIConstants(F); } virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index a635b8d21b..146911e818 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -65,6 +65,8 @@ namespace { unsigned LastConstantSeen; public: inline ConstantMerge() : LastConstantSeen(0) {} + + const char *getPassName() const {return "Merge Duplicate Global Constants";} // doInitialization - For this pass, process all of the globals in the // module, eliminating duplicate constants. @@ -89,6 +91,8 @@ namespace { }; struct DynamicConstantMerge : public ConstantMerge { + const char *getPassName() const { return "Dynamic Constant Merge"; } + // runOnFunction - Check to see if any globals have been added to the // global list for the module. If so, eliminate them. // diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index 3ba6057fad..dc330b29f8 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -36,6 +36,8 @@ static const Type *PtrSByte = 0; // 'sbyte*' type namespace { struct CleanupGCCOutput : public FunctionPass { + const char *getPassName() const { return "Cleanup GCC Output"; } + // 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. @@ -337,6 +339,8 @@ bool CleanupGCCOutput::doFinalization(Module *M) { namespace { struct FunctionResolvingPass : public Pass { + const char *getPassName() const { return "Resolve Functions"; } + bool run(Module *M); }; } diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index cd9c35f058..e852a6a29f 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -49,6 +49,8 @@ static bool RemoveUnreachableFunctions(Module *M, CallGraph &CallGraph) { namespace { struct GlobalDCE : public Pass { + const char *getPassName() const { return "Dead Global Elimination"; } + // run - Do the GlobalDCE pass on the specified module, optionally updating // the specified callgraph to reflect the changes. // diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 1581323bea..ba64a6abce 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -271,6 +271,7 @@ static bool doFunctionInlining(Function *F) { namespace { struct FunctionInlining : public FunctionPass { + const char *getPassName() const { return "Function Inlining"; } virtual bool runOnFunction(Function *F) { return doFunctionInlining(F); } diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index 8bb1a9c111..c84be9b93a 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -12,6 +12,8 @@ #include "llvm/Function.h" class InternalizePass : public Pass { + const char *getPassName() const { return "Internalize Functions"; } + virtual bool run(Module *M) { bool FoundMain = false; // Look for a function named main... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) diff --git a/lib/Transforms/IPO/OldPoolAllocate.cpp b/lib/Transforms/IPO/OldPoolAllocate.cpp index 6ccd043a85..bb99002052 100644 --- a/lib/Transforms/IPO/OldPoolAllocate.cpp +++ b/lib/Transforms/IPO/OldPoolAllocate.cpp @@ -199,6 +199,8 @@ namespace { // Define the pass class that we implement... struct PoolAllocate : public Pass { + const char *getPassName() const { return "Pool Allocate"; } + PoolAllocate() { switch (ReqPointerSize) { case Ptr32bits: POINTERTYPE = Type::UIntTy; break; diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index 33e0289504..c0d9ef46bc 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -18,12 +18,13 @@ using std::set; using std::pair; namespace { - class SimpleStructMutation : public MutateStructTypes { - public: + struct SimpleStructMutation : public MutateStructTypes { enum Transform { SwapElements, SortElements } CurrentXForm; SimpleStructMutation(enum Transform XForm) : CurrentXForm(XForm) {} + const char *getPassName() const { return "Simple Struct Mutation"; } + virtual bool run(Module *M) { setTransforms(getTransforms(M, CurrentXForm)); bool Changed = MutateStructTypes::run(M); diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index 26fa866616..3a44dbf918 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -37,8 +37,9 @@ using std::vector; -class ProfilePaths: public FunctionPass { - public: +struct ProfilePaths : public FunctionPass { + const char *getPassName() const { return "ProfilePaths"; } + bool runOnFunction(Function *F); // Before this pass, make sure that there is only one diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index 384516283c..1a9a7f3a6a 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -30,6 +30,8 @@ namespace { InsertTraceCode(bool traceBasicBlockExits, bool traceFunctionExits) : TraceBasicBlockExits(traceBasicBlockExits), TraceFunctionExits(traceFunctionExits) {} + + const char *getPassName() const { return "Trace Code Insertion"; } // Add a prototype for printf if it is not already in the program. // diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index 07981d0aa3..f9f9abeace 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -471,6 +471,8 @@ static bool doRPR(Function *F) { namespace { struct RaisePointerReferences : public FunctionPass { + const char *getPassName() const { return "Raise Pointer References"; } + virtual bool runOnFunction(Function *F) { return doRPR(F); } virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 7f1fedec24..bd60b519a7 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -290,6 +290,8 @@ BasicBlock *ADCE::fixupCFG(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks, namespace { struct AgressiveDCE : public FunctionPass { + const char *getPassName() const {return "Aggressive Dead Code Elimination";} + // doADCE - Execute the Agressive Dead Code Elimination Algorithm // virtual bool runOnFunction(Function *F) { diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index a8dbe3ff95..77a959910f 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -211,6 +211,8 @@ static bool DoConstPropPass(Function *F) { namespace { struct ConstantPropogation : public FunctionPass { + const char *getPassName() const { return "Simple Constant Propogation"; } + inline bool runOnFunction(Function *F) { bool Modified = false; diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 1a3073c3c7..4aac04114e 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -64,6 +64,8 @@ static inline bool RemoveUnusedDefs(BasicBlock::InstListType &Vals) { } struct DeadInstElimination : public BasicBlockPass { + const char *getPassName() const { return "Dead Instruction Elimination"; } + virtual bool runOnBasicBlock(BasicBlock *BB) { return RemoveUnusedDefs(BB->getInstList()); } @@ -340,6 +342,7 @@ static bool RemoveUnusedGlobalValues(Module *Mod) { namespace { struct DeadCodeElimination : public FunctionPass { + const char *getPassName() const { return "Dead Code Elimination"; } // Pass Interface... virtual bool doInitialization(Module *M) { diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index 0367348ef5..1eb582ebc4 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -9,15 +9,16 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/DecomposeMultiDimRefs.h" -#include "llvm/Constants.h" +#include "llvm/Constant.h" #include "llvm/iMemory.h" #include "llvm/iOther.h" #include "llvm/BasicBlock.h" -#include "llvm/Function.h" #include "llvm/Pass.h" namespace { struct DecomposePass : public BasicBlockPass { + const char *getPassName() const { return "Decompose Subscripting Exps"; } + virtual bool runOnBasicBlock(BasicBlock *BB); private: @@ -79,8 +80,9 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { // Check for a zero index. This will need a cast instead of // a getElementPtr, or it may need neither. - bool indexIsZero = isa<ConstantUInt>(*OI) && - cast<Constant>(*OI)->isNullValue(); + bool indexIsZero = isa<Constant>(*OI) && + cast<Constant>(*OI)->isNullValue() && + (*OI)->getType() == Type::UIntTy; // Extract the first index. If the ptr is a pointer to a structure // and the next index is a structure offset (i.e., not an array offset), diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index b864760e68..cb24a0cbfc 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -30,6 +30,10 @@ namespace { DominatorSet *DomSetInfo; ImmediateDominators *ImmDominator; public: + const char *getPassName() const { + return "Global Common Subexpression Elimination"; + } + virtual bool runOnFunction(Function *F); // Visitation methods, these are invoked depending on the type of diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 003419bb84..1e8621b5ed 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -197,6 +197,10 @@ static bool doit(Function *M, LoopInfo &Loops) { namespace { struct InductionVariableSimplify : public FunctionPass { + const char *getPassName() const { + return "Induction Variable Cannonicalize"; + } + virtual bool runOnFunction(Function *F) { return doit(F, getAnalysis<LoopInfo>()); } diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 626c130114..c8d2bed789 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -42,6 +42,8 @@ namespace { } public: + const char *getPassName() const { return "Instruction Combining"; } + virtual bool runOnFunction(Function *F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 12d518b3c8..8271c9bce4 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -466,6 +466,10 @@ namespace { // to prove whether a value is constant and whether blocks are used. // struct SCCPPass : public FunctionPass { + const char *getPassName() const { + return "Sparse Conditional Constant Propogation"; + } + 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 f99684faaf..8320716d54 100644 --- a/lib/Transforms/Scalar/SymbolStripping.cpp +++ b/lib/Transforms/Scalar/SymbolStripping.cpp @@ -61,6 +61,8 @@ static bool doStripGlobalSymbols(Module *M) { namespace { struct SymbolStripping : public FunctionPass { + const char *getPassName() const { return "Strip Symbols from Functions"; } + virtual bool runOnFunction(Function *F) { return doSymbolStripping(F); } @@ -70,6 +72,7 @@ namespace { }; struct FullSymbolStripping : public SymbolStripping { + const char *getPassName() const { return "Strip Symbols from Module"; } virtual bool doInitialization(Module *M) { return doStripGlobalSymbols(M); } diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 21456a27d0..c6cb81f0f5 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -34,6 +34,8 @@ public: MallocFunc = FreeFunc = 0; } + const char *getPassName() const { return "Lower Allocations"; } + // doPassInitialization - For the lower allocations pass, this ensures that a // module contains a declaration for a malloc and a free function. // @@ -54,6 +56,8 @@ class RaiseAllocations : public BasicBlockPass { public: inline RaiseAllocations() : MallocFunc(0), FreeFunc(0) {} + const char *getPassName() const { return "Raise Allocations"; } + // doPassInitialization - For the raise allocations pass, this finds a // declaration for malloc and free if they exist. // @@ -216,5 +220,3 @@ Pass *createLowerAllocationsPass(const TargetData &TD) { Pass *createRaiseAllocationsPass() { return new RaiseAllocations(); } - - diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index e0d2c2475f..3d81a8bde0 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -44,6 +44,8 @@ namespace { map<BasicBlock*,vector<PHINode*> > NewPhiNodes; // the PhiNodes we're adding public: + const char *getPassName() const { return "Promote Memory to Register"; } + // runOnFunction - To run this pass, first we calculate the alloca // instructions that are safe for promotion, then we promote each one. // |