[llvm-branch-commits] [llvm-branch] r105263 - in /llvm/branches/wendling/eh: include/llvm/Instructions.h lib/VMCore/AsmWriter.cpp

Bill Wendling isanbard at gmail.com
Mon May 31 19:11:41 PDT 2010


Author: void
Date: Mon May 31 21:11:41 2010
New Revision: 105263

URL: http://llvm.org/viewvc/llvm-project?rev=105263&view=rev
Log:
Add support for printing out the new invoke instruction syntax.

Modified:
    llvm/branches/wendling/eh/include/llvm/Instructions.h
    llvm/branches/wendling/eh/lib/VMCore/AsmWriter.cpp

Modified: llvm/branches/wendling/eh/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm/Instructions.h?rev=105263&r1=105262&r2=105263&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/Instructions.h (original)
+++ llvm/branches/wendling/eh/include/llvm/Instructions.h Mon May 31 21:11:41 2010
@@ -2595,21 +2595,21 @@
 
   /// getCatchType - Return the specified catch type.
   Value *getCatchType(unsigned I) {
-    assert(I && I < getNumCatches() && "Illegal catch type to get!");
+    assert(I < getNumCatches() && "Illegal catch type to get!");
     return CatchList[I * 2];
   }
   const Value *getCatchType(unsigned I) const {
-    assert(I && I < getNumCatches() && "Illegal catch type to get!");
+    assert(I < getNumCatches() && "Illegal catch type to get!");
     return CatchList[I * 2];
   }
 
   /// getCatchDest - Return the specified catch's landing pad.
   BasicBlock *getCatchDest(unsigned I) {
-    assert(I && I < getNumCatches() && "Illegal catch type to get!");
+    assert(I < getNumCatches() && "Illegal catch destination to get!");
     return cast<BasicBlock>(CatchList[I * 2 + 1]);
   }
   const BasicBlock *getCatchDest(unsigned I) const {
-    assert(I && I < getNumCatches() && "Illegal catch type to get!");
+    assert(I < getNumCatches() && "Illegal catch destination to get!");
     return cast<BasicBlock>(CatchList[I * 2 + 1]);
   }
 

Modified: llvm/branches/wendling/eh/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/VMCore/AsmWriter.cpp?rev=105263&r1=105262&r2=105263&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/branches/wendling/eh/lib/VMCore/AsmWriter.cpp Mon May 31 21:11:41 2010
@@ -1935,21 +1935,47 @@
     if (PAL.getFnAttributes() != Attribute::None)
       Out << ' ' << Attribute::getAsString(PAL.getFnAttributes());
 
-    Out << "\n          to ";
+    Out << "\n    to ";
     writeOperand(II->getNormalDest(), true);
-    Out << " unwind ";
-    writeOperand(II->getUnwindDest(), true);
+    Out << "\n      personality [";
+    writeOperand(II->getPersonalityFn(), true);
+    Out << "]\n";
+
+    unsigned e = II->getNumCatches();
+
+    if (e) {
+      Out << "      catches [\n";
+      for (unsigned i = 0; i != e; ++i) {
+        Out << "        ";
+        writeOperand(II->getCatchType(i), true);
+        Out << ", ";
+        writeOperand(II->getCatchDest(i), true);
+        Out << "\n";
+      }
+      Out << "      ]\n";
+    }
+
+    if (II->getCatchAllType()) {
+      Out << "      catchall [";
+      writeOperand(II->getCatchAllType(), true);
+      Out << ", ";
+      writeOperand(II->getCatchAllDest(), true);
+      Out << "]\n";
+    }
 
+    Out << "      unwind to ";
+    writeOperand(II->getUnwindDest(), true);
   } else if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
     Out << ' ';
     TypePrinter.print(AI->getType()->getElementType(), Out);
+
     if (!AI->getArraySize() || AI->isArrayAllocation()) {
       Out << ", ";
       writeOperand(AI->getArraySize(), true);
     }
-    if (AI->getAlignment()) {
+
+    if (AI->getAlignment())
       Out << ", align " << AI->getAlignment();
-    }
   } else if (isa<CastInst>(I)) {
     if (Operand) {
       Out << ' ';





More information about the llvm-branch-commits mailing list