[llvm-commits] CVS: reopt/tools/ttftest/ttftest.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Sat May 22 01:57:26 PDT 2004


Changes in directory reopt/tools/ttftest:

ttftest.cpp updated: 1.3 -> 1.4

---
Log message:

Add -q (quiet) flag, to suppress output unless it is absolutely necessary,
for the benefit of the test script.


---
Diffs of the changes:  (+12 -7)

Index: reopt/tools/ttftest/ttftest.cpp
diff -u reopt/tools/ttftest/ttftest.cpp:1.3 reopt/tools/ttftest/ttftest.cpp:1.4
--- reopt/tools/ttftest/ttftest.cpp:1.3	Wed May 19 03:44:44 2004
+++ reopt/tools/ttftest/ttftest.cpp	Sat May 22 01:56:41 2004
@@ -33,6 +33,7 @@
     cl::desc("Name of file containing trace"), cl::value_desc("traceFileName"));
   cl::opt<std::string> BytecodeFile("bc",
     cl::desc("Name of file containing module"), cl::value_desc("bytecodeFileName"));
+  cl::opt<bool> Quiet("q", cl::desc("Be quiet"), cl::init(false));
 };
 
 /// getBasicBlockByNum - Returns the basic block in F whose index is
@@ -66,17 +67,19 @@
                 + "' not found in module";
     return 0;
   }
-  std::cerr << "Function name: '" << functionName << "'\n" << "Basic blocks: ";
+  if (!Quiet)
+    std::cerr << "Function name: '" << functionName << "'\n"
+              << "Basic blocks: ";
   std::vector<BasicBlock *> vBB;
   do {
     int basicBlockNum;
     in >> basicBlockNum;
     if (!in.eof ()) {
-      std::cerr << basicBlockNum << " ";
+      if (!Quiet) std::cerr << basicBlockNum << " ";
       vBB.push_back (getBasicBlockByNum (F, basicBlockNum));
     }
   } while (!in.eof ());
-  std::cerr << "\n";
+  if (!Quiet) std::cerr << "\n";
   return new Trace (vBB);
 }
 
@@ -115,14 +118,16 @@
 
   // Run TraceToFunction on the Trace.
   TraceFunction *TF = TraceFunction::get (*T);
-  std::cerr << *TF->TraceFn << "\n\n";
+  if (!Quiet) { std::cerr << *TF->TraceFn << "\n\n"; }
 
   // Run the LLVM Verifier on the resulting TraceFunction.
-  if (verifyFunction (*TF->TraceFn, PrintMessageAction)) {
-    std::cerr << "Verifier fails.\n";
+  VerifierFailureAction action =
+    (Quiet ? ReturnStatusAction : PrintMessageAction);
+  if (verifyFunction (*TF->TraceFn, action)) {
+    if (!Quiet) { std::cerr << "Verifier fails.\n"; }
     exit (1);
   } else {
-    std::cerr << "Verifier passes.\n";
+    if (!Quiet) { std::cerr << "Verifier passes.\n"; }
     exit (0);
   }
 }





More information about the llvm-commits mailing list