@@ -4,7 +4,7 @@ use std::fmt;
4
4
use arrayvec:: ArrayVec ;
5
5
use either:: Either ;
6
6
use rustc_abi as abi;
7
- use rustc_abi:: { Abi , Align , Size } ;
7
+ use rustc_abi:: { Align , IrForm , Size } ;
8
8
use rustc_middle:: bug;
9
9
use rustc_middle:: mir:: interpret:: { Pointer , Scalar , alloc_range} ;
10
10
use rustc_middle:: mir:: { self , ConstValue } ;
@@ -163,15 +163,15 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
163
163
164
164
let val = match val {
165
165
ConstValue :: Scalar ( x) => {
166
- let Abi :: Scalar ( scalar) = layout. abi else {
166
+ let IrForm :: Scalar ( scalar) = layout. ir_form else {
167
167
bug ! ( "from_const: invalid ByVal layout: {:#?}" , layout) ;
168
168
} ;
169
169
let llval = bx. scalar_to_backend ( x, scalar, bx. immediate_backend_type ( layout) ) ;
170
170
OperandValue :: Immediate ( llval)
171
171
}
172
172
ConstValue :: ZeroSized => return OperandRef :: zero_sized ( layout) ,
173
173
ConstValue :: Slice { data, meta } => {
174
- let Abi :: ScalarPair ( a_scalar, _) = layout. abi else {
174
+ let IrForm :: ScalarPair ( a_scalar, _) = layout. ir_form else {
175
175
bug ! ( "from_const: invalid ScalarPair layout: {:#?}" , layout) ;
176
176
} ;
177
177
let a = Scalar :: from_pointer (
@@ -221,14 +221,14 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
221
221
// case where some of the bytes are initialized and others are not. So, we need an extra
222
222
// check that walks over the type of `mplace` to make sure it is truly correct to treat this
223
223
// like a `Scalar` (or `ScalarPair`).
224
- match layout. abi {
225
- Abi :: Scalar ( s @ abi:: Scalar :: Initialized { .. } ) => {
224
+ match layout. ir_form {
225
+ IrForm :: Scalar ( s @ abi:: Scalar :: Initialized { .. } ) => {
226
226
let size = s. size ( bx) ;
227
227
assert_eq ! ( size, layout. size, "abi::Scalar size does not match layout size" ) ;
228
228
let val = read_scalar ( offset, size, s, bx. immediate_backend_type ( layout) ) ;
229
229
OperandRef { val : OperandValue :: Immediate ( val) , layout }
230
230
}
231
- Abi :: ScalarPair (
231
+ IrForm :: ScalarPair (
232
232
a @ abi:: Scalar :: Initialized { .. } ,
233
233
b @ abi:: Scalar :: Initialized { .. } ,
234
234
) => {
@@ -322,7 +322,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
322
322
llval : V ,
323
323
layout : TyAndLayout < ' tcx > ,
324
324
) -> Self {
325
- let val = if let Abi :: ScalarPair ( ..) = layout. abi {
325
+ let val = if let IrForm :: ScalarPair ( ..) = layout. ir_form {
326
326
debug ! ( "Operand::from_immediate_or_packed_pair: unpacking {:?} @ {:?}" , llval, layout) ;
327
327
328
328
// Deconstruct the immediate aggregate.
@@ -343,7 +343,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
343
343
let field = self . layout . field ( bx. cx ( ) , i) ;
344
344
let offset = self . layout . fields . offset ( i) ;
345
345
346
- let mut val = match ( self . val , self . layout . abi ) {
346
+ let mut val = match ( self . val , self . layout . ir_form ) {
347
347
// If the field is ZST, it has no data.
348
348
_ if field. is_zst ( ) => OperandValue :: ZeroSized ,
349
349
@@ -356,7 +356,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
356
356
}
357
357
358
358
// Extract a scalar component from a pair.
359
- ( OperandValue :: Pair ( a_llval, b_llval) , Abi :: ScalarPair ( a, b) ) => {
359
+ ( OperandValue :: Pair ( a_llval, b_llval) , IrForm :: ScalarPair ( a, b) ) => {
360
360
if offset. bytes ( ) == 0 {
361
361
assert_eq ! ( field. size, a. size( bx. cx( ) ) ) ;
362
362
OperandValue :: Immediate ( a_llval)
@@ -368,30 +368,30 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
368
368
}
369
369
370
370
// `#[repr(simd)]` types are also immediate.
371
- ( OperandValue :: Immediate ( llval) , Abi :: Vector { .. } ) => {
371
+ ( OperandValue :: Immediate ( llval) , IrForm :: Vector { .. } ) => {
372
372
OperandValue :: Immediate ( bx. extract_element ( llval, bx. cx ( ) . const_usize ( i as u64 ) ) )
373
373
}
374
374
375
375
_ => bug ! ( "OperandRef::extract_field({:?}): not applicable" , self ) ,
376
376
} ;
377
377
378
- match ( & mut val, field. abi ) {
378
+ match ( & mut val, field. ir_form ) {
379
379
( OperandValue :: ZeroSized , _) => { }
380
380
(
381
381
OperandValue :: Immediate ( llval) ,
382
- Abi :: Scalar ( _) | Abi :: ScalarPair ( ..) | Abi :: Vector { .. } ,
382
+ IrForm :: Scalar ( _) | IrForm :: ScalarPair ( ..) | IrForm :: Vector { .. } ,
383
383
) => {
384
384
// Bools in union fields needs to be truncated.
385
385
* llval = bx. to_immediate ( * llval, field) ;
386
386
}
387
- ( OperandValue :: Pair ( a, b) , Abi :: ScalarPair ( a_abi, b_abi) ) => {
387
+ ( OperandValue :: Pair ( a, b) , IrForm :: ScalarPair ( a_abi, b_abi) ) => {
388
388
// Bools in union fields needs to be truncated.
389
389
* a = bx. to_immediate_scalar ( * a, a_abi) ;
390
390
* b = bx. to_immediate_scalar ( * b, b_abi) ;
391
391
}
392
392
// Newtype vector of array, e.g. #[repr(simd)] struct S([i32; 4]);
393
- ( OperandValue :: Immediate ( llval) , Abi :: Aggregate { sized : true } ) => {
394
- assert_matches ! ( self . layout. abi , Abi :: Vector { .. } ) ;
393
+ ( OperandValue :: Immediate ( llval) , IrForm :: Memory { sized : true } ) => {
394
+ assert_matches ! ( self . layout. ir_form , IrForm :: Vector { .. } ) ;
395
395
396
396
let llfield_ty = bx. cx ( ) . backend_type ( field) ;
397
397
@@ -400,7 +400,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
400
400
bx. store ( * llval, llptr, field. align . abi ) ;
401
401
* llval = bx. load ( llfield_ty, llptr, field. align . abi ) ;
402
402
}
403
- ( OperandValue :: Immediate ( _) , Abi :: Uninhabited | Abi :: Aggregate { sized : false } ) => {
403
+ ( OperandValue :: Immediate ( _) , IrForm :: Uninhabited | IrForm :: Memory { sized : false } ) => {
404
404
bug ! ( )
405
405
}
406
406
( OperandValue :: Pair ( ..) , _) => bug ! ( ) ,
@@ -494,7 +494,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
494
494
bx. store_with_flags ( val, dest. val . llval , dest. val . align , flags) ;
495
495
}
496
496
OperandValue :: Pair ( a, b) => {
497
- let Abi :: ScalarPair ( a_scalar, b_scalar) = dest. layout . abi else {
497
+ let IrForm :: ScalarPair ( a_scalar, b_scalar) = dest. layout . ir_form else {
498
498
bug ! ( "store_with_flags: invalid ScalarPair layout: {:#?}" , dest. layout) ;
499
499
} ;
500
500
let b_offset = a_scalar. size ( bx) . align_to ( b_scalar. align ( bx) . abi ) ;
@@ -645,7 +645,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
645
645
// However, some SIMD types do not actually use the vector ABI
646
646
// (in particular, packed SIMD types do not). Ensure we exclude those.
647
647
let layout = bx. layout_of ( constant_ty) ;
648
- if let Abi :: Vector { .. } = layout. abi {
648
+ if let IrForm :: Vector { .. } = layout. ir_form {
649
649
let ( llval, ty) = self . immediate_const_vector ( bx, constant) ;
650
650
return OperandRef {
651
651
val : OperandValue :: Immediate ( llval) ,
0 commit comments