Coverage Report

Created: 2018-07-19 03:59

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
Line
Count
Source (jump to first uncovered line)
1
//===-- DOTGraphTraitsPass.h - Print/View dotty graphs-----------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// Templates to create dotty viewer and printer passes for GraphTraits graphs.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_ANALYSIS_DOTGRAPHTRAITSPASS_H
15
#define LLVM_ANALYSIS_DOTGRAPHTRAITSPASS_H
16
17
#include "llvm/Analysis/CFGPrinter.h"
18
#include "llvm/Pass.h"
19
#include "llvm/Support/FileSystem.h"
20
21
namespace llvm {
22
23
/// Default traits class for extracting a graph from an analysis pass.
24
///
25
/// This assumes that 'GraphT' is 'AnalysisT *' and so just passes it through.
26
template <typename AnalysisT, typename GraphT = AnalysisT *>
27
struct DefaultAnalysisGraphTraits {
28
1
  static GraphT getGraph(AnalysisT *A) { return A; }
29
};
30
31
template <
32
    typename AnalysisT, bool IsSimple, typename GraphT = AnalysisT *,
33
    typename AnalysisGraphTraitsT = DefaultAnalysisGraphTraits<AnalysisT, GraphT> >
34
class DOTGraphTraitsViewer : public FunctionPass {
35
public:
36
  DOTGraphTraitsViewer(StringRef GraphName, char &ID)
37
0
      : FunctionPass(ID), Name(GraphName) {}
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::DOTGraphTraitsViewer(llvm::StringRef, char&)
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::DOTGraphTraitsViewer(llvm::StringRef, char&)
38
39
  /// Return true if this function should be processed.
40
  ///
41
  /// An implementation of this class my override this function to indicate that
42
  /// only certain functions should be viewed.
43
  ///
44
  /// @param Analysis The current analysis result for this function.
45
0
  virtual bool processFunction(Function &F, AnalysisT &Analysis) {
46
0
    return true;
47
0
  }
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::DominatorTreeWrapperPass&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::DominatorTreeWrapperPass&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::PostDominatorTreeWrapperPass&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::PostDominatorTreeWrapperPass&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::processFunction(llvm::Function&, llvm::RegionInfoPass&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::processFunction(llvm::Function&, llvm::RegionInfoPass&)
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::processFunction(llvm::Function&, polly::ScopDetectionWrapperPass&)
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::processFunction(llvm::Function&, polly::ScopDetectionWrapperPass&)
48
49
0
  bool runOnFunction(Function &F) override {
50
0
    auto &Analysis = getAnalysis<AnalysisT>();
51
0
52
0
    if (!processFunction(F, Analysis))
53
0
      return false;
54
0
55
0
    GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis);
56
0
    std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
57
0
    std::string Title = GraphName + " for '" + F.getName().str() + "' function";
58
0
59
0
    ViewGraph(Graph, Name, IsSimple, Title);
60
0
61
0
    return false;
62
0
  }
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::runOnFunction(llvm::Function&)
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::runOnFunction(llvm::Function&)
63
64
0
  void getAnalysisUsage(AnalysisUsage &AU) const override {
65
0
    AU.setPreservesAll();
66
0
    AU.addRequired<AnalysisT>();
67
0
  }
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsViewer<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: llvm::DOTGraphTraitsViewer<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::getAnalysisUsage(llvm::AnalysisUsage&) const
68
69
private:
70
  std::string Name;
71
};
72
73
template <
74
    typename AnalysisT, bool IsSimple, typename GraphT = AnalysisT *,
75
    typename AnalysisGraphTraitsT = DefaultAnalysisGraphTraits<AnalysisT, GraphT> >
76
class DOTGraphTraitsPrinter : public FunctionPass {
77
public:
78
  DOTGraphTraitsPrinter(StringRef GraphName, char &ID)
79
1
      : FunctionPass(ID), Name(GraphName) {}
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsPrinter(llvm::StringRef, char&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsPrinter(llvm::StringRef, char&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsPrinter(llvm::StringRef, char&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::DOTGraphTraitsPrinter(llvm::StringRef, char&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::DOTGraphTraitsPrinter(llvm::StringRef, char&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::DOTGraphTraitsPrinter(llvm::StringRef, char&)
llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::DOTGraphTraitsPrinter(llvm::StringRef, char&)
Line
Count
Source
79
1
      : FunctionPass(ID), Name(GraphName) {}
Unexecuted instantiation: llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::DOTGraphTraitsPrinter(llvm::StringRef, char&)
80
81
  /// Return true if this function should be processed.
82
  ///
83
  /// An implementation of this class my override this function to indicate that
84
  /// only certain functions should be printed.
85
  ///
86
  /// @param Analysis The current analysis result for this function.
87
1
  virtual bool processFunction(Function &F, AnalysisT &Analysis) {
88
1
    return true;
89
1
  }
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::DominatorTreeWrapperPass&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::DominatorTreeWrapperPass&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::PostDominatorTreeWrapperPass&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::processFunction(llvm::Function&, llvm::PostDominatorTreeWrapperPass&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::processFunction(llvm::Function&, llvm::RegionInfoPass&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::processFunction(llvm::Function&, llvm::RegionInfoPass&)
llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::processFunction(llvm::Function&, polly::ScopDetectionWrapperPass&)
Line
Count
Source
87
1
  virtual bool processFunction(Function &F, AnalysisT &Analysis) {
88
1
    return true;
89
1
  }
Unexecuted instantiation: llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::processFunction(llvm::Function&, polly::ScopDetectionWrapperPass&)
90
91
1
  bool runOnFunction(Function &F) override {
92
1
    auto &Analysis = getAnalysis<AnalysisT>();
93
1
94
1
    if (!processFunction(F, Analysis))
95
0
      return false;
96
1
97
1
    GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis);
98
1
    std::string Filename = Name + "." + F.getName().str() + ".dot";
99
1
    std::error_code EC;
100
1
101
1
    errs() << "Writing '" << Filename << "'...";
102
1
103
1
    raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
104
1
    std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
105
1
    std::string Title = GraphName + " for '" + F.getName().str() + "' function";
106
1
107
1
    if (!EC)
108
1
      WriteGraph(File, Graph, IsSimple, Title);
109
0
    else
110
0
      errs() << "  error opening file for writing!";
111
1
    errs() << "\n";
112
1
113
1
    return false;
114
1
  }
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::runOnFunction(llvm::Function&)
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::runOnFunction(llvm::Function&)
llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::runOnFunction(llvm::Function&)
Line
Count
Source
91
1
  bool runOnFunction(Function &F) override {
92
1
    auto &Analysis = getAnalysis<AnalysisT>();
93
1
94
1
    if (!processFunction(F, Analysis))
95
0
      return false;
96
1
97
1
    GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis);
98
1
    std::string Filename = Name + "." + F.getName().str() + ".dot";
99
1
    std::error_code EC;
100
1
101
1
    errs() << "Writing '" << Filename << "'...";
102
1
103
1
    raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
104
1
    std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
105
1
    std::string Title = GraphName + " for '" + F.getName().str() + "' function";
106
1
107
1
    if (!EC)
108
1
      WriteGraph(File, Graph, IsSimple, Title);
109
0
    else
110
0
      errs() << "  error opening file for writing!";
111
1
    errs() << "\n";
112
1
113
1
    return false;
114
1
  }
Unexecuted instantiation: llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::runOnFunction(llvm::Function&)
115
116
1
  void getAnalysisUsage(AnalysisUsage &AU) const override {
117
1
    AU.setPreservesAll();
118
1
    AU.addRequired<AnalysisT>();
119
1
  }
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, false, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::DominatorTreeWrapperPass, true, llvm::DominatorTree*, (anonymous namespace)::DominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, false, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: DomPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::PostDominatorTreeWrapperPass, true, llvm::PostDominatorTree*, (anonymous namespace)::PostDominatorTreeWrapperPassAnalysisGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, false, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
Unexecuted instantiation: RegionPrinter.cpp:llvm::DOTGraphTraitsPrinter<llvm::RegionInfoPass, true, llvm::RegionInfo*, (anonymous namespace)::RegionInfoPassGraphTraits>::getAnalysisUsage(llvm::AnalysisUsage&) const
llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, false, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::getAnalysisUsage(llvm::AnalysisUsage&) const
Line
Count
Source
116
1
  void getAnalysisUsage(AnalysisUsage &AU) const override {
117
1
    AU.setPreservesAll();
118
1
    AU.addRequired<AnalysisT>();
119
1
  }
Unexecuted instantiation: llvm::DOTGraphTraitsPrinter<polly::ScopDetectionWrapperPass, true, polly::ScopDetectionWrapperPass*, llvm::DefaultAnalysisGraphTraits<polly::ScopDetectionWrapperPass, polly::ScopDetectionWrapperPass*> >::getAnalysisUsage(llvm::AnalysisUsage&) const
120
121
private:
122
  std::string Name;
123
};
124
125
template <
126
    typename AnalysisT, bool IsSimple, typename GraphT = AnalysisT *,
127
    typename AnalysisGraphTraitsT = DefaultAnalysisGraphTraits<AnalysisT, GraphT> >
128
class DOTGraphTraitsModuleViewer : public ModulePass {
129
public:
130
  DOTGraphTraitsModuleViewer(StringRef GraphName, char &ID)
131
0
      : ModulePass(ID), Name(GraphName) {}
132
133
0
  bool runOnModule(Module &M) override {
134
0
    GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
135
0
    std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph);
136
0
137
0
    ViewGraph(Graph, Name, IsSimple, Title);
138
0
139
0
    return false;
140
0
  }
141
142
0
  void getAnalysisUsage(AnalysisUsage &AU) const override {
143
0
    AU.setPreservesAll();
144
0
    AU.addRequired<AnalysisT>();
145
0
  }
146
147
private:
148
  std::string Name;
149
};
150
151
template <
152
    typename AnalysisT, bool IsSimple, typename GraphT = AnalysisT *,
153
    typename AnalysisGraphTraitsT = DefaultAnalysisGraphTraits<AnalysisT, GraphT> >
154
class DOTGraphTraitsModulePrinter : public ModulePass {
155
public:
156
  DOTGraphTraitsModulePrinter(StringRef GraphName, char &ID)
157
0
      : ModulePass(ID), Name(GraphName) {}
158
159
0
  bool runOnModule(Module &M) override {
160
0
    GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
161
0
    std::string Filename = Name + ".dot";
162
0
    std::error_code EC;
163
0
164
0
    errs() << "Writing '" << Filename << "'...";
165
0
166
0
    raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
167
0
    std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph);
168
0
169
0
    if (!EC)
170
0
      WriteGraph(File, Graph, IsSimple, Title);
171
0
    else
172
0
      errs() << "  error opening file for writing!";
173
0
    errs() << "\n";
174
0
175
0
    return false;
176
0
  }
177
178
0
  void getAnalysisUsage(AnalysisUsage &AU) const override {
179
0
    AU.setPreservesAll();
180
0
    AU.addRequired<AnalysisT>();
181
0
  }
182
183
private:
184
  std::string Name;
185
};
186
187
} // end namespace llvm
188
189
#endif