Make LoopInfo::print() identify header, exit, and latch blocks,
authorDan Gohman <gohman@apple.com>
Fri, 27 Feb 2009 00:05:54 +0000 (00:05 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 27 Feb 2009 00:05:54 +0000 (00:05 +0000)
and print the loop depth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65593 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopInfo.h

index 93bfcad1bc71acb6c059e2e1ae32d92815fdbe50..01e5fa96fccb97a8f5bd2faad2c8bb35bde86b28 100644 (file)
@@ -592,11 +592,16 @@ public:
   }
 
   void print(std::ostream &OS, unsigned Depth = 0) const {
-    OS << std::string(Depth*2, ' ') << "Loop Containing: ";
+    OS << std::string(Depth*2, ' ') << "Loop at depth " << getLoopDepth()
+       << " containing: ";
 
     for (unsigned i = 0; i < getBlocks().size(); ++i) {
       if (i) OS << ",";
-      WriteAsOperand(OS, getBlocks()[i], false);
+      BlockT *BB = getBlocks()[i];
+      WriteAsOperand(OS, BB, false);
+      if (BB == getHeader())    OS << "<header>";
+      if (BB == getLoopLatch()) OS << "<latch>";
+      if (isLoopExit(BB))       OS << "<exit>";
     }
     OS << "\n";