[llvm-commits] [llvm] r126564 - /llvm/trunk/lib/Analysis/RegionPrinter.cpp

Tobias Grosser grosser at fim.uni-passau.de
Sat Feb 26 20:11:07 PST 2011


Author: grosser
Date: Sat Feb 26 22:11:07 2011
New Revision: 126564

URL: http://llvm.org/viewvc/llvm-project?rev=126564&view=rev
Log:
RegionPrinter: Ignore back edges when layouting the graph

Modified:
    llvm/trunk/lib/Analysis/RegionPrinter.cpp

Modified: llvm/trunk/lib/Analysis/RegionPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionPrinter.cpp?rev=126564&r1=126563&r2=126564&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionPrinter.cpp Sat Feb 26 22:11:07 2011
@@ -70,6 +70,32 @@
                                                      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,





More information about the llvm-commits mailing list