mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 07:17:36 +00:00
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
This commit is contained in:
@@ -1886,6 +1886,14 @@ void BytecodeReader::ParseModuleGlobalInfo() {
|
|||||||
if ((Flags & (1 << 4)) == 0)
|
if ((Flags & (1 << 4)) == 0)
|
||||||
FunctionSignatureList.push_back(Func);
|
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);
|
if (Handler) Handler->handleFunctionDeclaration(Func);
|
||||||
|
|
||||||
// Get the next function signature.
|
// Get the next function signature.
|
||||||
|
|||||||
@@ -923,10 +923,17 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
|
|||||||
assert(Slot != -1 && "Module slot calculator is broken!");
|
assert(Slot != -1 && "Module slot calculator is broken!");
|
||||||
assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
|
assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
|
||||||
assert(((Slot << 5) >> 5) == Slot && "Slot # too big!");
|
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.
|
if (I->isExternal()) // If external, we don't have an FunctionInfo block.
|
||||||
ID |= 1 << 4;
|
ID |= 1 << 4;
|
||||||
output_vbr(ID);
|
output_vbr(ID);
|
||||||
|
|
||||||
|
if (I->getCallingConv() >= 15)
|
||||||
|
output_vbr(I->getCallingConv());
|
||||||
}
|
}
|
||||||
output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5);
|
output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user