forked from OSchip/llvm-project
ScopGraphPrinter: Only show functions that contain at least one scop
When running 'clang -O3 -mllvm -polly -mllvm -polly-show' we now only show the CFGs of functions with at least one detected scop. For larger files/projects this reduces the number of graphs printed significantly and is likely what developers want to see. The new option -polly-view-all enforces all graphs to be printed and the exiting option -poll-view-only limites the graph printing to functions that match a certain pattern. This patch requires https://llvm.org/svn/llvm-project/llvm/trunk@255889 (and vice versa) to compile correctly. llvm-svn: 255891
This commit is contained in:
parent
71ebc691f6
commit
eb2eebe486
|
@ -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 == "")
|
||||
bool processFunction(Function &F, ScopDetection &SD) override {
|
||||
if (ViewFilter != "" && !F.getName().count(ViewFilter))
|
||||
return false;
|
||||
|
||||
if (ViewAll)
|
||||
return true;
|
||||
|
||||
if (F.getName().count(ViewFilter))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
// Check that at least one scop was detected.
|
||||
return std::distance(SD.begin(), SD.end()) > 0;
|
||||
}
|
||||
};
|
||||
char ScopViewer::ID = 0;
|
||||
|
|
Loading…
Reference in New Issue