[llvm-commits] CVS: llvm/tools/llvm-dis/llvm-dis.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 6 20:39:51 PST 2007
Changes in directory llvm/tools/llvm-dis:
llvm-dis.cpp updated: 1.54 -> 1.55
---
Log message:
add an option for timing bc file reading.
---
Diffs of the changes: (+12 -5)
llvm-dis.cpp | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
Index: llvm/tools/llvm-dis/llvm-dis.cpp
diff -u llvm/tools/llvm-dis/llvm-dis.cpp:1.54 llvm/tools/llvm-dis/llvm-dis.cpp:1.55
--- llvm/tools/llvm-dis/llvm-dis.cpp:1.54 Wed Dec 6 19:30:31 2006
+++ llvm/tools/llvm-dis/llvm-dis.cpp Tue Feb 6 22:39:35 2007
@@ -39,6 +39,9 @@
static cl::opt<bool>
Force("f", cl::desc("Overwrite output files"));
+static cl::opt<bool>
+DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
+
int main(int argc, char **argv) {
llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
try {
@@ -58,7 +61,9 @@
return 1;
}
- if (OutputFilename != "") { // Specified an output filename?
+ if (DontPrint) {
+ // Just use stdout. We won't actually print anything on it.
+ } else if (OutputFilename != "") { // Specified an output filename?
if (OutputFilename != "-") { // Not stdout?
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
@@ -102,10 +107,12 @@
}
// All that llvm-dis does is write the assembly to a file.
- PassManager Passes;
- OStream L(*Out);
- Passes.add(new PrintModulePass(&L));
- Passes.run(*M.get());
+ if (!DontPrint) {
+ PassManager Passes;
+ OStream L(*Out);
+ Passes.add(new PrintModulePass(&L));
+ Passes.run(*M.get());
+ }
if (Out != &std::cout) {
((std::ofstream*)Out)->close();
More information about the llvm-commits
mailing list