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 /include/llvm | |
parent | 691fa3cfb12f459b953dd400057841b10ccf4b72 (diff) | |
download | external_llvm-96c466b06ab0c830b07329c1b16037f585ccbe40.zip external_llvm-96c466b06ab0c830b07329c1b16037f585ccbe40.tar.gz external_llvm-96c466b06ab0c830b07329c1b16037f585ccbe40.tar.bz2 |
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 'include/llvm')
-rw-r--r-- | include/llvm/Analysis/CallGraph.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/DataStructure.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/DataStructure/DataStructure.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 20 | ||||
-rw-r--r-- | include/llvm/Analysis/FindUnsafePointerTypes.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/FindUsedTypes.h | 1 | ||||
-rw-r--r-- | include/llvm/Analysis/IntervalPartition.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Assembly/PrintModulePass.h | 4 | ||||
-rw-r--r-- | include/llvm/Bytecode/WriteBytecodePass.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/FunctionLiveVarInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Pass.h | 7 | ||||
-rw-r--r-- | include/llvm/Transforms/Scalar/InductionVars.h | 2 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h | 2 |
15 files changed, 52 insertions, 2 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 6169387..035d4ab 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -115,6 +115,8 @@ public: CallGraph(AnalysisID AID) : Root(0) { assert(AID == ID); } ~CallGraph() { destroy(); } + virtual const char *getPassName() const { return "Call Graph Construction"; } + // run - Compute the call graph for the specified module. virtual bool run(Module *TheModule); diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index 90a4b5d..f6b60b8 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -439,6 +439,8 @@ public: DataStructure(AnalysisID id) { assert(id == ID); } ~DataStructure() { releaseMemory(); } + virtual const char *getPassName() const { return "Data Structure Analysis"; } + // run - Do nothing, because methods are analyzed lazily virtual bool run(Module *TheModule) { return false; } diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index 90a4b5d..f6b60b8 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -439,6 +439,8 @@ public: DataStructure(AnalysisID id) { assert(id == ID); } ~DataStructure() { releaseMemory(); } + virtual const char *getPassName() const { return "Data Structure Analysis"; } + // run - Do nothing, because methods are analyzed lazily virtual bool run(Module *TheModule) { return false; } diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 3a29eec..e3038da 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -63,6 +63,11 @@ public: DominatorSet(AnalysisID id) : DominatorBase(id == PostDomID) {} + virtual const char *getPassName() const { + if (isPostDominator()) return "Post-Dominator Set Construction"; + else return "Dominator Set Construction"; + } + virtual bool runOnFunction(Function *F); // Accessor interface: @@ -115,6 +120,11 @@ public: ImmediateDominators(AnalysisID id) : DominatorBase(id == PostDomID) {} + virtual const char *getPassName() const { + if (isPostDominator()) return "Immediate Post-Dominators Construction"; + else return "Immediate Dominators Construction"; + } + virtual bool runOnFunction(Function *F) { IDoms.clear(); // Reset from the last time we were run... DominatorSet *DS; @@ -206,6 +216,11 @@ public: DominatorTree(AnalysisID id) : DominatorBase(id == PostDomID) {} ~DominatorTree() { reset(); } + virtual const char *getPassName() const { + if (isPostDominator()) return "Post-Dominator Tree Construction"; + else return "Dominator Tree Construction"; + } + virtual bool runOnFunction(Function *F) { reset(); DominatorSet *DS; @@ -262,6 +277,11 @@ public: DominanceFrontier(AnalysisID id) : DominatorBase(id == PostDomID) {} + virtual const char *getPassName() const { + if (isPostDominator()) return "Post-Dominance Frontier Construction"; + else return "Dominance Frontier Construction"; + } + virtual bool runOnFunction(Function *) { Frontiers.clear(); DominatorTree *DT; diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index 82cc28a..98f530c 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -30,6 +30,8 @@ public: FindUnsafePointerTypes(AnalysisID id) { assert(ID == id); } + virtual const char *getPassName() const { return "Find Unsafe Pointer Types";} + // Accessor for underlying type set... inline const std::set<PointerType*> &getUnsafeTypes() const { return UnsafeTypes; diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 5c02b2c..ece390e 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -24,6 +24,7 @@ public: static AnalysisID IncludeSymbolTableID; FindUsedTypes(AnalysisID id) : IncludeSymbolTables(id != ID) {} + virtual const char *getPassName() const { return "Find Used Types"; } // getTypes - After the pass has been run, return the set containing all of // the types used in the module. diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 281b32e..ab16250 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -39,6 +39,8 @@ public: IntervalPartition(AnalysisID AID) : RootInterval(0) { assert(AID == ID); } + const char *getPassName() const { return "Interval Partition Construction"; } + // run - Calculate the interval partition for this function virtual bool runOnFunction(Function *F); diff --git a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h index 4f7db3f..dab6d3c 100644 --- a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h +++ b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h @@ -105,6 +105,8 @@ public: FunctionLiveVarInfo(AnalysisID id = ID) { assert(id == ID); } + virtual const char *getPassName() const { return "Live Variable Analysis"; } + // --------- Implement the FunctionPass interface ---------------------- // runOnFunction - Perform analysis, update internal data structures. diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index b56de0f..bb9058c 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -72,6 +72,8 @@ public: LoopInfo(AnalysisID id) { assert(id == ID); } ~LoopInfo() { releaseMemory(); } + const char *getPassName() const { return "Natural Loop Analysis"; } + const std::vector<Loop*> &getTopLevelLoops() const { return TopLevelLoops; } // getLoopFor - Return the inner most loop that BB lives in. If a basic block diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h index 2d63e6d..83cd852 100644 --- a/include/llvm/Assembly/PrintModulePass.h +++ b/include/llvm/Assembly/PrintModulePass.h @@ -22,6 +22,8 @@ public: inline PrintModulePass(std::ostream *o = &std::cout, bool DS = false) : Out(o), DeleteStream(DS) { } + + const char *getPassName() const { return "Module Printer"; } inline ~PrintModulePass() { if (DeleteStream) delete Out; @@ -46,6 +48,8 @@ public: bool DS = false) : Banner(B), Out(o), DeleteStream(DS) { } + + const char *getPassName() const { return "Function Printer"; } inline ~PrintFunctionPass() { if (DeleteStream) delete Out; diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h index bd9d423..84e491a 100644 --- a/include/llvm/Bytecode/WriteBytecodePass.h +++ b/include/llvm/Bytecode/WriteBytecodePass.h @@ -19,6 +19,8 @@ public: : Out(o), DeleteStream(DS) { } + const char *getPassName() const { return "Bytecode Writer"; } + inline ~WriteBytecodePass() { if (DeleteStream) delete Out; } diff --git a/include/llvm/CodeGen/FunctionLiveVarInfo.h b/include/llvm/CodeGen/FunctionLiveVarInfo.h index 4f7db3f..dab6d3c 100644 --- a/include/llvm/CodeGen/FunctionLiveVarInfo.h +++ b/include/llvm/CodeGen/FunctionLiveVarInfo.h @@ -105,6 +105,8 @@ public: FunctionLiveVarInfo(AnalysisID id = ID) { assert(id == ID); } + virtual const char *getPassName() const { return "Live Variable Analysis"; } + // --------- Implement the FunctionPass interface ---------------------- // runOnFunction - Perform analysis, update internal data structures. diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index bd040b9..3c89130 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -41,6 +41,11 @@ public: inline Pass(AnalysisResolver *AR = 0) : Resolver(AR) {} inline virtual ~Pass() {} // Destructor is virtual so we can be subclassed + // getPassName - Return a nice clean name for a pass. This should be + // overloaded by the pass, but if it is not, C++ RTTI will be consulted to get + // a SOMEWHAT intelligable name for the pass. + // + virtual const char *getPassName() const; // run - Run this pass, returning true if a modification was made to the // module argument. This should be implemented by all concrete subclasses. @@ -312,6 +317,4 @@ protected: void setAnalysisResolver(Pass *P, AnalysisResolver *AR); }; - - #endif diff --git a/include/llvm/Transforms/Scalar/InductionVars.h b/include/llvm/Transforms/Scalar/InductionVars.h index 196bb1f..704617c 100644 --- a/include/llvm/Transforms/Scalar/InductionVars.h +++ b/include/llvm/Transforms/Scalar/InductionVars.h @@ -12,6 +12,8 @@ class IntervalPartition; struct InductionVariableCannonicalize : public FunctionPass { + const char *getPassName() const { return "**OLD IndVars ***"; } + // doInductionVariableCannonicalize - Simplify induction variables in loops // static bool doIt(Function *F, IntervalPartition &IP); diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h index a6f259a..6281c8a 100644 --- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h +++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h @@ -17,6 +17,8 @@ public: static AnalysisID ID; // Pass ID UnifyFunctionExitNodes(AnalysisID id = ID) : ExitNode(0) { assert(ID == id); } + virtual const char *getPassName() const { return "Unify Function Exit Nodes";} + // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new // BasicBlock, and converting all returns to unconditional branches to this // new basic block. The singular exit node is returned in ExitNode. |