|
@ -400,7 +400,7 @@ pub trait ABIMachineSpec { |
|
|
args_or_rets: ArgsOrRets, |
|
|
args_or_rets: ArgsOrRets, |
|
|
add_ret_area_ptr: bool, |
|
|
add_ret_area_ptr: bool, |
|
|
args: ArgsAccumulator<'_>, |
|
|
args: ArgsAccumulator<'_>, |
|
|
) -> CodegenResult<(i64, Option<usize>)> |
|
|
) -> CodegenResult<(u32, Option<usize>)> |
|
|
where |
|
|
where |
|
|
I: IntoIterator<Item = &'a ir::AbiParam>; |
|
|
I: IntoIterator<Item = &'a ir::AbiParam>; |
|
|
|
|
|
|
|
@ -643,11 +643,13 @@ pub struct SigData { |
|
|
/// This is a index into the `SigSet::abi_args`.
|
|
|
/// This is a index into the `SigSet::abi_args`.
|
|
|
rets_end: u32, |
|
|
rets_end: u32, |
|
|
|
|
|
|
|
|
/// Space on stack used to store arguments.
|
|
|
/// Space on stack used to store arguments. We're storing the size in u32 to
|
|
|
sized_stack_arg_space: i64, |
|
|
/// reduce the size of the struct.
|
|
|
|
|
|
sized_stack_arg_space: u32, |
|
|
|
|
|
|
|
|
/// Space on stack used to store return values.
|
|
|
/// Space on stack used to store return values. We're storing the size in u32 to
|
|
|
sized_stack_ret_space: i64, |
|
|
/// reduce the size of the struct.
|
|
|
|
|
|
sized_stack_ret_space: u32, |
|
|
|
|
|
|
|
|
/// Index in `args` of the stack-return-value-area argument.
|
|
|
/// Index in `args` of the stack-return-value-area argument.
|
|
|
stack_ret_arg: Option<u16>, |
|
|
stack_ret_arg: Option<u16>, |
|
@ -659,12 +661,12 @@ pub struct SigData { |
|
|
impl SigData { |
|
|
impl SigData { |
|
|
/// Get total stack space required for arguments.
|
|
|
/// Get total stack space required for arguments.
|
|
|
pub fn sized_stack_arg_space(&self) -> i64 { |
|
|
pub fn sized_stack_arg_space(&self) -> i64 { |
|
|
self.sized_stack_arg_space |
|
|
self.sized_stack_arg_space.into() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Get total stack space required for return values.
|
|
|
/// Get total stack space required for return values.
|
|
|
pub fn sized_stack_ret_space(&self) -> i64 { |
|
|
pub fn sized_stack_ret_space(&self) -> i64 { |
|
|
self.sized_stack_ret_space |
|
|
self.sized_stack_ret_space.into() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Get calling convention used.
|
|
|
/// Get calling convention used.
|
|
@ -1920,7 +1922,7 @@ impl<M: ABIMachineSpec> Callee<M> { |
|
|
|
|
|
|
|
|
/// Returns the size of arguments expected on the stack.
|
|
|
/// Returns the size of arguments expected on the stack.
|
|
|
pub fn stack_args_size(&self, sigs: &SigSet) -> u32 { |
|
|
pub fn stack_args_size(&self, sigs: &SigSet) -> u32 { |
|
|
sigs[self.sig].sized_stack_arg_space as u32 |
|
|
sigs[self.sig].sized_stack_arg_space |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Get the spill-slot size.
|
|
|
/// Get the spill-slot size.
|
|
@ -2324,7 +2326,7 @@ impl<M: ABIMachineSpec> Caller<M> { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
&ABIArgSlot::Stack { offset, ty, .. } => { |
|
|
&ABIArgSlot::Stack { offset, ty, .. } => { |
|
|
let ret_area_base = ctx.sigs()[self.sig].sized_stack_arg_space; |
|
|
let ret_area_base = ctx.sigs()[self.sig].sized_stack_arg_space(); |
|
|
insts.push(M::gen_load_stack( |
|
|
insts.push(M::gen_load_stack( |
|
|
StackAMode::SPOffset(offset + ret_area_base, ty), |
|
|
StackAMode::SPOffset(offset + ret_area_base, ty), |
|
|
*into_reg, |
|
|
*into_reg, |
|
@ -2361,7 +2363,7 @@ impl<M: ABIMachineSpec> Caller<M> { |
|
|
let word_type = M::word_type(); |
|
|
let word_type = M::word_type(); |
|
|
if let Some(i) = ctx.sigs()[self.sig].stack_ret_arg { |
|
|
if let Some(i) = ctx.sigs()[self.sig].stack_ret_arg { |
|
|
let rd = ctx.alloc_tmp(word_type).only_reg().unwrap(); |
|
|
let rd = ctx.alloc_tmp(word_type).only_reg().unwrap(); |
|
|
let ret_area_base = ctx.sigs()[self.sig].sized_stack_arg_space; |
|
|
let ret_area_base = ctx.sigs()[self.sig].sized_stack_arg_space(); |
|
|
ctx.emit(M::gen_get_stack_addr( |
|
|
ctx.emit(M::gen_get_stack_addr( |
|
|
StackAMode::SPOffset(ret_area_base, I8), |
|
|
StackAMode::SPOffset(ret_area_base, I8), |
|
|
rd, |
|
|
rd, |
|
@ -2403,6 +2405,6 @@ mod tests { |
|
|
fn sig_data_size() { |
|
|
fn sig_data_size() { |
|
|
// The size of `SigData` is performance sensitive, so make sure
|
|
|
// The size of `SigData` is performance sensitive, so make sure
|
|
|
// we don't regress it unintentionally.
|
|
|
// we don't regress it unintentionally.
|
|
|
assert_eq!(std::mem::size_of::<SigData>(), 32); |
|
|
assert_eq!(std::mem::size_of::<SigData>(), 24); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|