diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-02-27 04:11:07 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-02-27 04:11:07 +0000 |
commit | 3091c92eedfbaeec352413b34f78f48889960361 (patch) | |
tree | ef6b120f841b97c27d640a59f2bd68b34f17c5ce /lib | |
parent | f3a83d6d0b4dd657f04f6d19f95fb53f136039c0 (diff) | |
download | external_llvm-3091c92eedfbaeec352413b34f78f48889960361.zip external_llvm-3091c92eedfbaeec352413b34f78f48889960361.tar.gz external_llvm-3091c92eedfbaeec352413b34f78f48889960361.tar.bz2 |
RegionPrinter: Ignore back edges when layouting the graph
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/RegionPrinter.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Analysis/RegionPrinter.cpp b/lib/Analysis/RegionPrinter.cpp index 0cf0f90..a1730b0 100644 --- a/lib/Analysis/RegionPrinter.cpp +++ b/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, |