Cranelift: Introduce the return_call and return_call_indirect instructions (#5679)
* Cranelift: Introduce the `tail` calling convention This is an unstable-ABI calling convention that we will eventually use to support Wasm tail calls. Co-Authored-By: Jamey Sharp <jsharp@fastly.com> * Cranelift: Introduce the `return_call` and `return_call_indirect` instructions These will be used to implement tail calls for Wasm and any other language targeting CLIF. The `return_call_indirect` instruction differs from the Wasm instruction of the same name by taking a native address callee rather than a Wasm function index. Co-Authored-By: Jamey Sharp <jsharp@fastly.com> * Cranelift: Implement verification rules for `return_call[_indirect]` They must: * have the same return types between the caller and callee, * have the same calling convention between caller and callee, * and that calling convention must support tail calls. Co-Authored-By: Jamey Sharp <jsharp@fastly.com> * cargo fmt --------- Co-authored-by: Jamey Sharp <jsharp@fastly.com>
This commit is contained in:
@@ -708,6 +708,7 @@ impl ABIMachineSpec for X64ABIMachineSpec {
|
||||
regs: &[Writable<RealReg>],
|
||||
) -> Vec<Writable<RealReg>> {
|
||||
let mut regs: Vec<Writable<RealReg>> = match call_conv {
|
||||
CallConv::Tail => unimplemented!(),
|
||||
CallConv::Fast | CallConv::Cold | CallConv::SystemV | CallConv::WasmtimeSystemV => regs
|
||||
.iter()
|
||||
.cloned()
|
||||
@@ -823,6 +824,7 @@ fn get_intreg_for_retval(
|
||||
retval_idx: usize,
|
||||
) -> Option<Reg> {
|
||||
match call_conv {
|
||||
CallConv::Tail => unimplemented!(),
|
||||
CallConv::Fast | CallConv::Cold | CallConv::SystemV => match intreg_idx {
|
||||
0 => Some(regs::rax()),
|
||||
1 => Some(regs::rdx()),
|
||||
@@ -851,6 +853,7 @@ fn get_fltreg_for_retval(
|
||||
retval_idx: usize,
|
||||
) -> Option<Reg> {
|
||||
match call_conv {
|
||||
CallConv::Tail => unimplemented!(),
|
||||
CallConv::Fast | CallConv::Cold | CallConv::SystemV => match fltreg_idx {
|
||||
0 => Some(regs::xmm0()),
|
||||
1 => Some(regs::xmm1()),
|
||||
|
||||
Reference in New Issue
Block a user