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

Brian Gaeke gaeke at cs.uiuc.edu
Mon Nov 8 12:59:50 PST 2004



Changes in directory reopt/tools/ttftest:

ttftest.cpp updated: 1.9 -> 1.10
---
Log message:

Add an option to print out the # of uses of each arg (live-in or
live-out).  This makes it easy to find dead args that we're
generating.


---
Diffs of the changes:  (+15 -0)

Index: reopt/tools/ttftest/ttftest.cpp
diff -u reopt/tools/ttftest/ttftest.cpp:1.9 reopt/tools/ttftest/ttftest.cpp:1.10
--- reopt/tools/ttftest/ttftest.cpp:1.9	Thu Sep  2 11:55:46 2004
+++ reopt/tools/ttftest/ttftest.cpp	Mon Nov  8 14:59:40 2004
@@ -36,6 +36,8 @@
   cl::opt<bool> PrintLiveSets("print-live",
     cl::desc("Print live-in/out sets to stdout"), cl::init(false));
   cl::opt<bool> Quiet("q", cl::desc("Be quiet"), cl::init(false));
+  cl::opt<bool> PrintArgUses("print-arguses",
+    cl::desc("Print # uses of each arg"), cl::init(false));
 };
 
 void printLiveSet (std::ostream &OS, const std::string Banner,
@@ -72,6 +74,16 @@
   printLiveSet (std::cout, "Live-out set:\n", TF->LiveOutVector, TF);
 }
 
+void printArgUses (TraceFunction *TF) {
+  unsigned acount = 0;
+  for (Function::aiterator i = TF->TraceFn->abegin (), e = TF->TraceFn->aend ();
+       i != e; ++i) {
+    Argument &a (*i);
+    std::cout << "Argument #" << acount << " (" << a << ") has " << a.use_size() << " uses\n";
+    ++acount;
+  }
+}
+
 int main (int argc, char **argv) {
   // Get command line arguments.
   cl::ParseCommandLineOptions(argc, argv, " trace-to-function tester\n");
@@ -110,5 +122,8 @@
   if (PrintLiveSets)
     printLiveSets (TF);
 
+  if (PrintArgUses)
+    printArgUses (TF);
+
   return 0;
 }






More information about the llvm-commits mailing list