@@ -3,7 +3,7 @@ use std::fmt::Write;
3
3
use gccjit::{Struct, Type};
4
4
use rustc_abi as abi;
5
5
use rustc_abi::Primitive::*;
6
- use rustc_abi::{Abi, FieldsShape, Integer, PointeeInfo, Size, Variants};
6
+ use rustc_abi::{FieldsShape, Integer, IrForm , PointeeInfo, Size, Variants};
7
7
use rustc_codegen_ssa::traits::{
8
8
BaseTypeCodegenMethods, DerivedTypeCodegenMethods, LayoutTypeCodegenMethods,
9
9
};
@@ -60,9 +60,9 @@ fn uncached_gcc_type<'gcc, 'tcx>(
60
60
layout: TyAndLayout<'tcx>,
61
61
defer: &mut Option<(Struct<'gcc>, TyAndLayout<'tcx>)>,
62
62
) -> 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 } => {
66
66
let element = layout.scalar_gcc_type_at(cx, element, Size::ZERO);
67
67
let element =
68
68
// NOTE: gcc doesn't allow pointer types in vectors.
@@ -74,7 +74,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
74
74
};
75
75
return cx.context.new_vector_type(element, count);
76
76
}
77
- Abi ::ScalarPair(..) => {
77
+ IrForm ::ScalarPair(..) => {
78
78
return cx.type_struct(
79
79
&[
80
80
layout.scalar_pair_element_gcc_type(cx, 0),
@@ -83,7 +83,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
83
83
false,
84
84
);
85
85
}
86
- Abi ::Uninhabited | Abi::Aggregate { .. } => {}
86
+ IrForm ::Uninhabited | IrForm::Memory { .. } => {}
87
87
}
88
88
89
89
let name = match *layout.ty.kind() {
@@ -176,16 +176,19 @@ pub trait LayoutGccExt<'tcx> {
176
176
177
177
impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
178
178
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,
182
182
}
183
183
}
184
184
185
185
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,
189
192
}
190
193
}
191
194
@@ -205,7 +208,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
205
208
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
206
209
// In other words, this should generally not look at the type at all, but only at the
207
210
// layout.
208
- if let Abi ::Scalar(ref scalar) = self.abi {
211
+ if let IrForm ::Scalar(ref scalar) = self.ir_form {
209
212
// Use a different cache for scalars because pointers to DSTs
210
213
// can be either wide or thin (data pointers of wide pointers).
211
214
if let Some(&ty) = cx.scalar_types.borrow().get(&self.ty) {
@@ -261,7 +264,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
261
264
}
262
265
263
266
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 {
265
268
if scalar.is_bool() {
266
269
return cx.type_i1();
267
270
}
@@ -299,8 +302,8 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
299
302
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
300
303
// In other words, this should generally not look at the type at all, but only at the
301
304
// 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),
304
307
_ => bug!("TyAndLayout::scalar_pair_element_llty({:?}): not applicable", self),
305
308
};
306
309
let scalar = [a, b][index];
0 commit comments