summaryrefslogtreecommitdiff
path: root/tools/opt
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-11-26 04:19:30 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-11-26 04:19:30 +0000
commit54fec07ec00b4449393a66e8e2e62fd241781f80 (patch)
tree6bbf30c8cf3c092fe0c5035e0705c6aa912eada3 /tools/opt
parentbdd300b22cec875c3400378b1badd943988b3f9d (diff)
downloadllvm-54fec07ec00b4449393a66e8e2e62fd241781f80.tar.gz
llvm-54fec07ec00b4449393a66e8e2e62fd241781f80.tar.bz2
llvm-54fec07ec00b4449393a66e8e2e62fd241781f80.tar.xz
[PM] Split the CallGraph out from the ModulePass which creates the
CallGraph. This makes the CallGraph a totally generic analysis object that is the container for the graph data structure and the primary interface for querying and manipulating it. The pass logic is separated into its own class. For compatibility reasons, the pass provides wrapper methods for most of the methods on CallGraph -- they all just forward. This will allow the new pass manager infrastructure to provide its own analysis pass that constructs the same CallGraph object and makes it available. The idea is that in the new pass manager, the analysis pass's 'run' method returns a concrete analysis 'result'. Here, that result is a 'CallGraph'. The 'run' method will typically do only minimal work, deferring much of the work into the implementation of the result object in order to be lazy about computing things, but when (like DomTree) there is *some* up-front computation, the analysis does it prior to handing the result back to the querying pass. I know some of this is fairly ugly. I'm happy to change it around if folks can suggest a cleaner interim state, but there is going to be some amount of unavoidable ugliness during the transition period. The good thing is that this is very limited and will naturally go away when the old pass infrastructure goes away. It won't hang around to bother us later. Next up is the initial new-PM-style call graph analysis. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/AnalysisWrappers.cpp4
-rw-r--r--tools/opt/PrintSCC.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp
index 55f544ff5e..047a82b515 100644
--- a/tools/opt/AnalysisWrappers.cpp
+++ b/tools/opt/AnalysisWrappers.cpp
@@ -80,10 +80,10 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
- AU.addRequiredTransitive<CallGraph>();
+ AU.addRequiredTransitive<CallGraphWrapperPass>();
}
virtual bool runOnModule(Module &M) {
- getAnalysis<CallGraph>().print(errs(), &M);
+ getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
return false;
}
};
diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp
index a502fa743c..348b5f21ce 100644
--- a/tools/opt/PrintSCC.cpp
+++ b/tools/opt/PrintSCC.cpp
@@ -58,7 +58,7 @@ namespace {
// getAnalysisUsage - This pass requires the CallGraph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
- AU.addRequired<CallGraph>();
+ AU.addRequired<CallGraphWrapperPass>();
}
};
}
@@ -92,7 +92,7 @@ bool CFGSCC::runOnFunction(Function &F) {
// run - Print out SCCs in the call graph for the specified module.
bool CallGraphSCC::runOnModule(Module &M) {
- CallGraphNode* rootNode = getAnalysis<CallGraph>().getRoot();
+ CallGraphNode *rootNode = getAnalysis<CallGraphWrapperPass>().getRoot();
unsigned sccNum = 0;
errs() << "SCCs for the program in PostOrder:";
for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode),