Skip to content

Commit cf304cd

Browse files
cg_gcc: rustc_abi::Abi => IrForm
1 parent 57b314f commit cf304cd

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1016,11 +1016,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10161016
OperandValue::Ref(place.val)
10171017
} else if place.layout.is_gcc_immediate() {
10181018
let load = self.load(place.layout.gcc_type(self), place.val.llval, place.val.align);
1019-
if let abi::Abi::Scalar(ref scalar) = place.layout.abi {
1019+
if let abi::IrForm::Scalar(ref scalar) = place.layout.ir_form {
10201020
scalar_load_metadata(self, load, scalar);
10211021
}
10221022
OperandValue::Immediate(self.to_immediate(load, place.layout))
1023-
} else if let abi::Abi::ScalarPair(ref a, ref b) = place.layout.abi {
1023+
} else if let abi::IrForm::ScalarPair(ref a, ref b) = place.layout.ir_form {
10241024
let b_offset = a.size(self).align_to(b.align(self).abi);
10251025

10261026
let mut load = |i, scalar: &abi::Scalar, align| {

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
294294
}
295295

296296
sym::raw_eq => {
297-
use rustc_target::abi::Abi::*;
297+
use rustc_abi::IrForm::*;
298298
let tp_ty = fn_args.type_at(0);
299299
let layout = self.layout_of(tp_ty).layout;
300300
let _use_integer_compare = match layout.abi() {
301301
Scalar(_) | ScalarPair(_, _) => true,
302302
Uninhabited | Vector { .. } => false,
303-
Aggregate { .. } => {
303+
Memory { .. } => {
304304
// For rusty ABIs, small aggregates are actually passed
305305
// as `RegKind::Integer` (see `FnAbi::adjust_for_abi`),
306306
// so we re-use that same threshold here.

compiler/rustc_codegen_gcc/src/type_of.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt::Write;
33
use gccjit::{Struct, Type};
44
use rustc_abi as abi;
55
use rustc_abi::Primitive::*;
6-
use rustc_abi::{Abi, FieldsShape, Integer, PointeeInfo, Size, Variants};
6+
use rustc_abi::{FieldsShape, Integer, IrForm, PointeeInfo, Size, Variants};
77
use rustc_codegen_ssa::traits::{
88
BaseTypeCodegenMethods, DerivedTypeCodegenMethods, LayoutTypeCodegenMethods,
99
};
@@ -60,9 +60,9 @@ fn uncached_gcc_type<'gcc, 'tcx>(
6060
layout: TyAndLayout<'tcx>,
6161
defer: &mut Option<(Struct<'gcc>, TyAndLayout<'tcx>)>,
6262
) -> Type<'gcc> {
63-
match layout.abi {
64-
Abi::Scalar(_) => bug!("handled elsewhere"),
65-
Abi::Vector { ref element, count } => {
63+
match layout.ir_form {
64+
IrForm::Scalar(_) => bug!("handled elsewhere"),
65+
IrForm::Vector { ref element, count } => {
6666
let element = layout.scalar_gcc_type_at(cx, element, Size::ZERO);
6767
let element =
6868
// NOTE: gcc doesn't allow pointer types in vectors.
@@ -74,7 +74,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
7474
};
7575
return cx.context.new_vector_type(element, count);
7676
}
77-
Abi::ScalarPair(..) => {
77+
IrForm::ScalarPair(..) => {
7878
return cx.type_struct(
7979
&[
8080
layout.scalar_pair_element_gcc_type(cx, 0),
@@ -83,7 +83,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
8383
false,
8484
);
8585
}
86-
Abi::Uninhabited | Abi::Aggregate { .. } => {}
86+
IrForm::Uninhabited | IrForm::Memory { .. } => {}
8787
}
8888

8989
let name = match *layout.ty.kind() {
@@ -176,16 +176,19 @@ pub trait LayoutGccExt<'tcx> {
176176

177177
impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
178178
fn is_gcc_immediate(&self) -> bool {
179-
match self.abi {
180-
Abi::Scalar(_) | Abi::Vector { .. } => true,
181-
Abi::ScalarPair(..) | Abi::Uninhabited | Abi::Aggregate { .. } => false,
179+
match self.ir_form {
180+
IrForm::Scalar(_) | IrForm::Vector { .. } => true,
181+
IrForm::ScalarPair(..) | IrForm::Uninhabited | IrForm::Memory { .. } => false,
182182
}
183183
}
184184

185185
fn is_gcc_scalar_pair(&self) -> bool {
186-
match self.abi {
187-
Abi::ScalarPair(..) => true,
188-
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } | Abi::Aggregate { .. } => false,
186+
match self.ir_form {
187+
IrForm::ScalarPair(..) => true,
188+
IrForm::Uninhabited
189+
| IrForm::Scalar(_)
190+
| IrForm::Vector { .. }
191+
| IrForm::Memory { .. } => false,
189192
}
190193
}
191194

@@ -205,7 +208,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
205208
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
206209
// In other words, this should generally not look at the type at all, but only at the
207210
// layout.
208-
if let Abi::Scalar(ref scalar) = self.abi {
211+
if let IrForm::Scalar(ref scalar) = self.ir_form {
209212
// Use a different cache for scalars because pointers to DSTs
210213
// can be either wide or thin (data pointers of wide pointers).
211214
if let Some(&ty) = cx.scalar_types.borrow().get(&self.ty) {
@@ -261,7 +264,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
261264
}
262265

263266
fn immediate_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc> {
264-
if let Abi::Scalar(ref scalar) = self.abi {
267+
if let IrForm::Scalar(ref scalar) = self.ir_form {
265268
if scalar.is_bool() {
266269
return cx.type_i1();
267270
}
@@ -299,8 +302,8 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
299302
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
300303
// In other words, this should generally not look at the type at all, but only at the
301304
// layout.
302-
let (a, b) = match self.abi {
303-
Abi::ScalarPair(ref a, ref b) => (a, b),
305+
let (a, b) = match self.ir_form {
306+
IrForm::ScalarPair(ref a, ref b) => (a, b),
304307
_ => bug!("TyAndLayout::scalar_pair_element_llty({:?}): not applicable", self),
305308
};
306309
let scalar = [a, b][index];

0 commit comments

Comments
 (0)