fix gcc, cranelift build

This commit is contained in:
Ralf Jung 2023-09-09 09:23:56 +02:00
parent 89f0d18bc8
commit f9f8bffaec
2 changed files with 8 additions and 8 deletions

View File

@ -100,7 +100,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
} }
_ => unreachable!("{:?}", self.layout.abi), _ => unreachable!("{:?}", self.layout.abi),
}, },
PassMode::Cast(ref cast, pad_i32) => { PassMode::Cast { ref cast, pad_i32 } => {
assert!(!pad_i32, "padding support not yet implemented"); assert!(!pad_i32, "padding support not yet implemented");
cast_target_to_abi_params(cast) cast_target_to_abi_params(cast)
} }
@ -148,7 +148,7 @@ fn get_abi_return(&self, tcx: TyCtxt<'tcx>) -> (Option<AbiParam>, Vec<AbiParam>)
} }
_ => unreachable!("{:?}", self.layout.abi), _ => unreachable!("{:?}", self.layout.abi),
}, },
PassMode::Cast(ref cast, _) => { PassMode::Cast { ref cast, .. } => {
(None, cast_target_to_abi_params(cast).into_iter().collect()) (None, cast_target_to_abi_params(cast).into_iter().collect())
} }
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack } => { PassMode::Indirect { attrs: _, meta_attrs: None, on_stack } => {
@ -229,7 +229,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
let (a, b) = arg.load_scalar_pair(fx); let (a, b) = arg.load_scalar_pair(fx);
smallvec![a, b] smallvec![a, b]
} }
PassMode::Cast(ref cast, _) => to_casted_value(fx, arg, cast), PassMode::Cast { ref cast, .. } => to_casted_value(fx, arg, cast),
PassMode::Indirect { .. } => { PassMode::Indirect { .. } => {
if is_owned { if is_owned {
match arg.force_stack(fx) { match arg.force_stack(fx) {
@ -287,7 +287,7 @@ pub(super) fn cvalue_for_param<'tcx>(
assert_eq!(block_params.len(), 2, "{:?}", block_params); assert_eq!(block_params.len(), 2, "{:?}", block_params);
Some(CValue::by_val_pair(block_params[0], block_params[1], arg_abi.layout)) Some(CValue::by_val_pair(block_params[0], block_params[1], arg_abi.layout))
} }
PassMode::Cast(ref cast, _) => { PassMode::Cast { ref cast, .. } => {
Some(from_casted_value(fx, &block_params, arg_abi.layout, cast)) Some(from_casted_value(fx, &block_params, arg_abi.layout, cast))
} }
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => { PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {

View File

@ -13,7 +13,7 @@ pub(super) fn codegen_return_param<'tcx>(
block_params_iter: &mut impl Iterator<Item = Value>, block_params_iter: &mut impl Iterator<Item = Value>,
) -> CPlace<'tcx> { ) -> CPlace<'tcx> {
let (ret_place, ret_param): (_, SmallVec<[_; 2]>) = match fx.fn_abi.as_ref().unwrap().ret.mode { let (ret_place, ret_param): (_, SmallVec<[_; 2]>) = match fx.fn_abi.as_ref().unwrap().ret.mode {
PassMode::Ignore | PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(..) => { PassMode::Ignore | PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast { .. } => {
let is_ssa = let is_ssa =
ssa_analyzed[RETURN_PLACE].is_ssa(fx, fx.fn_abi.as_ref().unwrap().ret.layout.ty); ssa_analyzed[RETURN_PLACE].is_ssa(fx, fx.fn_abi.as_ref().unwrap().ret.layout.ty);
( (
@ -76,7 +76,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => { PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
unreachable!("unsized return value") unreachable!("unsized return value")
} }
PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(..) => (None, None), PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast { .. } => (None, None),
}; };
let call_inst = f(fx, return_ptr); let call_inst = f(fx, return_ptr);
@ -93,7 +93,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
ret_place ret_place
.write_cvalue(fx, CValue::by_val_pair(ret_val_a, ret_val_b, ret_arg_abi.layout)); .write_cvalue(fx, CValue::by_val_pair(ret_val_a, ret_val_b, ret_arg_abi.layout));
} }
PassMode::Cast(ref cast, _) => { PassMode::Cast { ref cast, .. } => {
let results = let results =
fx.bcx.inst_results(call_inst).iter().copied().collect::<SmallVec<[Value; 2]>>(); fx.bcx.inst_results(call_inst).iter().copied().collect::<SmallVec<[Value; 2]>>();
let result = let result =
@ -132,7 +132,7 @@ pub(crate) fn codegen_return(fx: &mut FunctionCx<'_, '_, '_>) {
let (ret_val_a, ret_val_b) = place.to_cvalue(fx).load_scalar_pair(fx); let (ret_val_a, ret_val_b) = place.to_cvalue(fx).load_scalar_pair(fx);
fx.bcx.ins().return_(&[ret_val_a, ret_val_b]); fx.bcx.ins().return_(&[ret_val_a, ret_val_b]);
} }
PassMode::Cast(ref cast, _) => { PassMode::Cast { ref cast, .. } => {
let place = fx.get_local_place(RETURN_PLACE); let place = fx.get_local_place(RETURN_PLACE);
let ret_val = place.to_cvalue(fx); let ret_val = place.to_cvalue(fx);
let ret_vals = super::pass_mode::to_casted_value(fx, ret_val, cast); let ret_vals = super::pass_mode::to_casted_value(fx, ret_val, cast);