mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
Add analysis pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1182 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include "llvm/Analysis/IntervalPartition.h"
|
#include "llvm/Analysis/IntervalPartition.h"
|
||||||
#include "llvm/Analysis/Expressions.h"
|
#include "llvm/Analysis/Expressions.h"
|
||||||
#include "llvm/Analysis/CallGraph.h"
|
#include "llvm/Analysis/CallGraph.h"
|
||||||
|
#include "llvm/Analysis/FindUnsafePointerTypes.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
static void PrintMethod(Method *M) {
|
static void PrintMethod(Method *M) {
|
||||||
@@ -68,6 +69,12 @@ static void PrintCallGraph(Module *M) {
|
|||||||
cout << cfg::CallGraph(M);
|
cout << cfg::CallGraph(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PrintUnsafePtrTypes(Module *M) {
|
||||||
|
FindUnsafePointerTypes FUPT;
|
||||||
|
FUPT.run(M);
|
||||||
|
FUPT.printResults(M, cout);
|
||||||
|
}
|
||||||
|
|
||||||
static void PrintDominatorSets(Method *M) {
|
static void PrintDominatorSets(Method *M) {
|
||||||
cout << cfg::DominatorSet(M);
|
cout << cfg::DominatorSet(M);
|
||||||
}
|
}
|
||||||
@@ -97,7 +104,7 @@ static void PrintPostDomFrontier(Method *M) {
|
|||||||
|
|
||||||
enum Ans {
|
enum Ans {
|
||||||
PassDone, // Unique Marker
|
PassDone, // Unique Marker
|
||||||
print, intervals, exprclassify, instforest, callgraph,
|
print, intervals, exprclassify, instforest, callgraph, unsafepointertypes,
|
||||||
domset, idom, domtree, domfrontier,
|
domset, idom, domtree, domfrontier,
|
||||||
postdomset, postidom, postdomtree, postdomfrontier,
|
postdomset, postidom, postdomtree, postdomfrontier,
|
||||||
};
|
};
|
||||||
@@ -111,6 +118,7 @@ cl::EnumList<enum Ans> AnalysesList(cl::NoFlags,
|
|||||||
clEnumVal(exprclassify , "Classify Expressions"),
|
clEnumVal(exprclassify , "Classify Expressions"),
|
||||||
clEnumVal(instforest , "Print Instruction Forest"),
|
clEnumVal(instforest , "Print Instruction Forest"),
|
||||||
clEnumVal(callgraph , "Print Call Graph"),
|
clEnumVal(callgraph , "Print Call Graph"),
|
||||||
|
clEnumVal(unsafepointertypes, "Print Unsafe Pointer Types"),
|
||||||
|
|
||||||
clEnumVal(domset , "Print Dominator Sets"),
|
clEnumVal(domset , "Print Dominator Sets"),
|
||||||
clEnumVal(idom , "Print Immediate Dominators"),
|
clEnumVal(idom , "Print Immediate Dominators"),
|
||||||
@@ -145,6 +153,7 @@ struct {
|
|||||||
|
|
||||||
pair<enum Ans, void (*)(Module *)> ModAnTable[] = {
|
pair<enum Ans, void (*)(Module *)> ModAnTable[] = {
|
||||||
pair<enum Ans, void (*)(Module *)>(callgraph , PrintCallGraph),
|
pair<enum Ans, void (*)(Module *)>(callgraph , PrintCallGraph),
|
||||||
|
pair<enum Ans, void (*)(Module *)>(unsafepointertypes, PrintUnsafePtrTypes),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user