mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37033 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2703f23304
commit
a196b993e0
@ -90,6 +90,48 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
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 {
|
struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
CFGPrinter() : FunctionPass((intptr_t)&ID) {}
|
CFGPrinter() : FunctionPass((intptr_t)&ID) {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user