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)
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()
static void viewRegionInfo(RegionInfo *RI, bool ShortNames)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void Print(const Unit &v, const char *PrintAfter)
void viewRegion(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
static void printRegionCluster(const Region &R, GraphWriter< RegionInfo * > &GW, unsigned depth=0)
bool isSimple() const
Is this a simple region?
void initializeRegionViewerPass(PassRegistry &)
void initializeRegionPrinterPass(PassRegistry &)
std::string getNodeLabel(RegionNode *Node, RegionNode *Graph)
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
const Function * getParent() const
Return the enclosing method, or null if none.
INITIALIZE_PASS(RegionPrinter,"dot-regions","Print regions of function to 'dot' file", true, true) INITIALIZE_PASS(RegionOnlyPrinter
bool isSubRegion() const
Is this RegionNode a subregion?
RegionT * getTopLevelRegion() const
T * getNodeAs() const
Get the content of this RegionNode.
RegionT * getRegionFor(BlockT *BB) const
Get the smallest region that contains a BasicBlock.
void viewRegionOnly(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
raw_ostream & getOStream()
getOStream - Get the raw output stream into the graph file.
FunctionPass * createRegionOnlyViewerPass()
dot regions Print regions of function to dot true
StringRef getName() const
Return a constant reference to the value's name.
static void addCustomGraphFeatures(const RegionInfo *G, GraphWriter< RegionInfo * > &GW)
unsigned getDepth() const
Get the nesting level of this Region.
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)
Function Alias Analysis false
void add(Pass *P) override
Add a pass to the queue of passes to run.
FunctionPass * createRegionOnlyPrinterPass()
initializer< Ty > init(const Ty &Val)
LLVM Basic Block Representation.
FunctionPass * createRegionPrinterPass()
FunctionPass class - This class is used to implement most global optimizations.
void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, then cleanup.
static void invokeFunctionPass(const Function *F, FunctionPass *ViewerPass)
dot regions Print regions of function to dot file(with no function bodies)"
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 &)
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
void initializeRegionOnlyPrinterPass(PassRegistry &)
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 *)
static std::string getGraphName(const GraphType &)
getGraphName - Return the label for the graph as a whole.
std::string getEdgeAttributes(RegionNode *srcNode, GraphTraits< RegionInfo * >::ChildIteratorType CI, RegionInfo *G)