4
4
5
5
use crate :: hir:: def:: { CtorKind , Namespace } ;
6
6
use crate :: hir:: def_id:: DefId ;
7
- use crate :: hir:: { self , HirId , InlineAsm } ;
7
+ use crate :: hir:: { self , HirId , InlineAsm as HirInlineAsm } ;
8
8
use crate :: mir:: interpret:: { ConstValue , InterpError , Scalar } ;
9
9
use crate :: mir:: visit:: MirVisitable ;
10
10
use rustc_apfloat:: ieee:: { Double , Single } ;
@@ -1735,7 +1735,7 @@ pub struct Statement<'tcx> {
1735
1735
1736
1736
// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
1737
1737
#[ 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 ) ;
1739
1739
1740
1740
impl < ' tcx > Statement < ' tcx > {
1741
1741
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
@@ -1779,12 +1779,9 @@ pub enum StatementKind<'tcx> {
1779
1779
/// End the current live range for the storage of the local.
1780
1780
StorageDead ( Local ) ,
1781
1781
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 > > ) ,
1788
1785
1789
1786
/// Retag references in the given place, ensuring they got fresh tags. This is
1790
1787
/// part of the Stacked Borrows model. These statements are currently only interpreted
@@ -1858,6 +1855,13 @@ pub enum FakeReadCause {
1858
1855
ForLet ,
1859
1856
}
1860
1857
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
+
1861
1865
impl < ' tcx > Debug for Statement < ' tcx > {
1862
1866
fn fmt ( & self , fmt : & mut Formatter < ' _ > ) -> fmt:: Result {
1863
1867
use self :: StatementKind :: * ;
@@ -1880,11 +1884,8 @@ impl<'tcx> Debug for Statement<'tcx> {
1880
1884
ref place,
1881
1885
variant_index,
1882
1886
} => 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) ,
1888
1889
AscribeUserType ( ref place, ref variance, ref c_ty) => {
1889
1890
write ! ( fmt, "AscribeUserType({:?}, {:?}, {:?})" , place, variance, c_ty)
1890
1891
}
@@ -3149,13 +3150,21 @@ EnumTypeFoldableImpl! {
3149
3150
( StatementKind :: SetDiscriminant ) { place, variant_index } ,
3150
3151
( StatementKind :: StorageLive ) ( a) ,
3151
3152
( StatementKind :: StorageDead ) ( a) ,
3152
- ( StatementKind :: InlineAsm ) { asm , outputs , inputs } ,
3153
+ ( StatementKind :: InlineAsm ) ( a ) ,
3153
3154
( StatementKind :: Retag ) ( kind, place) ,
3154
3155
( StatementKind :: AscribeUserType ) ( a, v, b) ,
3155
3156
( StatementKind :: Nop ) ,
3156
3157
}
3157
3158
}
3158
3159
3160
+ BraceStructTypeFoldableImpl ! {
3161
+ impl <' tcx> TypeFoldable <' tcx> for InlineAsm <' tcx> {
3162
+ asm,
3163
+ outputs,
3164
+ inputs,
3165
+ }
3166
+ }
3167
+
3159
3168
EnumTypeFoldableImpl ! {
3160
3169
impl <' tcx, T > TypeFoldable <' tcx> for ClearCrossCrate <T > {
3161
3170
( ClearCrossCrate :: Clear ) ,
0 commit comments