@@ -194,6 +194,7 @@ impl TargetDataLayout {
194
194
/// to represent object size in bits. It would need to be 1 << 61 to account for this, but is
195
195
/// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable
196
196
/// address space on 64-bit ARMv8 and x86_64.
197
+ #[ inline]
197
198
pub fn obj_size_bound ( & self ) -> u64 {
198
199
match self . pointer_size . bits ( ) {
199
200
16 => 1 << 15 ,
@@ -203,6 +204,7 @@ impl TargetDataLayout {
203
204
}
204
205
}
205
206
207
+ #[ inline]
206
208
pub fn ptr_sized_integer ( & self ) -> Integer {
207
209
match self . pointer_size . bits ( ) {
208
210
16 => I16 ,
@@ -212,6 +214,7 @@ impl TargetDataLayout {
212
214
}
213
215
}
214
216
217
+ #[ inline]
215
218
pub fn vector_align ( & self , vec_size : Size ) -> AbiAndPrefAlign {
216
219
for & ( size, align) in & self . vector_align {
217
220
if size == vec_size {
@@ -562,14 +565,17 @@ pub struct AbiAndPrefAlign {
562
565
}
563
566
564
567
impl AbiAndPrefAlign {
568
+ #[ inline]
565
569
pub fn new ( align : Align ) -> AbiAndPrefAlign {
566
570
AbiAndPrefAlign { abi : align, pref : align }
567
571
}
568
572
573
+ #[ inline]
569
574
pub fn min ( self , other : AbiAndPrefAlign ) -> AbiAndPrefAlign {
570
575
AbiAndPrefAlign { abi : self . abi . min ( other. abi ) , pref : self . pref . min ( other. pref ) }
571
576
}
572
577
578
+ #[ inline]
573
579
pub fn max ( self , other : AbiAndPrefAlign ) -> AbiAndPrefAlign {
574
580
AbiAndPrefAlign { abi : self . abi . max ( other. abi ) , pref : self . pref . max ( other. pref ) }
575
581
}
@@ -586,6 +592,7 @@ pub enum Integer {
586
592
}
587
593
588
594
impl Integer {
595
+ #[ inline]
589
596
pub fn size ( self ) -> Size {
590
597
match self {
591
598
I8 => Size :: from_bytes ( 1 ) ,
@@ -609,6 +616,7 @@ impl Integer {
609
616
}
610
617
611
618
/// Finds the smallest Integer type which can represent the signed value.
619
+ #[ inline]
612
620
pub fn fit_signed ( x : i128 ) -> Integer {
613
621
match x {
614
622
-0x0000_0000_0000_0080 ..=0x0000_0000_0000_007f => I8 ,
@@ -620,6 +628,7 @@ impl Integer {
620
628
}
621
629
622
630
/// Finds the smallest Integer type which can represent the unsigned value.
631
+ #[ inline]
623
632
pub fn fit_unsigned ( x : u128 ) -> Integer {
624
633
match x {
625
634
0 ..=0x0000_0000_0000_00ff => I8 ,
@@ -655,6 +664,9 @@ impl Integer {
655
664
I8
656
665
}
657
666
667
+ // FIXME(eddyb) consolidate this and other methods that find the appropriate
668
+ // `Integer` given some requirements.
669
+ #[ inline]
658
670
fn from_size ( size : Size ) -> Result < Self , String > {
659
671
match size. bits ( ) {
660
672
8 => Ok ( Integer :: I8 ) ,
@@ -706,10 +718,14 @@ impl Primitive {
706
718
}
707
719
}
708
720
721
+ // FIXME(eddyb) remove, it's trivial thanks to `matches!`.
722
+ #[ inline]
709
723
pub fn is_float ( self ) -> bool {
710
724
matches ! ( self , F32 | F64 )
711
725
}
712
726
727
+ // FIXME(eddyb) remove, it's completely unused.
728
+ #[ inline]
713
729
pub fn is_int ( self ) -> bool {
714
730
matches ! ( self , Int ( ..) )
715
731
}
@@ -786,6 +802,7 @@ pub struct Scalar {
786
802
}
787
803
788
804
impl Scalar {
805
+ #[ inline]
789
806
pub fn is_bool ( & self ) -> bool {
790
807
matches ! ( self . value, Int ( I8 , false ) )
791
808
&& matches ! ( self . valid_range, WrappingRange { start: 0 , end: 1 } )
@@ -852,6 +869,7 @@ pub enum FieldsShape {
852
869
}
853
870
854
871
impl FieldsShape {
872
+ #[ inline]
855
873
pub fn count ( & self ) -> usize {
856
874
match * self {
857
875
FieldsShape :: Primitive => 0 ,
@@ -861,6 +879,7 @@ impl FieldsShape {
861
879
}
862
880
}
863
881
882
+ #[ inline]
864
883
pub fn offset ( & self , i : usize ) -> Size {
865
884
match * self {
866
885
FieldsShape :: Primitive => {
@@ -884,6 +903,7 @@ impl FieldsShape {
884
903
}
885
904
}
886
905
906
+ #[ inline]
887
907
pub fn memory_index ( & self , i : usize ) -> usize {
888
908
match * self {
889
909
FieldsShape :: Primitive => {
@@ -967,6 +987,7 @@ impl Abi {
967
987
}
968
988
969
989
/// Returns `true` if this is a single signed integer scalar
990
+ #[ inline]
970
991
pub fn is_signed ( & self ) -> bool {
971
992
match * self {
972
993
Abi :: Scalar ( ref scal) => match scal. value {
0 commit comments