[llvm-commits] [llvm] r51823 - /llvm/trunk/lib/VMCore/AsmWriter.cpp

Dan Gohman gohman at apple.com
Sat May 31 12:12:39 PDT 2008


Author: djg
Date: Sat May 31 14:12:39 2008
New Revision: 51823

URL: http://llvm.org/viewvc/llvm-project?rev=51823&view=rev
Log:
AsmWriter support for insertvalue/extractvalue. These instructions can
now round-trip through assembly and bitcode.

Modified:
    llvm/trunk/lib/VMCore/AsmWriter.cpp

Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=51823&r1=51822&r2=51823&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat May 31 14:12:39 2008
@@ -624,6 +624,12 @@
         Out << ", ";
     }
 
+    if (CE->hasIndices()) {
+      const SmallVector<unsigned, 4> &Indices = CE->getIndices();
+      for (unsigned i = 0, e = Indices.size(); i != e; ++i)
+        Out << ", " << Indices[i];
+    }
+
     if (CE->isCast()) {
       Out << " to ";
       printTypeInt(Out, CE->getType(), TypeTable);
@@ -1292,6 +1298,15 @@
   } else if (const GetResultInst *GRI = dyn_cast<GetResultInst>(&I)) {
     writeOperand(I.getOperand(0), true);
     Out << ", " << GRI->getIndex();
+  } else if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(&I)) {
+    writeOperand(I.getOperand(0), true);
+    for (const unsigned *i = EVI->idx_begin(), *e = EVI->idx_end(); i != e; ++i)
+      Out << ", " << *i;
+  } else if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(&I)) {
+    writeOperand(I.getOperand(0), true); Out << ',';
+    writeOperand(I.getOperand(1), true);
+    for (const unsigned *i = IVI->idx_begin(), *e = IVI->idx_end(); i != e; ++i)
+      Out << ", " << *i;
   } else if (isa<ReturnInst>(I) && !Operand) {
     Out << " void";
   } else if (const CallInst *CI = dyn_cast<CallInst>(&I)) {





More information about the llvm-commits mailing list