summaryrefslogtreecommitdiff
path: root/tools/analyze
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-29 14:57:45 +0000
committerChris Lattner <sabre@nondot.org>2002-04-29 14:57:45 +0000
commit96c466b06ab0c830b07329c1b16037f585ccbe40 (patch)
treee07bbfb58ede2e61ef3243a083dbe5da3b47d712 /tools/analyze
parent691fa3cfb12f459b953dd400057841b10ccf4b72 (diff)
downloadllvm-96c466b06ab0c830b07329c1b16037f585ccbe40.tar.gz
llvm-96c466b06ab0c830b07329c1b16037f585ccbe40.tar.bz2
llvm-96c466b06ab0c830b07329c1b16037f585ccbe40.tar.xz
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 'tools/analyze')
-rw-r--r--tools/analyze/analyze.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp
index 6de3738470..7dbd3b7d1b 100644
--- a/tools/analyze/analyze.cpp
+++ b/tools/analyze/analyze.cpp
@@ -83,6 +83,8 @@ class PassPrinter<Pass, PassName> : public Pass {
const AnalysisID ID;
public:
PassPrinter(const string &M, AnalysisID id) : Message(M), ID(id) {}
+
+ const char *getPassName() const { return "IP Pass Printer"; }
virtual bool run(Module *M) {
std::cout << Message << "\n";
@@ -101,6 +103,8 @@ class PassPrinter<FunctionPass, PassName> : public FunctionPass {
const AnalysisID ID;
public:
PassPrinter(const string &M, AnalysisID id) : Message(M), ID(id) {}
+
+ const char *getPassName() const { return "Function Pass Printer"; }
virtual bool runOnFunction(Function *F) {
std::cout << Message << " on function '" << F->getName() << "'\n";
@@ -134,6 +138,8 @@ Pass *createPrintModulePass(const string &Message) {
}
struct InstForest : public FunctionPass {
+ const char *getPassName() const { return "InstForest Printer"; }
+
void doit(Function *F) {
std::cout << analysis::InstForest<char>(F);
}
@@ -144,6 +150,8 @@ struct InstForest : public FunctionPass {
};
struct IndVars : public FunctionPass {
+ const char *getPassName() const { return "IndVars Printer"; }
+
void doit(Function *F) {
LoopInfo &LI = getAnalysis<LoopInfo>();
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
@@ -161,6 +169,8 @@ struct IndVars : public FunctionPass {
};
struct Exprs : public FunctionPass {
+ const char *getPassName() const { return "Expression Printer"; }
+
static void doit(Function *F) {
std::cout << "Classified expressions for: " << F->getName() << "\n";
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
@@ -199,7 +209,7 @@ class PrinterPass : public TraitClass {
const string Message;
public:
PrinterPass(const string &M) : Message(M) {}
-
+
virtual bool runOnFunction(Function *F) {
std::cout << Message << " on function '" << F->getName() << "'\n";