summaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-06 20:42:57 +0000
committerChris Lattner <sabre@nondot.org>2005-05-06 20:42:57 +0000
commit479ffebd732552ad70ffee7c69ae1e7b9f52cfdd (patch)
treec299f78b38179e57c3cce5e03e4579a7de24f50f /lib/Bytecode
parenta8e8f16714dfcfe4b160cc9ba8b331ca17919b08 (diff)
downloadllvm-479ffebd732552ad70ffee7c69ae1e7b9f52cfdd.tar.gz
llvm-479ffebd732552ad70ffee7c69ae1e7b9f52cfdd.tar.bz2
llvm-479ffebd732552ad70ffee7c69ae1e7b9f52cfdd.tar.xz
encode function calling convs in the bytecode file. invoke and call are
still to come. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21749 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/Reader.cpp8
-rw-r--r--lib/Bytecode/Writer/Writer.cpp9
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 24875e42fd..8e46083082 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -1886,6 +1886,14 @@ void BytecodeReader::ParseModuleGlobalInfo() {
if ((Flags & (1 << 4)) == 0)
FunctionSignatureList.push_back(Func);
+ // Look at the low bits. If there is a calling conv here, apply it,
+ // read it as a vbr.
+ Flags &= 15;
+ if (Flags)
+ Func->setCallingConv(Flags-1);
+ else
+ Func->setCallingConv(read_vbr_uint());
+
if (Handler) Handler->handleFunctionDeclaration(Func);
// Get the next function signature.
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 63cb2d0c5a..4cf4cf5a97 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -923,10 +923,17 @@ 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 << 5) >> 5) == Slot && "Slot # too big!");
- unsigned ID = (Slot << 5) + 1;
+ unsigned ID = (Slot << 5);
+
+ if (I->getCallingConv() < 15)
+ ID += I->getCallingConv()+1;
+
if (I->isExternal()) // If external, we don't have an FunctionInfo block.
ID |= 1 << 4;
output_vbr(ID);
+
+ if (I->getCallingConv() >= 15)
+ output_vbr(I->getCallingConv());
}
output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5);