aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer/Writer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-26 18:42:34 +0000
committerChris Lattner <sabre@nondot.org>2006-05-26 18:42:34 +0000
commita65371ea25cadd0f5669747394cce297fb3e47b7 (patch)
tree5d1297d3119c5cbff30da27901422a267182ab76 /lib/Bytecode/Writer/Writer.cpp
parente812d1133b593d627449952ef6bdab7757904ecf (diff)
Fix a bug in the bc reader/writer: we were not correctly encoding varargs
nonccc calls (we were dropping the CC and tail flag). This broke several FORTRAN programs. Testcase here: Regression/Assembler/2006-05-26-VarargsCallEncode.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/Writer.cpp')
-rw-r--r--lib/Bytecode/Writer/Writer.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 4ec6b2a41e..83e8a57acf 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -527,7 +527,8 @@ void BytecodeWriter::outputInstrVarArgsCall(const Instruction *I,
// variable argument.
NumFixedOperands = 3+NumParams;
}
- output_vbr(2 * I->getNumOperands()-NumFixedOperands);
+ output_vbr(2 * I->getNumOperands()-NumFixedOperands +
+ unsigned(Opcode == 56 || Opcode == 58));
// The type for the function has already been emitted in the type field of the
// instruction. Just emit the slot # now.
@@ -548,6 +549,14 @@ void BytecodeWriter::outputInstrVarArgsCall(const Instruction *I,
assert(Slot >= 0 && "No slot number for value!?!?");
output_vbr((unsigned)Slot);
}
+
+ // If this is the escape sequence for call, emit the tailcall/cc info.
+ if (Opcode == 58) {
+ const CallInst *CI = cast<CallInst>(I);
+ output_vbr((CI->getCallingConv() << 1) | unsigned(CI->isTailCall()));
+ } else if (Opcode == 56) { // Invoke escape sequence.
+ output_vbr(cast<InvokeInst>(I)->getCallingConv());
+ }
}