diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-26 18:42:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-26 18:42:34 +0000 |
commit | 44a793c3a69d78a89bad1dbadbf29caf2d4524e4 (patch) | |
tree | d561eb1e4acd0a99a5dca16b2d1bb6995a88c64b /llvm/lib/Bytecode/Writer | |
parent | 49e7f56e7f73c9ac843deedbcf1d3167d2c092ca (diff) | |
download | bcm5719-llvm-44a793c3a69d78a89bad1dbadbf29caf2d4524e4.tar.gz bcm5719-llvm-44a793c3a69d78a89bad1dbadbf29caf2d4524e4.zip |
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
llvm-svn: 28501
Diffstat (limited to 'llvm/lib/Bytecode/Writer')
-rw-r--r-- | llvm/lib/Bytecode/Writer/Writer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp index 4ec6b2a41e8..83e8a57acfe 100644 --- a/llvm/lib/Bytecode/Writer/Writer.cpp +++ b/llvm/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()); + } } |