8585use std:: borrow:: Cow ;
8686
8787use either:: Either ;
88+ use rustc_abi:: { self as abi, FIRST_VARIANT , FieldIdx , IrForm , Primitive , Size , VariantIdx } ;
8889use rustc_const_eval:: const_eval:: DummyMachine ;
8990use rustc_const_eval:: interpret:: {
9091 ImmTy , Immediate , InterpCx , MemPlaceMeta , MemoryKind , OpTy , Projectable , Scalar ,
@@ -103,7 +104,6 @@ use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
103104use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
104105use rustc_span:: DUMMY_SP ;
105106use rustc_span:: def_id:: DefId ;
106- use rustc_target:: abi:: { self , Abi , FIRST_VARIANT , FieldIdx , Primitive , Size , VariantIdx } ;
107107use smallvec:: SmallVec ;
108108use tracing:: { debug, instrument, trace} ;
109109
@@ -427,7 +427,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
427427 } ;
428428 let ptr_imm = Immediate :: new_pointer_with_meta ( data, meta, & self . ecx ) ;
429429 ImmTy :: from_immediate ( ptr_imm, ty) . into ( )
430- } else if matches ! ( ty. abi , Abi :: Scalar ( ..) | Abi :: ScalarPair ( ..) ) {
430+ } else if matches ! ( ty. ir_form , IrForm :: Scalar ( ..) | IrForm :: ScalarPair ( ..) ) {
431431 let dest = self . ecx . allocate ( ty, MemoryKind :: Stack ) . discard_err ( ) ?;
432432 let variant_dest = if let Some ( variant) = variant {
433433 self . ecx . project_downcast ( & dest, variant) . discard_err ( ) ?
@@ -573,12 +573,12 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
573573 // limited transmutes: it only works between types with the same layout, and
574574 // cannot transmute pointers to integers.
575575 if value. as_mplace_or_imm ( ) . is_right ( ) {
576- let can_transmute = match ( value. layout . abi , to. abi ) {
577- ( Abi :: Scalar ( s1) , Abi :: Scalar ( s2) ) => {
576+ let can_transmute = match ( value. layout . ir_form , to. ir_form ) {
577+ ( IrForm :: Scalar ( s1) , IrForm :: Scalar ( s2) ) => {
578578 s1. size ( & self . ecx ) == s2. size ( & self . ecx )
579579 && !matches ! ( s1. primitive( ) , Primitive :: Pointer ( ..) )
580580 }
581- ( Abi :: ScalarPair ( a1, b1) , Abi :: ScalarPair ( a2, b2) ) => {
581+ ( IrForm :: ScalarPair ( a1, b1) , IrForm :: ScalarPair ( a2, b2) ) => {
582582 a1. size ( & self . ecx ) == a2. size ( & self . ecx ) &&
583583 b1. size ( & self . ecx ) == b2. size ( & self . ecx ) &&
584584 // The alignment of the second component determines its offset, so that also needs to match.
@@ -1241,7 +1241,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
12411241
12421242 let as_bits = |value| {
12431243 let constant = self . evaluated [ value] . as_ref ( ) ?;
1244- if layout. abi . is_scalar ( ) {
1244+ if layout. ir_form . is_scalar ( ) {
12451245 let scalar = self . ecx . read_scalar ( constant) . discard_err ( ) ?;
12461246 scalar. to_bits ( constant. layout . size ) . discard_err ( )
12471247 } else {
@@ -1497,12 +1497,12 @@ fn op_to_prop_const<'tcx>(
14971497
14981498 // Do not synthetize too large constants. Codegen will just memcpy them, which we'd like to
14991499 // avoid.
1500- if !matches ! ( op. layout. abi , Abi :: Scalar ( ..) | Abi :: ScalarPair ( ..) ) {
1500+ if !matches ! ( op. layout. ir_form , IrForm :: Scalar ( ..) | IrForm :: ScalarPair ( ..) ) {
15011501 return None ;
15021502 }
15031503
15041504 // If this constant has scalar ABI, return it as a `ConstValue::Scalar`.
1505- if let Abi :: Scalar ( abi:: Scalar :: Initialized { .. } ) = op. layout . abi
1505+ if let IrForm :: Scalar ( abi:: Scalar :: Initialized { .. } ) = op. layout . ir_form
15061506 && let Some ( scalar) = ecx. read_scalar ( op) . discard_err ( )
15071507 {
15081508 if !scalar. try_to_scalar_int ( ) . is_ok ( ) {
0 commit comments