summaryrefslogtreecommitdiff
path: root/lib/Bitcode/Writer
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-01-16 18:40:27 +0000
committerGabor Greif <ggreif@gmail.com>2009-01-16 18:40:27 +0000
commit75a46eb80005eeacf274c65e07a9fd295d55c6a2 (patch)
tree921345b7e179239902b56a2a2358202b2dc26cef /lib/Bitcode/Writer
parent7103c6a993af878ebd9767e344a33919dc2c4342 (diff)
downloadllvm-75a46eb80005eeacf274c65e07a9fd295d55c6a2.tar.gz
llvm-75a46eb80005eeacf274c65e07a9fd295d55c6a2.tar.bz2
llvm-75a46eb80005eeacf274c65e07a9fd295d55c6a2.tar.xz
use specialized accessor instead of plain getOperand(0)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index da400a7360..0cb476e305 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -698,7 +698,7 @@ static void WriteModuleConstants(const ValueEnumerator &VE,
/// 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 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
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)