[llvm-commits] CVS: llvm/lib/Analysis/CFGPrinter.cpp
Dan Gohman
djg at cray.com
Mon May 14 07:25:25 PDT 2007
Changes in directory llvm/lib/Analysis:
CFGPrinter.cpp updated: 1.26 -> 1.27
---
Log message:
Add passes -view-cfg and -view-cfg-only that are like -print-cfg and
-print-cfg-only except they use the ViewCFG function, which displays the
CFG rendered with graphviz with gv.
---
Diffs of the changes: (+42 -0)
CFGPrinter.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+)
Index: llvm/lib/Analysis/CFGPrinter.cpp
diff -u llvm/lib/Analysis/CFGPrinter.cpp:1.26 llvm/lib/Analysis/CFGPrinter.cpp:1.27
--- llvm/lib/Analysis/CFGPrinter.cpp:1.26 Sun May 6 08:37:16 2007
+++ llvm/lib/Analysis/CFGPrinter.cpp Mon May 14 09:25:08 2007
@@ -90,6 +90,48 @@
}
namespace {
+ struct VISIBILITY_HIDDEN CFGViewer : public FunctionPass {
+ static char ID; // Pass identifcation, replacement for typeid
+ CFGViewer() : FunctionPass((intptr_t)&ID) {}
+
+ virtual bool runOnFunction(Function &F) {
+ F.viewCFG();
+ return false;
+ }
+
+ void print(std::ostream &OS, const Module* = 0) const {}
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+ };
+
+ char CFGViewer::ID = 0;
+ RegisterPass<CFGViewer> V0("view-cfg",
+ "View CFG of function");
+
+ struct VISIBILITY_HIDDEN CFGOnlyViewer : public FunctionPass {
+ static char ID; // Pass identifcation, replacement for typeid
+ CFGOnlyViewer() : FunctionPass((intptr_t)&ID) {}
+
+ virtual bool runOnFunction(Function &F) {
+ CFGOnly = true;
+ F.viewCFG();
+ CFGOnly = false;
+ return false;
+ }
+
+ void print(std::ostream &OS, const Module* = 0) const {}
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+ };
+
+ char CFGOnlyViewer::ID = 0;
+ RegisterPass<CFGOnlyViewer> V1("view-cfg-only",
+ "View CFG of function (with no function bodies)");
+
struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
static char ID; // Pass identification, replacement for typeid
CFGPrinter() : FunctionPass((intptr_t)&ID) {}
More information about the llvm-commits
mailing list