[polly] r243882 - Add option -polly-view-only

Tobias Grosser tobias at grosser.es
Mon Aug 3 09:39:56 PDT 2015


Author: grosser
Date: Mon Aug  3 11:39:56 2015
New Revision: 243882

URL: http://llvm.org/viewvc/llvm-project?rev=243882&view=rev
Log:
Add option -polly-view-only

If set, this option instructs -view-scops and -polly-show to only print
functions that contain the specified string in their name. This allows to
look at the scops of a specific function in a large .ll file, without flooding
the screen with .dot graphs.

Modified:
    polly/trunk/lib/Analysis/ScopGraphPrinter.cpp

Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=243882&r1=243881&r2=243882&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Mon Aug  3 11:39:56 2015
@@ -20,9 +20,14 @@
 #include "llvm/Analysis/DOTGraphTraitsPass.h"
 #include "llvm/Analysis/RegionInfo.h"
 #include "llvm/Analysis/RegionIterator.h"
+#include "llvm/Support/CommandLine.h"
 
 using namespace polly;
 using namespace llvm;
+static cl::opt<std::string>
+    ViewFilter("polly-view-only",
+               cl::desc("Only view functions that match this pattern"),
+               cl::Hidden, cl::init(""), cl::ZeroOrMore);
 
 namespace llvm {
 template <>
@@ -173,6 +178,15 @@ struct DOTGraphTraits<ScopDetection *> :
 struct ScopViewer : public DOTGraphTraitsViewer<ScopDetection, false> {
   static char ID;
   ScopViewer() : DOTGraphTraitsViewer<ScopDetection, false>("scops", ID) {}
+  bool processFunction(Function &F) override {
+    if (ViewFilter == "")
+      return true;
+
+    if (F.getName().count(ViewFilter))
+      return true;
+
+    return false;
+  }
 };
 char ScopViewer::ID = 0;
 





More information about the llvm-commits mailing list