diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-29 14:57:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-29 14:57:45 +0000 |
commit | 96c466b06ab0c830b07329c1b16037f585ccbe40 (patch) | |
tree | e07bbfb58ede2e61ef3243a083dbe5da3b47d712 /lib/Transforms/IPO | |
parent | 691fa3cfb12f459b953dd400057841b10ccf4b72 (diff) |
Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/ConstantMerge.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/DeadTypeElimination.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/GlobalDCE.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/InlineSimple.cpp | 1 | ||||
-rw-r--r-- | lib/Transforms/IPO/Internalize.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/OldPoolAllocate.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/SimpleStructMutation.cpp | 5 |
7 files changed, 18 insertions, 2 deletions
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); |