aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-10-18 18:13:49 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-10-18 18:13:49 +0000
commitd8b5168a08e8c8cd906594fcccd78b075e2cd5d7 (patch)
tree4ed8d2dab1a64454deb4997e6e157d546a970d19 /include
parentc9a1de6d1b1a6700c6bb5f169e48c9ab337ae876 (diff)
downloadexternal_llvm-d8b5168a08e8c8cd906594fcccd78b075e2cd5d7.zip
external_llvm-d8b5168a08e8c8cd906594fcccd78b075e2cd5d7.tar.gz
external_llvm-d8b5168a08e8c8cd906594fcccd78b075e2cd5d7.tar.bz2
Add option to print per module instead of per method, so that
global declarations are also printed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Transforms/PrintModulePass.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/include/llvm/Transforms/PrintModulePass.h b/include/llvm/Transforms/PrintModulePass.h
index c8fb08f..9c3274e 100644
--- a/include/llvm/Transforms/PrintModulePass.h
+++ b/include/llvm/Transforms/PrintModulePass.h
@@ -16,31 +16,40 @@ class PrintModulePass : public Pass {
string Banner; // String to print before each method
ostream *Out; // ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
+ bool PrintPerMethod; // Print one method at a time rather than the whole?
bool PrintAsBytecode; // Print as bytecode rather than assembly?
public:
- inline PrintModulePass(const string &B, ostream *o = &cout, bool DS = false,
+ inline PrintModulePass(const string &B, ostream *o = &cout,
+ bool DS = false,
+ bool printPerMethod = true,
bool printAsBytecode = false)
- : Banner(B), Out(o), DeleteStream(DS), PrintAsBytecode(printAsBytecode) {}
-
+ : Banner(B), Out(o), DeleteStream(DS),
+ PrintPerMethod(printPerMethod), PrintAsBytecode(printAsBytecode) {
+ if (PrintAsBytecode)
+ PrintPerMethod = false;
+ }
+
~PrintModulePass() {
if (DeleteStream) delete Out;
}
-
+
// doPerMethodWork - This pass just prints a banner followed by the method as
// it's processed.
//
bool doPerMethodWork(Method *M) {
- if (! PrintAsBytecode)
+ if (PrintPerMethod)
(*Out) << Banner << M;
return false;
}
-
+
// doPassFinalization - Virtual method overriden by subclasses to do any post
// processing needed after all passes have run.
//
- bool doPassFinalization(Module *M) {
+ bool doPassFinalization(Module *module) {
if (PrintAsBytecode)
- WriteBytecodeToFile(M, *Out);
+ WriteBytecodeToFile(module, *Out);
+ else if (! PrintPerMethod)
+ (*Out) << Banner << module;
return false;
}
};