[llvm] r255889 - DOTGraphTraits: Allow the decision to show a graph to consider the analysis
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 17 04:48:26 PST 2015
Author: grosser
Date: Thu Dec 17 06:48:25 2015
New Revision: 255889
URL: http://llvm.org/viewvc/llvm-project?rev=255889&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h
Modified: llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h?rev=255889&r1=255888&r2=255889&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h (original)
+++ llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h Thu Dec 17 06:48:25 2015
@@ -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;
More information about the llvm-commits
mailing list