Cranelift: Remove the ABICaller trait (#4711)
* Cranelift: Remove the `ABICaller` trait It has only one implementation: the `ABICallerImpl` struct. We can just use that directly rather than having extra, unnecessary layers of generics and abstractions. * Cranelift: Rename `ABICallerImpl` to `Caller`
This commit is contained in:
@@ -24,7 +24,7 @@ use smallvec::{smallvec, SmallVec};
|
||||
pub(crate) type AArch64Callee = Callee<AArch64MachineDeps>;
|
||||
|
||||
/// Support for the AArch64 ABI from the caller side (at a callsite).
|
||||
pub(crate) type AArch64ABICaller = ABICallerImpl<AArch64MachineDeps>;
|
||||
pub(crate) type AArch64Caller = Caller<AArch64MachineDeps>;
|
||||
|
||||
/// This is the limit for the size of argument and return-value areas on the
|
||||
/// stack. We place a reasonable limit here to avoid integer overflow issues
|
||||
|
||||
@@ -605,7 +605,7 @@ pub(crate) fn lower_insn_to_regs(
|
||||
assert!(inputs.len() == sig.params.len());
|
||||
assert!(outputs.len() == sig.returns.len());
|
||||
(
|
||||
AArch64ABICaller::from_func(sig, &extname, dist, caller_conv, flags)?,
|
||||
AArch64Caller::from_func(sig, &extname, dist, caller_conv, flags)?,
|
||||
&inputs[..],
|
||||
)
|
||||
}
|
||||
@@ -615,7 +615,7 @@ pub(crate) fn lower_insn_to_regs(
|
||||
assert!(inputs.len() - 1 == sig.params.len());
|
||||
assert!(outputs.len() == sig.returns.len());
|
||||
(
|
||||
AArch64ABICaller::from_ptr(sig, ptr, op, caller_conv, flags)?,
|
||||
AArch64Caller::from_ptr(sig, ptr, op, caller_conv, flags)?,
|
||||
&inputs[1..],
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ static STACK_ARG_RET_SIZE_LIMIT: u64 = 128 * 1024 * 1024;
|
||||
pub(crate) type X64Callee = Callee<X64ABIMachineSpec>;
|
||||
|
||||
/// Support for the x64 ABI from the caller side (at a callsite).
|
||||
pub(crate) type X64ABICaller = ABICallerImpl<X64ABIMachineSpec>;
|
||||
pub(crate) type X64Caller = Caller<X64ABIMachineSpec>;
|
||||
|
||||
/// Implementation of ABI primitives for x64.
|
||||
pub struct X64ABIMachineSpec;
|
||||
|
||||
@@ -279,7 +279,7 @@ fn emit_vm_call(
|
||||
let sig = libcall.signature(call_conv);
|
||||
let caller_conv = ctx.abi().call_conv();
|
||||
|
||||
let mut abi = X64ABICaller::from_func(&sig, &extname, dist, caller_conv, flags)?;
|
||||
let mut abi = X64Caller::from_func(&sig, &extname, dist, caller_conv, flags)?;
|
||||
|
||||
abi.emit_stack_pre_adjust(ctx);
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@ use crate::{
|
||||
settings::Flags,
|
||||
unwind::UnwindInst,
|
||||
x64::{
|
||||
abi::{X64ABICaller, X64ABIMachineSpec},
|
||||
abi::{X64ABIMachineSpec, X64Caller},
|
||||
inst::{args::*, regs, CallInfo},
|
||||
settings::Flags as IsaFlags,
|
||||
},
|
||||
},
|
||||
machinst::{
|
||||
isle::*, valueregs, ABICaller, InsnInput, InsnOutput, Lower, MachAtomicRmwOp, MachInst,
|
||||
VCodeConstant, VCodeConstantData,
|
||||
isle::*, valueregs, InsnInput, InsnOutput, Lower, MachAtomicRmwOp, MachInst, VCodeConstant,
|
||||
VCodeConstantData,
|
||||
},
|
||||
};
|
||||
use regalloc2::PReg;
|
||||
@@ -673,7 +673,7 @@ impl Context for IsleContext<'_, '_, MInst, Flags, IsaFlags, 6> {
|
||||
let sig = &self.lower_ctx.dfg().signatures[sig_ref];
|
||||
let num_rets = sig.returns.len();
|
||||
let abi = ABISig::from_func_sig::<X64ABIMachineSpec>(sig, self.flags).unwrap();
|
||||
let caller = X64ABICaller::from_func(sig, &extname, dist, caller_conv, self.flags).unwrap();
|
||||
let caller = X64Caller::from_func(sig, &extname, dist, caller_conv, self.flags).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
inputs.len(&self.lower_ctx.dfg().value_lists) - off,
|
||||
@@ -695,8 +695,7 @@ impl Context for IsleContext<'_, '_, MInst, Flags, IsaFlags, 6> {
|
||||
let num_rets = sig.returns.len();
|
||||
let abi = ABISig::from_func_sig::<X64ABIMachineSpec>(sig, self.flags).unwrap();
|
||||
let caller =
|
||||
X64ABICaller::from_ptr(sig, ptr, Opcode::CallIndirect, caller_conv, self.flags)
|
||||
.unwrap();
|
||||
X64Caller::from_ptr(sig, ptr, Opcode::CallIndirect, caller_conv, self.flags).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
inputs.len(&self.lower_ctx.dfg().value_lists) - off,
|
||||
@@ -807,7 +806,7 @@ impl IsleContext<'_, '_, MInst, Flags, IsaFlags, 6> {
|
||||
&mut self,
|
||||
abi: ABISig,
|
||||
num_rets: usize,
|
||||
mut caller: X64ABICaller,
|
||||
mut caller: X64Caller,
|
||||
(inputs, off): ValueSlice,
|
||||
) -> InstOutput {
|
||||
caller.emit_stack_pre_adjust(self.lower_ctx);
|
||||
|
||||
Reference in New Issue
Block a user