Added a stupid testcase for iterators.
authorChris Lattner <sabre@nondot.org>
Fri, 8 Jun 2001 00:35:25 +0000 (00:35 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 8 Jun 2001 00:35:25 +0000 (00:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt/opt.cpp

index a0cf140c4de53e38700bceea128585f2759709d5..ff513d75a31364b88e3edffa0e76361daedbde25 100644 (file)
 #include "llvm/Tools/CommandLine.h"
 #include "llvm/Opt/AllOpts.h"
 
+#if 1  // Testcase, TODO: REMOVE
+#include "llvm/CFG.h"
+#include "llvm/Assembly/Writer.h"
+#include "llvm/Method.h"
+static bool DoPrintM(Method *M) {
+  df_iterator I = df_begin(M->getBasicBlocks().front(), false);
+  df_iterator E = df_end(M->getBasicBlocks().front());
+  unsigned i = 0;
+  for (; I != E; ++I, ++i) {
+    cerr << "Basic Block Visited #" << i << *I;
+  }
+  return false;
+}
+
+static bool DoPrint(Module *C) {
+  return ApplyOptToAllMethods(C, DoPrintM);
+}
+#endif
+
 struct {
   const string ArgName, Name;
   bool (*OptPtr)(Module *C);
@@ -38,6 +57,7 @@ struct {
   { "-inline"   ,"Method Inlining",       DoMethodInlining      },
   { "-strip"    ,"Strip Symbols",         DoSymbolStripping     },
   { "-mstrip"   ,"Strip Module Symbols",  DoFullSymbolStripping },
+  { "-print"    ,"Test printing stuff",   DoPrint               },
 };
 
 int main(int argc, char **argv) {