[llvm-commits] [llvm] r62330 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Gabor Greif ggreif at gmail.com
Fri Jan 16 10:40:28 PST 2009


Author: ggreif
Date: Fri Jan 16 12:40:27 2009
New Revision: 62330

URL: http://llvm.org/viewvc/llvm-project?rev=62330&view=rev
Log:
use specialized accessor instead of plain getOperand(0)

Modified:
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=62330&r1=62329&r2=62330&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Jan 16 12:40:27 2009
@@ -698,7 +698,7 @@
 /// This function adds V's value ID to Vals.  If the value ID is higher than the
 /// instruction ID, then it is a forward reference, and it also includes the
 /// type ID.
-static bool PushValueAndType(Value *V, unsigned InstID,
+static bool PushValueAndType(const Value *V, unsigned InstID,
                              SmallVector<unsigned, 64> &Vals, 
                              ValueEnumerator &VE) {
   unsigned ValID = VE.getValueID(V);
@@ -825,16 +825,17 @@
       Vals.push_back(VE.getValueID(I.getOperand(i)));
     break;
   case Instruction::Invoke: {
-    const PointerType *PTy = cast<PointerType>(I.getOperand(0)->getType());
+    const InvokeInst *II = cast<InvokeInst>(&I);
+    const Value *Callee(II->getCalledValue());
+    const PointerType *PTy = cast<PointerType>(Callee->getType());
     const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
     Code = bitc::FUNC_CODE_INST_INVOKE;
     
-    const InvokeInst *II = cast<InvokeInst>(&I);
     Vals.push_back(VE.getAttributeID(II->getAttributes()));
     Vals.push_back(II->getCallingConv());
     Vals.push_back(VE.getValueID(II->getNormalDest()));
     Vals.push_back(VE.getValueID(II->getUnwindDest()));
-    PushValueAndType(I.getOperand(0), InstID, Vals, VE); // callee
+    PushValueAndType(Callee, InstID, Vals, VE);
     
     // Emit value #'s for the fixed parameters.
     for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)





More information about the llvm-commits mailing list