Skip to content

Commit 29a4b7b

Browse files
committed
fix gcc, cranelift build
1 parent 89139d4 commit 29a4b7b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
100100
}
101101
_ => unreachable!("{:?}", self.layout.abi),
102102
},
103-
PassMode::Cast(ref cast, pad_i32) => {
103+
PassMode::Cast { ref cast, pad_i32 } => {
104104
assert!(!pad_i32, "padding support not yet implemented");
105105
cast_target_to_abi_params(cast)
106106
}
@@ -148,7 +148,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
148148
}
149149
_ => unreachable!("{:?}", self.layout.abi),
150150
},
151-
PassMode::Cast(ref cast, _) => {
151+
PassMode::Cast { ref cast, .. } => {
152152
(None, cast_target_to_abi_params(cast).into_iter().collect())
153153
}
154154
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack } => {
@@ -229,7 +229,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
229229
let (a, b) = arg.load_scalar_pair(fx);
230230
smallvec![a, b]
231231
}
232-
PassMode::Cast(ref cast, _) => to_casted_value(fx, arg, cast),
232+
PassMode::Cast { ref cast, .. } => to_casted_value(fx, arg, cast),
233233
PassMode::Indirect { .. } => {
234234
if is_owned {
235235
match arg.force_stack(fx) {
@@ -287,7 +287,7 @@ pub(super) fn cvalue_for_param<'tcx>(
287287
assert_eq!(block_params.len(), 2, "{:?}", block_params);
288288
Some(CValue::by_val_pair(block_params[0], block_params[1], arg_abi.layout))
289289
}
290-
PassMode::Cast(ref cast, _) => {
290+
PassMode::Cast { ref cast, .. } => {
291291
Some(from_casted_value(fx, &block_params, arg_abi.layout, cast))
292292
}
293293
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {

compiler/rustc_codegen_cranelift/src/abi/returning.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(super) fn codegen_return_param<'tcx>(
1313
block_params_iter: &mut impl Iterator<Item = Value>,
1414
) -> CPlace<'tcx> {
1515
let (ret_place, ret_param): (_, SmallVec<[_; 2]>) = match fx.fn_abi.as_ref().unwrap().ret.mode {
16-
PassMode::Ignore | PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(..) => {
16+
PassMode::Ignore | PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast { .. } => {
1717
let is_ssa =
1818
ssa_analyzed[RETURN_PLACE].is_ssa(fx, fx.fn_abi.as_ref().unwrap().ret.layout.ty);
1919
(
@@ -76,7 +76,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
7676
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
7777
unreachable!("unsized return value")
7878
}
79-
PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(..) => (None, None),
79+
PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast { .. } => (None, None),
8080
};
8181

8282
let call_inst = f(fx, return_ptr);
@@ -93,7 +93,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
9393
ret_place
9494
.write_cvalue(fx, CValue::by_val_pair(ret_val_a, ret_val_b, ret_arg_abi.layout));
9595
}
96-
PassMode::Cast(ref cast, _) => {
96+
PassMode::Cast { ref cast, .. } => {
9797
let results =
9898
fx.bcx.inst_results(call_inst).iter().copied().collect::<SmallVec<[Value; 2]>>();
9999
let result =
@@ -132,7 +132,7 @@ pub(crate) fn codegen_return(fx: &mut FunctionCx<'_, '_, '_>) {
132132
let (ret_val_a, ret_val_b) = place.to_cvalue(fx).load_scalar_pair(fx);
133133
fx.bcx.ins().return_(&[ret_val_a, ret_val_b]);
134134
}
135-
PassMode::Cast(ref cast, _) => {
135+
PassMode::Cast { ref cast, .. } => {
136136
let place = fx.get_local_place(RETURN_PLACE);
137137
let ret_val = place.to_cvalue(fx);
138138
let ret_vals = super::pass_mode::to_casted_value(fx, ret_val, cast);

compiler/rustc_codegen_gcc/src/abi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
113113
match self.ret.mode {
114114
PassMode::Ignore => cx.type_void(),
115115
PassMode::Direct(_) | PassMode::Pair(..) => self.ret.layout.immediate_gcc_type(cx),
116-
PassMode::Cast(ref cast, _) => cast.gcc_type(cx),
116+
PassMode::Cast { ref cast, .. } => cast.gcc_type(cx),
117117
PassMode::Indirect { .. } => {
118118
argument_tys.push(cx.type_ptr_to(self.ret.memory_ty(cx)));
119119
cx.type_void()
@@ -132,7 +132,7 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
132132
PassMode::Indirect { meta_attrs: Some(_), .. } => {
133133
unimplemented!();
134134
}
135-
PassMode::Cast(ref cast, pad_i32) => {
135+
PassMode::Cast { ref cast, pad_i32 } => {
136136
// add padding
137137
if pad_i32 {
138138
argument_tys.push(Reg::i32().gcc_type(cx));

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
144144
sym::volatile_load | sym::unaligned_volatile_load => {
145145
let tp_ty = fn_args.type_at(0);
146146
let mut ptr = args[0].immediate();
147-
if let PassMode::Cast(ty, _) = &fn_abi.ret.mode {
147+
if let PassMode::Cast { cast: ty, .. } = &fn_abi.ret.mode {
148148
ptr = self.pointercast(ptr, self.type_ptr_to(ty.gcc_type(self)));
149149
}
150150
let load = self.volatile_load(ptr.get_type(), ptr);
@@ -353,7 +353,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
353353
};
354354

355355
if !fn_abi.ret.is_ignore() {
356-
if let PassMode::Cast(ty, _) = &fn_abi.ret.mode {
356+
if let PassMode::Cast { cast: ty, .. } = &fn_abi.ret.mode {
357357
let ptr_llty = self.type_ptr_to(ty.gcc_type(self));
358358
let ptr = self.pointercast(result.llval, ptr_llty);
359359
self.store(llval, ptr, result.align);
@@ -449,7 +449,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
449449
else if self.is_unsized_indirect() {
450450
bug!("unsized `ArgAbi` must be handled through `store_fn_arg`");
451451
}
452-
else if let PassMode::Cast(ref cast, _) = self.mode {
452+
else if let PassMode::Cast { ref cast, .. } = self.mode {
453453
// FIXME(eddyb): Figure out when the simpler Store is safe, clang
454454
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
455455
let can_store_through_cast_ptr = false;
@@ -514,7 +514,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
514514
PassMode::Indirect { meta_attrs: Some(_), .. } => {
515515
OperandValue::Ref(next(), Some(next()), self.layout.align.abi).store(bx, dst);
516516
},
517-
PassMode::Direct(_) | PassMode::Indirect { meta_attrs: None, .. } | PassMode::Cast(..) => {
517+
PassMode::Direct(_) | PassMode::Indirect { meta_attrs: None, .. } | PassMode::Cast { .. } => {
518518
let next_arg = next();
519519
self.store(bx, next_arg, dst);
520520
},

0 commit comments

Comments
 (0)