Skip to content

Commit

Permalink
cranelift-codegen: Rename abi::Caller to abi::CallSite
Browse files Browse the repository at this point in the history
Will be less confusing since each call site has both a caller and a callee.
  • Loading branch information
fitzgen committed May 18, 2023
1 parent 6554077 commit 40d0b8d
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/aarch64/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 AArch64Caller = Caller<AArch64MachineDeps>;
pub(crate) type AArch64CallSite = CallSite<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
Expand Down
6 changes: 3 additions & 3 deletions cranelift/codegen/src/isa/aarch64/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
immediates::*, types::*, AtomicRmwOp, BlockCall, ExternalName, Inst, InstructionData,
MemFlags, TrapCode, Value, ValueList,
},
isa::aarch64::abi::AArch64Caller,
isa::aarch64::abi::AArch64CallSite,
isa::aarch64::inst::args::{ShiftOp, ShiftOpShiftImm},
isa::unwind::UnwindInst,
machinst::{
Expand Down Expand Up @@ -76,12 +76,12 @@ pub struct ExtendedValue {
}

impl IsleContext<'_, '_, MInst, AArch64Backend> {
isle_prelude_method_helpers!(AArch64Caller);
isle_prelude_method_helpers!(AArch64CallSite);
}

impl Context for IsleContext<'_, '_, MInst, AArch64Backend> {
isle_lower_prelude_methods!();
isle_prelude_caller_methods!(crate::isa::aarch64::abi::AArch64MachineDeps, AArch64Caller);
isle_prelude_caller_methods!(crate::isa::aarch64::abi::AArch64MachineDeps, AArch64CallSite);

fn sign_return_address_disabled(&mut self) -> Option<()> {
if self.backend.isa_flags.sign_return_address() {
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/riscv64/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use smallvec::{smallvec, SmallVec};
pub(crate) type Riscv64Callee = Callee<Riscv64MachineDeps>;

/// Support for the Riscv64 ABI from the caller side (at a callsite).
pub(crate) type Riscv64ABICaller = Caller<Riscv64MachineDeps>;
pub(crate) type Riscv64ABICallSite = CallSite<Riscv64MachineDeps>;

/// 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
Expand Down
6 changes: 3 additions & 3 deletions cranelift/codegen/src/isa/riscv64/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use generated_code::{Context, ExtendOp, MInst};

// Types that the generated ISLE code uses via `use super::*`.
use super::{writable_zero_reg, zero_reg};
use crate::isa::riscv64::abi::Riscv64ABICaller;
use crate::isa::riscv64::abi::Riscv64ABICallSite;
use crate::isa::riscv64::Riscv64Backend;
use crate::machinst::Reg;
use crate::machinst::{isle::*, MachInst, SmallInstVec};
Expand Down Expand Up @@ -46,7 +46,7 @@ where
}

impl<'a, 'b> RV64IsleContext<'a, 'b, MInst, Riscv64Backend> {
isle_prelude_method_helpers!(Riscv64ABICaller);
isle_prelude_method_helpers!(Riscv64ABICallSite);

fn new(lower_ctx: &'a mut Lower<'b, MInst>, backend: &'a Riscv64Backend) -> Self {
Self {
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'a, 'b> RV64IsleContext<'a, 'b, MInst, Riscv64Backend> {

impl generated_code::Context for RV64IsleContext<'_, '_, MInst, Riscv64Backend> {
isle_lower_prelude_methods!();
isle_prelude_caller_methods!(Riscv64MachineDeps, Riscv64ABICaller);
isle_prelude_caller_methods!(Riscv64MachineDeps, Riscv64ABICallSite);

fn vec_writable_to_regs(&mut self, val: &VecWritableReg) -> ValueRegs {
match val.len() {
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/x64/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static STACK_ARG_RET_SIZE_LIMIT: u32 = 128 * 1024 * 1024;
pub(crate) type X64Callee = Callee<X64ABIMachineSpec>;

/// Support for the x64 ABI from the caller side (at a callsite).
pub(crate) type X64Caller = Caller<X64ABIMachineSpec>;
pub(crate) type X64CallSite = CallSite<X64ABIMachineSpec>;

/// Implementation of ABI primitives for x64.
pub struct X64ABIMachineSpec;
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/x64/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ fn emit_vm_call(
}

let mut abi =
X64Caller::from_libcall(ctx.sigs(), &sig, &extname, dist, caller_conv, flags.clone())?;
X64CallSite::from_libcall(ctx.sigs(), &sig, &extname, dist, caller_conv, flags.clone())?;

abi.emit_stack_pre_adjust(ctx);

Expand Down
6 changes: 3 additions & 3 deletions cranelift/codegen/src/isa/x64/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
isa::{
unwind::UnwindInst,
x64::{
abi::X64Caller,
abi::X64CallSite,
inst::{args::*, regs, CallInfo},
},
},
Expand Down Expand Up @@ -77,7 +77,7 @@ pub(crate) fn lower_branch(

impl Context for IsleContext<'_, '_, MInst, X64Backend> {
isle_lower_prelude_methods!();
isle_prelude_caller_methods!(X64ABIMachineSpec, X64Caller);
isle_prelude_caller_methods!(X64ABIMachineSpec, X64CallSite);

#[inline]
fn operand_size_of_type_32_64(&mut self, ty: Type) -> OperandSize {
Expand Down Expand Up @@ -1070,7 +1070,7 @@ impl Context for IsleContext<'_, '_, MInst, X64Backend> {
}

impl IsleContext<'_, '_, MInst, X64Backend> {
isle_prelude_method_helpers!(X64Caller);
isle_prelude_method_helpers!(X64CallSite);

fn load_xmm_unaligned(&mut self, addr: SyntheticAmode) -> Xmm {
let tmp = self.lower_ctx.alloc_tmp(types::F32X4).only_reg().unwrap();
Expand Down
20 changes: 10 additions & 10 deletions cranelift/codegen/src/machinst/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,7 @@ pub type CallArgList = SmallVec<[CallArgPair; 8]>;
pub type CallRetList = SmallVec<[CallRetPair; 8]>;

/// ABI object for a callsite.
pub struct Caller<M: ABIMachineSpec> {
pub struct CallSite<M: ABIMachineSpec> {
/// The called function's signature.
sig: Sig,
/// All register uses for the callsite, i.e., function args, with
Expand Down Expand Up @@ -2018,7 +2018,7 @@ pub enum CallDest {
Reg(Reg),
}

impl<M: ABIMachineSpec> Caller<M> {
impl<M: ABIMachineSpec> CallSite<M> {
/// Create a callsite ABI object for a call directly to the specified function.
pub fn from_func(
sigs: &SigSet,
Expand All @@ -2027,10 +2027,10 @@ impl<M: ABIMachineSpec> Caller<M> {
dist: RelocDistance,
caller_conv: isa::CallConv,
flags: settings::Flags,
) -> CodegenResult<Caller<M>> {
) -> CodegenResult<CallSite<M>> {
let sig = sigs.abi_sig_for_sig_ref(sig_ref);
let clobbers = sigs.call_clobbers::<M>(sig);
Ok(Caller {
Ok(CallSite {
sig,
uses: smallvec![],
defs: smallvec![],
Expand All @@ -2052,10 +2052,10 @@ impl<M: ABIMachineSpec> Caller<M> {
dist: RelocDistance,
caller_conv: isa::CallConv,
flags: settings::Flags,
) -> CodegenResult<Caller<M>> {
) -> CodegenResult<CallSite<M>> {
let sig = sigs.abi_sig_for_signature(sig);
let clobbers = sigs.call_clobbers::<M>(sig);
Ok(Caller {
Ok(CallSite {
sig,
uses: smallvec![],
defs: smallvec![],
Expand All @@ -2077,10 +2077,10 @@ impl<M: ABIMachineSpec> Caller<M> {
opcode: ir::Opcode,
caller_conv: isa::CallConv,
flags: settings::Flags,
) -> CodegenResult<Caller<M>> {
) -> CodegenResult<CallSite<M>> {
let sig = sigs.abi_sig_for_sig_ref(sig_ref);
let clobbers = sigs.call_clobbers::<M>(sig);
Ok(Caller {
Ok(CallSite {
sig,
uses: smallvec![],
defs: smallvec![],
Expand All @@ -2105,7 +2105,7 @@ fn adjust_stack_and_nominal_sp<M: ABIMachineSpec>(ctx: &mut Lower<M::I>, off: i3
ctx.emit(M::gen_nominal_sp_adj(-amt));
}

impl<M: ABIMachineSpec> Caller<M> {
impl<M: ABIMachineSpec> CallSite<M> {
/// Get the number of arguments expected.
pub fn num_args(&self, sigs: &SigSet) -> usize {
sigs.num_args(self.sig)
Expand Down Expand Up @@ -2358,7 +2358,7 @@ impl<M: ABIMachineSpec> Caller<M> {
/// sense.)
///
/// This function should only be called once, as it is allowed to re-use
/// parts of the `Caller` object in emitting instructions.
/// parts of the `CallSite` object in emitting instructions.
pub fn emit_call(&mut self, ctx: &mut Lower<M::I>) {
let word_type = M::word_type();
if let Some(i) = ctx.sigs()[self.sig].stack_ret_arg {
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/machinst/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ pub fn shuffle_imm_as_le_lane_idx(size: u8, bytes: &[u8]) -> Option<u8> {
Some(bytes[0] / size)
}

/// Helpers specifically for machines that use ABICaller.
/// Helpers specifically for machines that use `abi::CallSite`.
#[macro_export]
#[doc(hidden)]
macro_rules! isle_prelude_caller_methods {
Expand Down

0 comments on commit 40d0b8d

Please sign in to comment.