44
55use crate :: hir:: def:: { CtorKind , Namespace } ;
66use crate :: hir:: def_id:: DefId ;
7- use crate :: hir:: { self , HirId , InlineAsm } ;
7+ use crate :: hir:: { self , HirId , InlineAsm as HirInlineAsm } ;
88use crate :: mir:: interpret:: { ConstValue , InterpError , Scalar } ;
99use crate :: mir:: visit:: MirVisitable ;
1010use rustc_apfloat:: ieee:: { Double , Single } ;
@@ -1735,7 +1735,7 @@ pub struct Statement<'tcx> {
17351735
17361736// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
17371737#[ cfg( target_arch = "x86_64" ) ]
1738- static_assert ! ( MEM_SIZE_OF_STATEMENT : mem:: size_of:: <Statement <' _>>( ) == 56 ) ;
1738+ static_assert ! ( MEM_SIZE_OF_STATEMENT : mem:: size_of:: <Statement <' _>>( ) == 48 ) ;
17391739
17401740impl < ' tcx > Statement < ' tcx > {
17411741 /// Changes a statement to a nop. This is both faster than deleting instructions and avoids
@@ -1779,12 +1779,9 @@ pub enum StatementKind<'tcx> {
17791779 /// End the current live range for the storage of the local.
17801780 StorageDead ( Local ) ,
17811781
1782- /// Executes a piece of inline Assembly.
1783- InlineAsm {
1784- asm : Box < InlineAsm > ,
1785- outputs : Box < [ Place < ' tcx > ] > ,
1786- inputs : Box < [ ( Span , Operand < ' tcx > ) ] > ,
1787- } ,
1782+ /// Executes a piece of inline Assembly. Stored in a Box to keep the size
1783+ /// of `StatementKind` low.
1784+ InlineAsm ( Box < InlineAsm < ' tcx > > ) ,
17881785
17891786 /// Retag references in the given place, ensuring they got fresh tags. This is
17901787 /// part of the Stacked Borrows model. These statements are currently only interpreted
@@ -1858,6 +1855,13 @@ pub enum FakeReadCause {
18581855 ForLet ,
18591856}
18601857
1858+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
1859+ pub struct InlineAsm < ' tcx > {
1860+ pub asm : HirInlineAsm ,
1861+ pub outputs : Box < [ Place < ' tcx > ] > ,
1862+ pub inputs : Box < [ ( Span , Operand < ' tcx > ) ] > ,
1863+ }
1864+
18611865impl < ' tcx > Debug for Statement < ' tcx > {
18621866 fn fmt ( & self , fmt : & mut Formatter < ' _ > ) -> fmt:: Result {
18631867 use self :: StatementKind :: * ;
@@ -1880,11 +1884,8 @@ impl<'tcx> Debug for Statement<'tcx> {
18801884 ref place,
18811885 variant_index,
18821886 } => write ! ( fmt, "discriminant({:?}) = {:?}" , place, variant_index) ,
1883- InlineAsm {
1884- ref asm,
1885- ref outputs,
1886- ref inputs,
1887- } => write ! ( fmt, "asm!({:?} : {:?} : {:?})" , asm, outputs, inputs) ,
1887+ InlineAsm ( ref asm) =>
1888+ write ! ( fmt, "asm!({:?} : {:?} : {:?})" , asm. asm, asm. outputs, asm. inputs) ,
18881889 AscribeUserType ( ref place, ref variance, ref c_ty) => {
18891890 write ! ( fmt, "AscribeUserType({:?}, {:?}, {:?})" , place, variance, c_ty)
18901891 }
@@ -3140,13 +3141,21 @@ EnumTypeFoldableImpl! {
31403141 ( StatementKind :: SetDiscriminant ) { place, variant_index } ,
31413142 ( StatementKind :: StorageLive ) ( a) ,
31423143 ( StatementKind :: StorageDead ) ( a) ,
3143- ( StatementKind :: InlineAsm ) { asm , outputs , inputs } ,
3144+ ( StatementKind :: InlineAsm ) ( a ) ,
31443145 ( StatementKind :: Retag ) ( kind, place) ,
31453146 ( StatementKind :: AscribeUserType ) ( a, v, b) ,
31463147 ( StatementKind :: Nop ) ,
31473148 }
31483149}
31493150
3151+ BraceStructTypeFoldableImpl ! {
3152+ impl <' tcx> TypeFoldable <' tcx> for InlineAsm <' tcx> {
3153+ asm,
3154+ outputs,
3155+ inputs,
3156+ }
3157+ }
3158+
31503159EnumTypeFoldableImpl ! {
31513160 impl <' tcx, T > TypeFoldable <' tcx> for ClearCrossCrate <T > {
31523161 ( ClearCrossCrate :: Clear ) ,
0 commit comments