33 cl::desc(
"Show only simple regions in the graphviz viewer"),
51 ::getSimpleNodeLabel(BB, BB->
getParent());
57 return "Not implemented";
88 while (R && R->getParent())
89 if (R->getParent()->getEntry() == destBB)
94 if (R && R->getEntry() == destBB && R->contains(srcBB))
95 return "constraint=false";
103 unsigned depth = 0) {
105 O.
indent(2 * depth) <<
"subgraph cluster_" <<
static_cast<const void*
>(&
R)
107 O.
indent(2 * (depth + 1)) <<
"label = \"\";\n";
110 O.
indent(2 * (depth + 1)) <<
"style = filled;\n";
111 O.
indent(2 * (depth + 1)) <<
"color = " 112 << ((R.
getDepth() * 2 % 12) + 1) <<
"\n";
115 O.
indent(2 * (depth + 1)) <<
"style = solid;\n";
116 O.
indent(2 * (depth + 1)) <<
"color = " 117 << ((R.
getDepth() * 2 % 12) + 2) <<
"\n";
120 for (
const auto &RI : R)
121 printRegionCluster(*RI, GW, depth + 1);
125 for (
auto *BB : R.blocks())
127 O.
indent(2 * (depth + 1)) <<
"Node" 131 O.
indent(2 * depth) <<
"}\n";
137 O <<
"\tcolorscheme = \"paired12\"\n";
145 struct RegionInfoPassGraphTraits {
153 RegionInfoPassGraphTraits> {
157 RegionInfoPassGraphTraits>(
"reg",
ID) {
163 struct RegionOnlyPrinter
165 RegionInfoPassGraphTraits> {
169 RegionInfoPassGraphTraits>(
"reg",
ID) {
177 RegionInfoPassGraphTraits> {
181 RegionInfoPassGraphTraits>(
"reg",
ID) {
187 struct RegionOnlyViewer
189 RegionInfoPassGraphTraits> {
193 RegionInfoPassGraphTraits>(
"regonly",
ID) {
202 "Print regions of function to 'dot' file",
true,
true)
205 RegionOnlyPrinter,
"dot-regions-only",
206 "Print regions of function to 'dot' file (with no function bodies)",
true,
213 "View regions of function (with no function bodies)",
219 return new RegionOnlyPrinter();
223 return new RegionViewer();
227 return new RegionOnlyViewer();
232 assert(RI &&
"Argument must be non-null");
238 Twine(GraphName) +
" for '" + F->
getName() +
"' function");
242 assert(F &&
"Argument must be non-null");
247 auto NonConstF =
const_cast<Function *
>(
F);
251 FPM.doInitialization();
253 FPM.doFinalization();
FunctionPass * createRegionViewerPass()
T * getNodeAs() const
Get the content of this RegionNode.
static void viewRegionInfo(RegionInfo *RI, bool ShortNames)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void viewRegion(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
This class represents lattice values for constants.
void initializeRegionViewerPass(PassRegistry &)
void initializeRegionPrinterPass(PassRegistry &)
static void addCustomGraphFeatures(const RegionInfo *G, GraphWriter< RegionInfo *> &GW)
std::string getNodeLabel(RegionNode *Node, RegionNode *Graph)
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
unsigned getDepth() const
Get the nesting level of this Region.
bool isSubRegion() const
Is this RegionNode a subregion?
void viewRegionOnly(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
FunctionPass * createRegionOnlyViewerPass()
dot regions Print regions of function to dot true
*ViewGraph Emit a dot run run gv on the postscript *then cleanup For use from the debugger *void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
std::string getEdgeAttributes(RegionNode *srcNode, GraphTraits< RegionInfo *>::ChildIteratorType CI, RegionInfo *G)
DOTGraphTraits(bool isSimple=false)
DOTGraphTraits(bool isSimple=false)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::string getNodeLabel(RegionNode *Node, RegionInfo *G)
RegionInfo & getRegionInfo()
std::string getNodeLabel(const void *, const GraphType &)
getNodeLabel - Given a node and a pointer to the top level graph, return the label to print in the no...
static bool isSimple(Instruction *I)
RegionT * getTopLevelRegion() const
void add(Pass *P) override
Add a pass to the queue of passes to run.
FunctionPass * createRegionOnlyPrinterPass()
bool isSimple() const
Is this a simple region?
initializer< Ty > init(const Ty &Val)
LLVM Basic Block Representation.
static void printRegionCluster(const Region &R, GraphWriter< RegionInfo *> &GW, unsigned depth=0)
FunctionPass * createRegionPrinterPass()
FunctionPass class - This class is used to implement most global optimizations.
static void invokeFunctionPass(const Function *F, FunctionPass *ViewerPass)
FunctionPassManager manages FunctionPasses and BasicBlockPassManagers.
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
dot regions Print regions of function to dot true view regions View regions of function(with no function bodies)"
void initializeRegionOnlyViewerPass(PassRegistry &)
raw_ostream & getOStream()
getOStream - Get the raw output stream into the graph file.
void initializeRegionOnlyPrinterPass(PassRegistry &)
StringRef getName() const
Return a constant reference to the value's name.
const Function * getParent() const
Return the enclosing method, or null if none.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static cl::opt< bool > onlySimpleRegions("only-simple-regions", cl::desc("Show only simple regions in the graphviz viewer"), cl::Hidden, cl::init(false))
onlySimpleRegion - Show only the simple regions in the RegionViewer.
This class implements an extremely fast bulk output stream that can only output to a stream...
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
static std::string getGraphName(const RegionInfo *)
RegionT * getRegionFor(BlockT *BB) const
Get the smallest region that contains a BasicBlock.
static std::string getGraphName(const GraphType &)
getGraphName - Return the label for the graph as a whole.
INITIALIZE_PASS(RegionPrinter, "dot-regions", "Print regions of function to 'dot' file", true, true) INITIALIZE_PASS(RegionOnlyPrinter