Refactor calling convention settings. (#304)
Add a calling-convention setting to the `Flags` used as part of the `TargetIsa`. This allows Cretonne code that generates calls to use the correct convention, such as when emitting libcalls during legalization or when the wasm frontend is decoding functions. This setting can be overridden per-function. This also adds "fast", "cold", and "fastcall" conventions, with "fast" as the new default. Note that "fast" and "cold" are not intended to be ABI-compatible across Cretonne versions. This will also ensure Windows users will get an `unimplemented!` rather than silent calling-convention mismatches, which reflects the fact that Windows calling conventions are not yet implemented. This also renames SpiderWASM, which isn't camel-case, to Baldrdash, which is, and which is also a more relevant name.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
test verifier
|
||||
|
||||
function %add_members(i32) -> f32 spiderwasm {
|
||||
function %add_members(i32) -> f32 baldrdash {
|
||||
gv0 = vmctx+64
|
||||
gv1 = vmctx+72
|
||||
heap0 = dynamic gv0, min 0x1000, bound gv1, guard 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
test verifier
|
||||
|
||||
function %add_members(i32) -> f32 spiderwasm {
|
||||
function %add_members(i32) -> f32 baldrdash {
|
||||
gv0 = vmctx+64
|
||||
heap0 = static gv0, min 0x1000, bound 0x10_0000, guard 0x1000
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
test verifier
|
||||
|
||||
function %add_members(i32) -> f32 spiderwasm {
|
||||
function %add_members(i32) -> f32 baldrdash {
|
||||
gv0 = vmctx+64
|
||||
heap0 = static gv0, min 0x1000, bound 0x1_0000_0000, guard 0x8000_0000
|
||||
|
||||
|
||||
@@ -399,7 +399,28 @@ convention:
|
||||
param : type [paramext] [paramspecial]
|
||||
paramext : "uext" | "sext"
|
||||
paramspecial : "sret" | "link" | "fp" | "csr" | "vmctx"
|
||||
callconv : "system_v" | "spiderwasm"
|
||||
callconv : "fast" | "cold" | "system_v" | "fastcall" | "baldrdash"
|
||||
|
||||
A function's calling convention determines exactly how arguments and return
|
||||
values are passed, and how stack frames are managed. Since all of these details
|
||||
depend on both the instruction set /// architecture and possibly the operating
|
||||
system, a function's calling convention is only fully determined by a
|
||||
`(TargetIsa, CallConv)` tuple.
|
||||
|
||||
========== ===========================================
|
||||
Name Description
|
||||
========== ===========================================
|
||||
fast not-ABI-stable convention for best performance
|
||||
cold not-ABI-stable convention for infrequently executed code
|
||||
system_v System V-style convention used on many platforms
|
||||
fastcall Windows "fastcall" convention, also used for x64 and ARM
|
||||
baldrdash SpiderMonkey WebAssembly convention
|
||||
========== ===========================================
|
||||
|
||||
The "not-ABI-stable" conventions do not follow an external specification and
|
||||
may change between versions of Cretonne.
|
||||
|
||||
The "fastcall" convention is not yet implemented.
|
||||
|
||||
Parameters and return values have flags whose meaning is mostly target
|
||||
dependent. These flags support interfacing with code produced by other
|
||||
|
||||
Reference in New Issue
Block a user