Skip to content

Commit

Permalink
Issue-6592: ArgsAccumulator should match entry block params (bytecode…
Browse files Browse the repository at this point in the history
…alliance#6613)

* issue-6592: args accumulator match entry block params

* Formatting

* Formatting

* added push_non_formal to aarch64 and x86 implementations of add_ret_area_ptr case in compute_arg_locs

---------

Co-authored-by: Cameron <cameron@Camerons-MacBook-Pro.local>
  • Loading branch information
ilikepi63 and Cameron authored Jun 22, 2023
1 parent 2b3f56b commit 48e140d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cranelift/codegen/src/isa/aarch64/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,14 @@ impl ABIMachineSpec for AArch64MachineDeps {
let extra_arg = if add_ret_area_ptr {
debug_assert!(args_or_rets == ArgsOrRets::Args);
if next_xreg < max_per_class_reg_vals && remaining_reg_vals > 0 {
args.push(ABIArg::reg(
args.push_non_formal(ABIArg::reg(
xreg(next_xreg).to_real_reg().unwrap(),
I64,
ir::ArgumentExtension::None,
ir::ArgumentPurpose::Normal,
));
} else {
args.push(ABIArg::stack(
args.push_non_formal(ABIArg::stack(
next_stack as i64,
I64,
ir::ArgumentExtension::None,
Expand Down
4 changes: 2 additions & 2 deletions cranelift/codegen/src/isa/x64/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ impl ABIMachineSpec for X64ABIMachineSpec {
let extra_arg = if add_ret_area_ptr {
debug_assert!(args_or_rets == ArgsOrRets::Args);
if let Some(reg) = get_intreg_for_arg(&call_conv, next_gpr, next_param_idx) {
args.push(ABIArg::reg(
args.push_non_formal(ABIArg::reg(
reg.to_real_reg().unwrap(),
types::I64,
ir::ArgumentExtension::None,
ir::ArgumentPurpose::Normal,
));
} else {
args.push(ABIArg::stack(
args.push_non_formal(ABIArg::stack(
next_stack as i64,
types::I64,
ir::ArgumentExtension::None,
Expand Down
9 changes: 9 additions & 0 deletions cranelift/codegen/src/machinst/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ pub trait IsaFlags: Clone {
pub struct ArgsAccumulator<'a> {
sig_set_abi_args: &'a mut Vec<ABIArg>,
start: usize,
non_formal_flag: bool,
}

impl<'a> ArgsAccumulator<'a> {
Expand All @@ -330,11 +331,19 @@ impl<'a> ArgsAccumulator<'a> {
ArgsAccumulator {
sig_set_abi_args,
start,
non_formal_flag: false,
}
}

#[inline]
pub fn push(&mut self, arg: ABIArg) {
debug_assert!(!self.non_formal_flag);
self.sig_set_abi_args.push(arg)
}

#[inline]
pub fn push_non_formal(&mut self, arg: ABIArg) {
self.non_formal_flag = true;
self.sig_set_abi_args.push(arg)
}

Expand Down

0 comments on commit 48e140d

Please sign in to comment.