aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/Writer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-06-21 05:27:22 +0000
committerChris Lattner <sabre@nondot.org>2001-06-21 05:27:22 +0000
commitda956802bd8b789f0769960083f718bface44f6f (patch)
tree60cc6194d58bea4f522b5bc33f5adfdc0d0a84a0 /lib/Analysis/Writer.cpp
parent1c54f1da79a68b22cb093f5bfaed3f8bbdc2b966 (diff)
Moved printing code to the Assembly/Writer library.
Code now detects looping intervals git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/Writer.cpp')
-rw-r--r--lib/Analysis/Writer.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Analysis/Writer.cpp b/lib/Analysis/Writer.cpp
new file mode 100644
index 0000000000..3abe70a7df
--- /dev/null
+++ b/lib/Analysis/Writer.cpp
@@ -0,0 +1,28 @@
+//===-- IntervalWriter.cpp - Library for printing Intervals ------*- C++ -*--=//
+//
+// This library implements the interval printing functionality defined in
+// llvm/Assembly/Writer.h
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Assembly/Writer.h"
+#include "llvm/Analysis/Intervals.h"
+#include <iterator>
+#include <algorithm>
+
+void cfg::WriteToOutput(const Interval *I, ostream &o) {
+ o << "-------------------------------------------------------------\n"
+ << "Interval Contents:\n";
+
+ // Print out all of the basic blocks in the interval...
+ copy(I->Nodes.begin(), I->Nodes.end(),
+ ostream_iterator<BasicBlock*>(o, "\n"));
+
+ o << "Interval Predecessors:\n";
+ copy(I->Predecessors.begin(), I->Predecessors.end(),
+ ostream_iterator<BasicBlock*>(o, "\n"));
+
+ o << "Interval Successors:\n";
+ copy(I->Successors.begin(), I->Successors.end(),
+ ostream_iterator<BasicBlock*>(o, "\n"));
+}