aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode/Writer
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-04-16 01:16:20 +0000
committerGabor Greif <ggreif@gmail.com>2010-04-16 01:16:20 +0000
commit607a7ab3da72a2eb53553a520507cbb8068dd1d8 (patch)
treea24f057eee6bdd4edd74d509424b13bed1dda2de /lib/Bitcode/Writer
parent5f0378251c4b682b51d194fce45da1587ed9c97b (diff)
downloadexternal_llvm-607a7ab3da72a2eb53553a520507cbb8068dd1d8.zip
external_llvm-607a7ab3da72a2eb53553a520507cbb8068dd1d8.tar.gz
external_llvm-607a7ab3da72a2eb53553a520507cbb8068dd1d8.tar.bz2
back out r101423 and r101397, they break llvm-gcc self-host on darwin10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 0a7db2b..9bda6dc 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1134,23 +1134,24 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Vals.push_back(cast<StoreInst>(I).isVolatile());
break;
case Instruction::Call: {
- const CallInst &CI = cast<CallInst>(I);
- const PointerType *PTy = cast<PointerType>(CI.getCalledValue()->getType());
+ const PointerType *PTy = cast<PointerType>(I.getOperand(0)->getType());
const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
Code = bitc::FUNC_CODE_INST_CALL;
- Vals.push_back(VE.getAttributeID(CI.getAttributes()));
- Vals.push_back((CI.getCallingConv() << 1) | unsigned(CI.isTailCall()));
- PushValueAndType(CI.getCalledValue(), InstID, Vals, VE); // Callee
+ const CallInst *CI = cast<CallInst>(&I);
+ Vals.push_back(VE.getAttributeID(CI->getAttributes()));
+ Vals.push_back((CI->getCallingConv() << 1) | unsigned(CI->isTailCall()));
+ PushValueAndType(CI->getOperand(0), InstID, Vals, VE); // Callee
// Emit value #'s for the fixed parameters.
for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
- Vals.push_back(VE.getValueID(I.getOperand(i))); // fixed param.
+ Vals.push_back(VE.getValueID(I.getOperand(i+1))); // fixed param.
// Emit type/value pairs for varargs params.
if (FTy->isVarArg()) {
- for (unsigned i = FTy->getNumParams(), e = I.getNumOperands()-1;
+ unsigned NumVarargs = I.getNumOperands()-1-FTy->getNumParams();
+ for (unsigned i = I.getNumOperands()-NumVarargs, e = I.getNumOperands();
i != e; ++i)
PushValueAndType(I.getOperand(i), InstID, Vals, VE); // varargs
}