diff options
-rw-r--r-- | polly/lib/Analysis/ScopGraphPrinter.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/polly/lib/Analysis/ScopGraphPrinter.cpp b/polly/lib/Analysis/ScopGraphPrinter.cpp index ba8d1443188..c37cf035c11 100644 --- a/polly/lib/Analysis/ScopGraphPrinter.cpp +++ b/polly/lib/Analysis/ScopGraphPrinter.cpp @@ -29,6 +29,11 @@ static cl::opt<std::string> cl::desc("Only view functions that match this pattern"), cl::Hidden, cl::init(""), cl::ZeroOrMore); +static cl::opt<bool> + ViewAll("polly-view-all", + cl::desc("Also show functions without any scops"), + cl::Hidden, cl::init(false), cl::ZeroOrMore); + namespace llvm { template <> struct GraphTraits<ScopDetection *> : public GraphTraits<RegionInfo *> { @@ -178,14 +183,15 @@ struct DOTGraphTraits<ScopDetection *> : public DOTGraphTraits<RegionNode *> { struct ScopViewer : public DOTGraphTraitsViewer<ScopDetection, false> { static char ID; ScopViewer() : DOTGraphTraitsViewer<ScopDetection, false>("scops", ID) {} - bool processFunction(Function &F) override { - if (ViewFilter == "") - return true; + bool processFunction(Function &F, ScopDetection &SD) override { + if (ViewFilter != "" && !F.getName().count(ViewFilter)) + return false; - if (F.getName().count(ViewFilter)) + if (ViewAll) return true; - return false; + // Check that at least one scop was detected. + return std::distance(SD.begin(), SD.end()) > 0; } }; char ScopViewer::ID = 0; |