forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 7
Add the allocation pointer to the OCaml calling convention #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,14 +445,19 @@ def RetCC_X86_64_OCaml : CallingConv<[ | |
CCIfType<[i8, i16, i32], CCPromoteToType<i64>>, | ||
|
||
// Every function preserves the necessary function arguments | ||
CCIfType<[i64], CCAssignToReg<[R14, RAX, RBX, RDI, RSI, RDX, RCX, R8, R9, R12, R13]>>, | ||
CCIfType<[i64], CCAssignToReg<[R14, R15, RAX, RBX, RDI, RSI, RDX, RCX, R8, R9, R12, R13]>>, | ||
|
||
CCIfType<[f32, f64], CCAssignToReg<[ | ||
XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, | ||
XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15 | ||
]>> | ||
]>; | ||
|
||
def RetCC_X86_64_OCaml_C_Call : CallingConv<[ | ||
CCIfType<[i64], CCAssignToReg<[R14, R15]>>, | ||
|
||
CCDelegateTo<RetCC_X86_64_C> | ||
]>; | ||
|
||
defm X86_32_RegCall : | ||
X86_RegCall_base<RC_X86_32_RegCall>; | ||
|
@@ -509,6 +514,7 @@ def RetCC_X86_64 : CallingConv<[ | |
|
||
// Handle OCaml calls | ||
CCIfCC<"CallingConv::OCaml", CCDelegateTo<RetCC_X86_64_OCaml>>, | ||
CCIfCC<"CallingConv::OCaml_C_Call", CCDelegateTo<RetCC_X86_64_OCaml_C_Call>>, | ||
|
||
// Otherwise, drop to normal X86-64 CC | ||
CCDelegateTo<RetCC_X86_64_C> | ||
|
@@ -725,9 +731,8 @@ def CC_X86_64_OCaml : CallingConv<[ | |
// (registers containing pointers to data structures maintained by the | ||
// runtime) must be preserved through the run of the program. To ensure LLVM | ||
// doesn't mess with them, they are explicitly threaded through function calls | ||
// and returns. These are R14 and R15. Note that R15 isn't listed since it is | ||
// not implemented yet. | ||
CCIfType<[i64], CCAssignToReg<[R14, RAX, RBX, RDI, RSI, RDX, RCX, R8, R9, R12, R13]>>, | ||
// and returns. These are R14 and R15. | ||
CCIfType<[i64], CCAssignToReg<[R14, R15, RAX, RBX, RDI, RSI, RDX, RCX, R8, R9, R12, R13]>>, | ||
|
||
CCIfType<[f32, f64], CCAssignToReg<[ | ||
XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, | ||
|
@@ -738,7 +743,7 @@ def CC_X86_64_OCaml : CallingConv<[ | |
def CC_X86_64_OCaml_C_Call : CallingConv<[ | ||
// OCaml wraps C calls with another function that transfers stack arguments. | ||
// RAX contains the function address, and R12 contains the size of the stack arguments. | ||
CCIfType<[i64], CCAssignToReg<[RAX, R12]>>, | ||
CCIfType<[i64], CCAssignToReg<[R14, R15, RAX, R12]>>, | ||
|
||
// Follow C convention normally otherwise | ||
CCDelegateTo<CC_X86_64_C> | ||
|
@@ -1173,6 +1178,9 @@ def CSR_NoRegs : CalleeSavedRegs<(add)>; | |
def CSR_32 : CalleeSavedRegs<(add ESI, EDI, EBX, EBP)>; | ||
def CSR_64 : CalleeSavedRegs<(add RBX, R12, R13, R14, R15, RBP)>; | ||
|
||
// R14 and R15 are used as return registers, so they aren't callee saved. | ||
def CSR_64_OCaml_C_Call : CalleeSavedRegs<(add RBX, R12, R13, RBP)>; | ||
|
||
|
||
def CSR_64_SwiftError : CalleeSavedRegs<(sub CSR_64, R12)>; | ||
def CSR_64_SwiftTail : CalleeSavedRegs<(sub CSR_64, R13, R14)>; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.