32 cl::desc(
"Show only simple regions in the graphviz viewer"),
50 ::getSimpleNodeLabel(BB, BB->
getParent());
56 return "Not implemented";
87 while (R && R->getParent())
88 if (R->getParent()->getEntry() == destBB)
93 if (R && R->getEntry() == destBB && R->contains(srcBB))
94 return "constraint=false";
102 unsigned depth = 0) {
104 O.
indent(2 * depth) <<
"subgraph cluster_" <<
static_cast<const void*
>(&
R)
106 O.
indent(2 * (depth + 1)) <<
"label = \"\";\n";
109 O.
indent(2 * (depth + 1)) <<
"style = filled;\n";
110 O.
indent(2 * (depth + 1)) <<
"color = " 111 << ((R.
getDepth() * 2 % 12) + 1) <<
"\n";
114 O.
indent(2 * (depth + 1)) <<
"style = solid;\n";
115 O.
indent(2 * (depth + 1)) <<
"color = " 116 << ((R.
getDepth() * 2 % 12) + 2) <<
"\n";
119 for (
const auto &RI : R)
120 printRegionCluster(*RI, GW, depth + 1);
124 for (
auto *BB : R.blocks())
126 O.
indent(2 * (depth + 1)) <<
"Node" 130 O.
indent(2 * depth) <<
"}\n";
136 O <<
"\tcolorscheme = \"paired12\"\n";
144 struct RegionInfoPassGraphTraits {
152 RegionInfoPassGraphTraits> {
156 RegionInfoPassGraphTraits>(
"reg",
ID) {
162 struct RegionOnlyPrinter
164 RegionInfoPassGraphTraits> {
168 RegionInfoPassGraphTraits>(
"reg",
ID) {
176 RegionInfoPassGraphTraits> {
180 RegionInfoPassGraphTraits>(
"reg",
ID) {
186 struct RegionOnlyViewer
188 RegionInfoPassGraphTraits> {
192 RegionInfoPassGraphTraits>(
"regonly",
ID) {
201 "Print regions of function to 'dot' file",
true,
true)
204 RegionOnlyPrinter,
"dot-regions-only",
205 "Print regions of function to 'dot' file (with no function bodies)",
true,
212 "View regions of function (with no function bodies)",
218 return new RegionOnlyPrinter();
222 return new RegionViewer();
226 return new RegionOnlyViewer();
231 assert(RI &&
"Argument must be non-null");
237 Twine(GraphName) +
" for '" + F->
getName() +
"' function");
241 assert(F &&
"Argument must be non-null");
246 auto NonConstF =
const_cast<Function *
>(
F);
250 FPM.doInitialization();
252 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