diff options
author | Tobias Grosser <tobias@grosser.es> | 2015-12-17 12:48:25 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2015-12-17 12:48:25 +0000 |
commit | a0fbd39f83069bd3222fd0de05bc25726b2673c5 (patch) | |
tree | 363d7d41e96bfdc2509c0a3383da029e90f2ded2 | |
parent | e05899b5e9b1c0daac73f94a829d31e8299311f0 (diff) | |
download | bcm5719-llvm-a0fbd39f83069bd3222fd0de05bc25726b2673c5.tar.gz bcm5719-llvm-a0fbd39f83069bd3222fd0de05bc25726b2673c5.zip |
DOTGraphTraits: Allow the decision to show a graph to consider the analysis
The method processFunction() is called to decide if a graph should be shown for
a certain function. To allow DOTGraphTraitViewers to take this decision based
on the analysis results for the given function, we forward a reference to the
analysis result. This will be used by Polly to only visualize functions where
interesting loop regions have been detected.
llvm-svn: 255889
-rw-r--r-- | llvm/include/llvm/Analysis/DOTGraphTraitsPass.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h index 3b2c0cb2b15..ca50ee2f829 100644 --- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h +++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h @@ -40,15 +40,19 @@ public: /// /// An implementation of this class my override this function to indicate that /// only certain functions should be viewed. - virtual bool processFunction(Function &F) { + /// + /// @param Analysis The current analysis result for this function. + virtual bool processFunction(Function &F, AnalysisT &Analysis) { return true; } bool runOnFunction(Function &F) override { - if (!processFunction(F)) + auto &Analysis = getAnalysis<AnalysisT>(); + + if (!processFunction(F, Analysis)) return false; - GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>()); + GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis); std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph); std::string Title = GraphName + " for '" + F.getName().str() + "' function"; @@ -78,15 +82,19 @@ public: /// /// An implementation of this class my override this function to indicate that /// only certain functions should be printed. - virtual bool processFunction(Function &F) { + /// + /// @param Analysis The current analysis result for this function. + virtual bool processFunction(Function &F, AnalysisT &Analysis) { return true; } bool runOnFunction(Function &F) override { - if (!processFunction(F)) + auto &Analysis = getAnalysis<AnalysisT>(); + + if (!processFunction(F, Analysis)) return false; - GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>()); + GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis); std::string Filename = Name + "." + F.getName().str() + ".dot"; std::error_code EC; |