summaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-11-06 07:46:13 +0000
committerChris Lattner <sabre@nondot.org>2005-11-06 07:46:13 +0000
commit54b369e752d6246bfaa59c85e718e0178d823865 (patch)
tree5a97be681c43bad2db5b8e04f021b1bd3187da44 /lib/Bytecode/Writer
parente73bd45c1dbc0f256cdf4450192a0e74af51e881 (diff)
downloadllvm-54b369e752d6246bfaa59c85e718e0178d823865.tar.gz
llvm-54b369e752d6246bfaa59c85e718e0178d823865.tar.bz2
llvm-54b369e752d6246bfaa59c85e718e0178d823865.tar.xz
don't misencode CC#'s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer')
-rw-r--r--lib/Bytecode/Writer/Writer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 071a41efcf..9ba475c9d3 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -968,12 +968,13 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
assert(Slot != -1 && "Module slot calculator is broken!");
assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
assert(((Slot << 6) >> 6) == Slot && "Slot # too big!");
- unsigned ID = (Slot << 5) | (I->getCallingConv() & 15);
+ unsigned CC = I->getCallingConv()+1;
+ unsigned ID = (Slot << 5) | (CC & 15);
if (I->isExternal()) // If external, we don't have an FunctionInfo block.
ID |= 1 << 4;
- if (I->getAlignment() || I->getCallingConv() & ~15)
+ if (I->getAlignment() || (CC & ~15) != 0)
ID |= 1 << 31; // Do we need an extension word?
output_vbr(ID);
@@ -981,7 +982,7 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
if (ID & (1 << 31)) {
// Extension byte: bits 0-4 = alignment, bits 5-9 = top nibble of calling
// convention.
- ID = (Log2_32(I->getAlignment())+1) | ((I->getCallingConv() >> 4) << 5);
+ ID = (Log2_32(I->getAlignment())+1) | ((CC >> 4) << 5);
output_vbr(ID);
}
}