summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/RegionPrinter.cpp
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-02-27 04:11:07 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-02-27 04:11:07 +0000
commit98eecaf0a971cd62d0e4759c4c668d26f152d5ab (patch)
treee2fb0dd03a3462008354e8e3a1deaa8eae4b7274 /llvm/lib/Analysis/RegionPrinter.cpp
parent1b4f94070f31efc702af94d880d8ca11041b8977 (diff)
downloadbcm5719-llvm-98eecaf0a971cd62d0e4759c4c668d26f152d5ab.tar.gz
bcm5719-llvm-98eecaf0a971cd62d0e4759c4c668d26f152d5ab.zip
RegionPrinter: Ignore back edges when layouting the graph
llvm-svn: 126564
Diffstat (limited to 'llvm/lib/Analysis/RegionPrinter.cpp')
-rw-r--r--llvm/lib/Analysis/RegionPrinter.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/RegionPrinter.cpp b/llvm/lib/Analysis/RegionPrinter.cpp
index 0cf0f905050..a1730b0a3ca 100644
--- a/llvm/lib/Analysis/RegionPrinter.cpp
+++ b/llvm/lib/Analysis/RegionPrinter.cpp
@@ -70,6 +70,32 @@ struct DOTGraphTraits<RegionInfo*> : public DOTGraphTraits<RegionNode*> {
G->getTopLevelRegion());
}
+ std::string getEdgeAttributes(RegionNode *srcNode,
+ GraphTraits<RegionInfo*>::ChildIteratorType CI, RegionInfo *RI) {
+
+ RegionNode *destNode = *CI;
+
+ if (srcNode->isSubRegion() || destNode->isSubRegion())
+ return "";
+
+ // In case of a backedge, do not use it to define the layout of the nodes.
+ BasicBlock *srcBB = srcNode->getNodeAs<BasicBlock>();
+ BasicBlock *destBB = destNode->getNodeAs<BasicBlock>();
+
+ Region *R = RI->getRegionFor(destBB);
+
+ while (R && R->getParent())
+ if (R->getParent()->getEntry() == destBB)
+ R = R->getParent();
+ else
+ break;
+
+ if (R->getEntry() == destBB && R->contains(srcBB))
+ return "constraint=false";
+
+ return "";
+ }
+
// Print the cluster of the subregions. This groups the single basic blocks
// and adds a different background color for each group.
static void printRegionCluster(const Region *R, GraphWriter<RegionInfo*> &GW,
OpenPOWER on IntegriCloud