27 if (!
Node->isSubRegion()) {
36 return "Not implemented";
65 Region *R =
G->getRegionFor(destBB);
67 while (R && R->getParent())
68 if (R->getParent()->getEntry() == destBB)
73 if (R && R->getEntry() == destBB && R->contains(srcBB))
74 return "constraint=false";
85 O.indent(2 * depth) <<
"subgraph cluster_" <<
static_cast<const void*
>(&R)
87 O.indent(2 * (depth + 1)) <<
"label = \"\";\n";
89 if (!Opts.only_simple_regions || R.isSimple()) {
90 O.indent(2 * (depth + 1)) <<
"style = filled;\n";
91 O.indent(2 * (depth + 1)) <<
"color = "
92 << ((R.getDepth() * 2 % 12) + 1) <<
"\n";
95 O.indent(2 * (depth + 1)) <<
"style = solid;\n";
96 O.indent(2 * (depth + 1)) <<
"color = "
97 << ((R.getDepth() * 2 % 12) + 2) <<
"\n";
100 for (
const auto &RI : R)
105 for (
auto *BB : R.blocks())
107 O.indent(2 * (depth + 1)) <<
"Node"
111 O.indent(2 * depth) <<
"}\n";
117 O <<
"\tcolorscheme = \"paired12\"\n";
118 const Region *TopLevel =
G->getTopLevelRegion();
126struct RegionInfoPassGraphTraits {
133 :
public DOTGraphTraitsPrinterWrapperPass<
134 RegionInfoPass, false, RegionInfo *, RegionInfoPassGraphTraits> {
137 : DOTGraphTraitsPrinterWrapperPass<RegionInfoPass,
false, RegionInfo *,
138 RegionInfoPassGraphTraits>(
"reg",
ID) {
141char RegionPrinter::ID = 0;
143struct RegionOnlyPrinter
144 :
public DOTGraphTraitsPrinterWrapperPass<
145 RegionInfoPass, true, RegionInfo *, RegionInfoPassGraphTraits> {
148 : DOTGraphTraitsPrinterWrapperPass<RegionInfoPass,
true, RegionInfo *,
149 RegionInfoPassGraphTraits>(
"reg",
ID) {
152char RegionOnlyPrinter::ID = 0;
155 :
public DOTGraphTraitsViewerWrapperPass<
156 RegionInfoPass, false, RegionInfo *, RegionInfoPassGraphTraits> {
159 : DOTGraphTraitsViewerWrapperPass<RegionInfoPass,
false, RegionInfo *,
160 RegionInfoPassGraphTraits>(
"reg",
ID) {}
162char RegionViewer::ID = 0;
164struct RegionOnlyViewer
165 :
public DOTGraphTraitsViewerWrapperPass<RegionInfoPass, true, RegionInfo *,
166 RegionInfoPassGraphTraits> {
169 : DOTGraphTraitsViewerWrapperPass<RegionInfoPass,
true, RegionInfo *,
170 RegionInfoPassGraphTraits>(
"regonly",
173char RegionOnlyViewer::ID = 0;
178 "Print regions of function to 'dot' file",
true,
true)
181 RegionOnlyPrinter,
"dot-regions-only",
182 "Print regions of function to 'dot' file (with no function bodies)",
true,
189 "View regions of function (with no function bodies)",
195 return new RegionOnlyPrinter();
199 return new RegionViewer();
203 return new RegionOnlyViewer();
208 assert(RI &&
"Argument must be non-null");
214 Twine(GraphName) +
" for '" +
F->getName() +
"' function");
218 assert(
F &&
"Argument must be non-null");
219 assert(!
F->isDeclaration() &&
"Function must have an implementation");
223 auto NonConstF =
const_cast<Function *
>(
F);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Function Alias Analysis false
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static void viewRegionInfo(RegionInfo *RI, bool ShortNames)
static void invokeFunctionPass(const Function *F, FunctionPass *ViewerPass)
LLVM Basic Block Representation.
FunctionPass class - This class is used to implement most global optimizations.
raw_ostream & getOStream()
getOStream - Get the raw output stream into the graph file.
BlockT * getEntry() const
Get the entry BasicBlock of the Region.
RegionT * getTopLevelRegion() const
RegionT * getRegionFor(BlockT *BB) const
Get the smallest region that contains a BasicBlock.
RegionInfo & getRegionInfo()
bool isSubRegion() const
Is this RegionNode a subregion?
BasicBlock * getNodeAs() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
FunctionPassManager manages FunctionPasses.
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
void add(Pass *P) override
Add a pass to the queue of passes to run.
bool doInitialization()
doInitialization - Run all of the initializers for the function passes.
bool doFinalization()
doFinalization - Run all of the finalizers for the function passes.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI FunctionPass * createRegionOnlyViewerPass()
LLVM_ABI FunctionPass * createRegionPrinterPass()
const AnalysisOptions & getAnalysisOptions(const LLVMContext &C)
LLVM_ABI FunctionPass * createRegionOnlyPrinterPass()
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.
LLVM_ABI FunctionPass * createRegionViewerPass()
void viewRegion(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
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)
std::string getNodeLabel(RegionNode *Node, RegionInfo *G)
DOTGraphTraits(bool isSimple=false)
std::string getEdgeAttributes(RegionNode *srcNode, GraphTraits< RegionInfo * >::ChildIteratorType CI, RegionInfo *G)
static void printRegionCluster(const AnalysisOptions &Opts, const Region &R, GraphWriter< RegionInfo * > &GW, unsigned depth=0)
static std::string getGraphName(const RegionInfo *)
DOTGraphTraits(bool isSimple=false)
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
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...