Go to the documentation of this file.
29 cl::desc(
"Show only simple regions in the graphviz viewer"),
37 if (!Node->isSubRegion()) {
46 return "Not implemented";
59 Node,
reinterpret_cast<RegionNode *
>(
G->getTopLevelRegion()));
76 while (
R &&
R->getParent())
77 if (
R->getParent()->getEntry() == destBB)
82 if (
R &&
R->getEntry() == destBB &&
R->contains(srcBB))
83 return "constraint=false";
93 O.indent(2 * depth) <<
"subgraph cluster_" <<
static_cast<const void*
>(&
R)
95 O.indent(2 * (depth + 1)) <<
"label = \"\";\n";
98 O.indent(2 * (depth + 1)) <<
"style = filled;\n";
99 O.indent(2 * (depth + 1)) <<
"color = "
100 << ((
R.getDepth() * 2 % 12) + 1) <<
"\n";
103 O.indent(2 * (depth + 1)) <<
"style = solid;\n";
104 O.indent(2 * (depth + 1)) <<
"color = "
105 << ((
R.getDepth() * 2 % 12) + 2) <<
"\n";
108 for (
const auto &RI :
R)
109 printRegionCluster(*RI, GW, depth + 1);
113 for (
auto *
BB :
R.blocks())
115 O.indent(2 * (depth + 1)) <<
"Node"
119 O.indent(2 * depth) <<
"}\n";
125 O <<
"\tcolorscheme = \"paired12\"\n";
126 printRegionCluster(*
G->getTopLevelRegion(), GW, 4);
133 struct RegionInfoPassGraphTraits {
141 RegionInfoPass, false, RegionInfo *, RegionInfoPassGraphTraits> {
145 RegionInfoPassGraphTraits>(
"reg",
ID) {
151 struct RegionOnlyPrinter
153 RegionInfoPass, true, RegionInfo *, RegionInfoPassGraphTraits> {
157 RegionInfoPassGraphTraits>(
"reg",
ID) {
165 RegionInfoPass, false, RegionInfo *, RegionInfoPassGraphTraits> {
169 RegionInfoPassGraphTraits>(
"reg",
ID) {
175 struct RegionOnlyViewer
177 RegionInfoPassGraphTraits> {
181 RegionInfoPassGraphTraits>(
"regonly",
191 "Print regions of function to 'dot' file",
true,
true)
208 return new RegionOnlyPrinter();
212 return new RegionViewer();
216 return new RegionOnlyViewer();
221 assert(RI &&
"Argument must be non-null");
227 Twine(GraphName) +
" for '" +
F->getName() +
"' function");
231 assert(
F &&
"Argument must be non-null");
232 assert(!
F->isDeclaration() &&
"Function must have an implementation");
236 auto NonConstF =
const_cast<Function *
>(
F);
void initializeRegionOnlyPrinterPass(PassRegistry &)
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createRegionOnlyPrinterPass()
RegionT * getTopLevelRegion() const
DOTGraphTraits(bool isSimple=false)
std::string getNodeLabel(RegionNode *Node, RegionInfo *G)
raw_ostream & getOStream()
getOStream - Get the raw output stream into the graph file.
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.
RegionInfo & getRegionInfo()
LLVM Basic Block Representation.
void initializeRegionOnlyViewerPass(PassRegistry &)
bool doFinalization()
doFinalization - Run all of the finalizers for the function passes.
static void viewRegionInfo(RegionInfo *RI, bool ShortNames)
static void printRegionCluster(const Region &R, GraphWriter< RegionInfo * > &GW, unsigned depth=0)
This class implements an extremely fast bulk output stream that can only output to a stream.
void initializeRegionViewerPass(PassRegistry &)
dot regions Print regions of function to dot true
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
RegionT * getRegionFor(BlockT *BB) const
Get the smallest region that contains a BasicBlock.
dot regions Print regions of function to dot file(with no function bodies)"
T * getNodeAs() const
Get the content of this RegionNode.
static void invokeFunctionPass(const Function *F, FunctionPass *ViewerPass)
initializer< Ty > init(const Ty &Val)
bool doInitialization()
doInitialization - Run all of the initializers for the function passes.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void add(Pass *P) override
Add a pass to the queue of passes to run.
static std::string getGraphName(const RegionInfo *)
void initializeRegionPrinterPass(PassRegistry &)
bool isSubRegion() const
Is this RegionNode a subregion?
FunctionPass * createRegionViewerPass()
dot regions Print regions of function to dot true view regions View regions of function(with no function bodies)"
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
INITIALIZE_PASS(RegionPrinter, "dot-regions", "Print regions of function to 'dot' file", true, true) INITIALIZE_PASS(RegionOnlyPrinter
static bool isSimple(Instruction *I)
void viewRegion(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
FunctionPass * createRegionOnlyViewerPass()
FunctionPassManager manages FunctionPasses.
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...
std::string getEdgeAttributes(RegionNode *srcNode, GraphTraits< RegionInfo * >::ChildIteratorType CI, RegionInfo *G)
FunctionPass class - This class is used to implement most global optimizations.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
FunctionPass * createRegionPrinterPass()
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.
void viewRegionOnly(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
static void addCustomGraphFeatures(const RegionInfo *G, GraphWriter< RegionInfo * > &GW)
Add support for conditional and other related patterns Instead of