From 3ca173e4bcf2a17828b072c443eb7b3d28fb1f0f Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Fri, 2 Oct 2020 11:55:46 -0700 Subject: [PATCH] Fix arm32 build after some ABI framework changes. It turns out that while we don't have the partial/experimental arm32 backend tested on our CI yet, the Firefox build *does* at least rely on the backend to build, because it specifies the `arm32` feature to `cranelift-codegen`, even if it will never invoke the backend. Our previous old-framework arm32 stub at least compiled, so it didn't break Firefox. We should probably add a CI build check to ensure we don't bitrot what we have here, but this is the immediate fix to get us back to sanity. --- cranelift/codegen/src/isa/arm32/abi.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/cranelift/codegen/src/isa/arm32/abi.rs b/cranelift/codegen/src/isa/arm32/abi.rs index d50eafb719..54f0d3e6a8 100644 --- a/cranelift/codegen/src/isa/arm32/abi.rs +++ b/cranelift/codegen/src/isa/arm32/abi.rs @@ -81,6 +81,7 @@ impl ABIMachineSpec for Arm32MachineDeps { reg.to_real_reg(), param.value_type, param.extension, + param.purpose, )); next_rreg += 1; } else { @@ -88,7 +89,7 @@ impl ABIMachineSpec for Arm32MachineDeps { // https://static.docs.arm.com/ihi0042/g/aapcs32.pdf // Stack offset is not known yet. Store param info for later. - stack_args.push((param.value_type, param.extension)); + stack_args.push((param.value_type, param.extension, param.purpose)); next_stack += 4; } } @@ -100,9 +101,14 @@ impl ABIMachineSpec for Arm32MachineDeps { rreg(next_rreg).to_real_reg(), I32, ir::ArgumentExtension::None, + ir::ArgumentPurpose::Normal, )); } else { - stack_args.push((I32, ir::ArgumentExtension::None)); + stack_args.push(( + I32, + ir::ArgumentExtension::None, + ir::ArgumentPurpose::Normal, + )); next_stack += 4; } Some(ret.len() - 1) @@ -112,9 +118,14 @@ impl ABIMachineSpec for Arm32MachineDeps { // Now we can assign proper stack offsets to params. let max_stack = next_stack; - for (ty, ext) in stack_args.into_iter().rev() { + for (ty, ext, purpose) in stack_args.into_iter().rev() { next_stack -= 4; - ret.push(ABIArg::Stack((max_stack - next_stack) as i64, ty, ext)); + ret.push(ABIArg::Stack( + (max_stack - next_stack) as i64, + ty, + ext, + purpose, + )); } assert_eq!(next_stack, 0); @@ -294,9 +305,14 @@ impl ABIMachineSpec for Arm32MachineDeps { /// nominal SP offset; caller will do that. fn gen_clobber_save( _call_conv: isa::CallConv, + _flags: &settings::Flags, clobbers: &Set>, + fixed_frame_storage_size: u32, ) -> (u64, SmallVec<[Inst; 16]>) { let mut insts = SmallVec::new(); + if fixed_frame_storage_size > 0 { + insts.extend(Self::gen_sp_reg_adjust(-(fixed_frame_storage_size as i32)).into_iter()); + } let clobbered_vec = get_callee_saves(clobbers); let mut clobbered_vec: Vec<_> = clobbered_vec .into_iter() @@ -318,6 +334,7 @@ impl ABIMachineSpec for Arm32MachineDeps { fn gen_clobber_restore( _call_conv: isa::CallConv, + _flags: &settings::Flags, clobbers: &Set>, ) -> SmallVec<[Inst; 16]> { let mut insts = SmallVec::new();