summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-06-08 00:35:25 +0000
committerChris Lattner <sabre@nondot.org>2001-06-08 00:35:25 +0000
commit84608e43b25a99862f424487c97b1f9842a7d6e5 (patch)
tree1906fa083b53c438fdd63ed4903572feadabff65 /tools
parentd842e77ca9b85cc98355d15374c5c4198aba7f84 (diff)
downloadllvm-84608e43b25a99862f424487c97b1f9842a7d6e5.tar.gz
llvm-84608e43b25a99862f424487c97b1f9842a7d6e5.tar.bz2
llvm-84608e43b25a99862f424487c97b1f9842a7d6e5.tar.xz
Added a stupid testcase for iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/opt.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index a0cf140c4d..ff513d75a3 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -29,6 +29,25 @@
#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) {