@@ -753,7 +753,7 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
753
753
/// Helper function to get the LLVM type for a Scalar. Pointers are returned as
754
754
/// the equivalent integer type.
755
755
fn llvm_asm_scalar_type < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , scalar : Scalar ) -> & ' ll Type {
756
- match scalar. value {
756
+ match scalar. primitive ( ) {
757
757
Primitive :: Int ( Integer :: I8 , _) => cx. type_i8 ( ) ,
758
758
Primitive :: Int ( Integer :: I16 , _) => cx. type_i16 ( ) ,
759
759
Primitive :: Int ( Integer :: I32 , _) => cx. type_i32 ( ) ,
@@ -774,7 +774,7 @@ fn llvm_fixup_input<'ll, 'tcx>(
774
774
) -> & ' ll Value {
775
775
match ( reg, layout. abi ) {
776
776
( InlineAsmRegClass :: AArch64 ( AArch64InlineAsmRegClass :: vreg) , Abi :: Scalar ( s) ) => {
777
- if let Primitive :: Int ( Integer :: I8 , _) = s. value {
777
+ if let Primitive :: Int ( Integer :: I8 , _) = s. primitive ( ) {
778
778
let vec_ty = bx. cx . type_vector ( bx. cx . type_i8 ( ) , 8 ) ;
779
779
bx. insert_element ( bx. const_undef ( vec_ty) , value, bx. const_i32 ( 0 ) )
780
780
} else {
@@ -785,7 +785,7 @@ fn llvm_fixup_input<'ll, 'tcx>(
785
785
let elem_ty = llvm_asm_scalar_type ( bx. cx , s) ;
786
786
let count = 16 / layout. size . bytes ( ) ;
787
787
let vec_ty = bx. cx . type_vector ( elem_ty, count) ;
788
- if let Primitive :: Pointer = s. value {
788
+ if let Primitive :: Pointer = s. primitive ( ) {
789
789
value = bx. ptrtoint ( value, bx. cx . type_isize ( ) ) ;
790
790
}
791
791
bx. insert_element ( bx. const_undef ( vec_ty) , value, bx. const_i32 ( 0 ) )
@@ -800,7 +800,7 @@ fn llvm_fixup_input<'ll, 'tcx>(
800
800
bx. shuffle_vector ( value, bx. const_undef ( vec_ty) , bx. const_vector ( & indices) )
801
801
}
802
802
( InlineAsmRegClass :: X86 ( X86InlineAsmRegClass :: reg_abcd) , Abi :: Scalar ( s) )
803
- if s. value == Primitive :: F64 =>
803
+ if s. primitive ( ) == Primitive :: F64 =>
804
804
{
805
805
bx. bitcast ( value, bx. cx . type_i64 ( ) )
806
806
}
@@ -812,7 +812,7 @@ fn llvm_fixup_input<'ll, 'tcx>(
812
812
InlineAsmRegClass :: Arm ( ArmInlineAsmRegClass :: sreg | ArmInlineAsmRegClass :: sreg_low16) ,
813
813
Abi :: Scalar ( s) ,
814
814
) => {
815
- if let Primitive :: Int ( Integer :: I32 , _) = s. value {
815
+ if let Primitive :: Int ( Integer :: I32 , _) = s. primitive ( ) {
816
816
bx. bitcast ( value, bx. cx . type_f32 ( ) )
817
817
} else {
818
818
value
@@ -826,19 +826,21 @@ fn llvm_fixup_input<'ll, 'tcx>(
826
826
) ,
827
827
Abi :: Scalar ( s) ,
828
828
) => {
829
- if let Primitive :: Int ( Integer :: I64 , _) = s. value {
829
+ if let Primitive :: Int ( Integer :: I64 , _) = s. primitive ( ) {
830
830
bx. bitcast ( value, bx. cx . type_f64 ( ) )
831
831
} else {
832
832
value
833
833
}
834
834
}
835
- ( InlineAsmRegClass :: Mips ( MipsInlineAsmRegClass :: reg) , Abi :: Scalar ( s) ) => match s. value {
836
- // MIPS only supports register-length arithmetics.
837
- Primitive :: Int ( Integer :: I8 | Integer :: I16 , _) => bx. zext ( value, bx. cx . type_i32 ( ) ) ,
838
- Primitive :: F32 => bx. bitcast ( value, bx. cx . type_i32 ( ) ) ,
839
- Primitive :: F64 => bx. bitcast ( value, bx. cx . type_i64 ( ) ) ,
840
- _ => value,
841
- } ,
835
+ ( InlineAsmRegClass :: Mips ( MipsInlineAsmRegClass :: reg) , Abi :: Scalar ( s) ) => {
836
+ match s. primitive ( ) {
837
+ // MIPS only supports register-length arithmetics.
838
+ Primitive :: Int ( Integer :: I8 | Integer :: I16 , _) => bx. zext ( value, bx. cx . type_i32 ( ) ) ,
839
+ Primitive :: F32 => bx. bitcast ( value, bx. cx . type_i32 ( ) ) ,
840
+ Primitive :: F64 => bx. bitcast ( value, bx. cx . type_i64 ( ) ) ,
841
+ _ => value,
842
+ }
843
+ }
842
844
_ => value,
843
845
}
844
846
}
@@ -852,15 +854,15 @@ fn llvm_fixup_output<'ll, 'tcx>(
852
854
) -> & ' ll Value {
853
855
match ( reg, layout. abi ) {
854
856
( InlineAsmRegClass :: AArch64 ( AArch64InlineAsmRegClass :: vreg) , Abi :: Scalar ( s) ) => {
855
- if let Primitive :: Int ( Integer :: I8 , _) = s. value {
857
+ if let Primitive :: Int ( Integer :: I8 , _) = s. primitive ( ) {
856
858
bx. extract_element ( value, bx. const_i32 ( 0 ) )
857
859
} else {
858
860
value
859
861
}
860
862
}
861
863
( InlineAsmRegClass :: AArch64 ( AArch64InlineAsmRegClass :: vreg_low16) , Abi :: Scalar ( s) ) => {
862
864
value = bx. extract_element ( value, bx. const_i32 ( 0 ) ) ;
863
- if let Primitive :: Pointer = s. value {
865
+ if let Primitive :: Pointer = s. primitive ( ) {
864
866
value = bx. inttoptr ( value, layout. llvm_type ( bx. cx ) ) ;
865
867
}
866
868
value
@@ -875,7 +877,7 @@ fn llvm_fixup_output<'ll, 'tcx>(
875
877
bx. shuffle_vector ( value, bx. const_undef ( vec_ty) , bx. const_vector ( & indices) )
876
878
}
877
879
( InlineAsmRegClass :: X86 ( X86InlineAsmRegClass :: reg_abcd) , Abi :: Scalar ( s) )
878
- if s. value == Primitive :: F64 =>
880
+ if s. primitive ( ) == Primitive :: F64 =>
879
881
{
880
882
bx. bitcast ( value, bx. cx . type_f64 ( ) )
881
883
}
@@ -887,7 +889,7 @@ fn llvm_fixup_output<'ll, 'tcx>(
887
889
InlineAsmRegClass :: Arm ( ArmInlineAsmRegClass :: sreg | ArmInlineAsmRegClass :: sreg_low16) ,
888
890
Abi :: Scalar ( s) ,
889
891
) => {
890
- if let Primitive :: Int ( Integer :: I32 , _) = s. value {
892
+ if let Primitive :: Int ( Integer :: I32 , _) = s. primitive ( ) {
891
893
bx. bitcast ( value, bx. cx . type_i32 ( ) )
892
894
} else {
893
895
value
@@ -901,20 +903,22 @@ fn llvm_fixup_output<'ll, 'tcx>(
901
903
) ,
902
904
Abi :: Scalar ( s) ,
903
905
) => {
904
- if let Primitive :: Int ( Integer :: I64 , _) = s. value {
906
+ if let Primitive :: Int ( Integer :: I64 , _) = s. primitive ( ) {
905
907
bx. bitcast ( value, bx. cx . type_i64 ( ) )
906
908
} else {
907
909
value
908
910
}
909
911
}
910
- ( InlineAsmRegClass :: Mips ( MipsInlineAsmRegClass :: reg) , Abi :: Scalar ( s) ) => match s. value {
911
- // MIPS only supports register-length arithmetics.
912
- Primitive :: Int ( Integer :: I8 , _) => bx. trunc ( value, bx. cx . type_i8 ( ) ) ,
913
- Primitive :: Int ( Integer :: I16 , _) => bx. trunc ( value, bx. cx . type_i16 ( ) ) ,
914
- Primitive :: F32 => bx. bitcast ( value, bx. cx . type_f32 ( ) ) ,
915
- Primitive :: F64 => bx. bitcast ( value, bx. cx . type_f64 ( ) ) ,
916
- _ => value,
917
- } ,
912
+ ( InlineAsmRegClass :: Mips ( MipsInlineAsmRegClass :: reg) , Abi :: Scalar ( s) ) => {
913
+ match s. primitive ( ) {
914
+ // MIPS only supports register-length arithmetics.
915
+ Primitive :: Int ( Integer :: I8 , _) => bx. trunc ( value, bx. cx . type_i8 ( ) ) ,
916
+ Primitive :: Int ( Integer :: I16 , _) => bx. trunc ( value, bx. cx . type_i16 ( ) ) ,
917
+ Primitive :: F32 => bx. bitcast ( value, bx. cx . type_f32 ( ) ) ,
918
+ Primitive :: F64 => bx. bitcast ( value, bx. cx . type_f64 ( ) ) ,
919
+ _ => value,
920
+ }
921
+ }
918
922
_ => value,
919
923
}
920
924
}
@@ -927,7 +931,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
927
931
) -> & ' ll Type {
928
932
match ( reg, layout. abi ) {
929
933
( InlineAsmRegClass :: AArch64 ( AArch64InlineAsmRegClass :: vreg) , Abi :: Scalar ( s) ) => {
930
- if let Primitive :: Int ( Integer :: I8 , _) = s. value {
934
+ if let Primitive :: Int ( Integer :: I8 , _) = s. primitive ( ) {
931
935
cx. type_vector ( cx. type_i8 ( ) , 8 )
932
936
} else {
933
937
layout. llvm_type ( cx)
@@ -946,7 +950,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
946
950
cx. type_vector ( elem_ty, count * 2 )
947
951
}
948
952
( InlineAsmRegClass :: X86 ( X86InlineAsmRegClass :: reg_abcd) , Abi :: Scalar ( s) )
949
- if s. value == Primitive :: F64 =>
953
+ if s. primitive ( ) == Primitive :: F64 =>
950
954
{
951
955
cx. type_i64 ( )
952
956
}
@@ -958,7 +962,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
958
962
InlineAsmRegClass :: Arm ( ArmInlineAsmRegClass :: sreg | ArmInlineAsmRegClass :: sreg_low16) ,
959
963
Abi :: Scalar ( s) ,
960
964
) => {
961
- if let Primitive :: Int ( Integer :: I32 , _) = s. value {
965
+ if let Primitive :: Int ( Integer :: I32 , _) = s. primitive ( ) {
962
966
cx. type_f32 ( )
963
967
} else {
964
968
layout. llvm_type ( cx)
@@ -972,19 +976,21 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
972
976
) ,
973
977
Abi :: Scalar ( s) ,
974
978
) => {
975
- if let Primitive :: Int ( Integer :: I64 , _) = s. value {
979
+ if let Primitive :: Int ( Integer :: I64 , _) = s. primitive ( ) {
976
980
cx. type_f64 ( )
977
981
} else {
978
982
layout. llvm_type ( cx)
979
983
}
980
984
}
981
- ( InlineAsmRegClass :: Mips ( MipsInlineAsmRegClass :: reg) , Abi :: Scalar ( s) ) => match s. value {
982
- // MIPS only supports register-length arithmetics.
983
- Primitive :: Int ( Integer :: I8 | Integer :: I16 , _) => cx. type_i32 ( ) ,
984
- Primitive :: F32 => cx. type_i32 ( ) ,
985
- Primitive :: F64 => cx. type_i64 ( ) ,
986
- _ => layout. llvm_type ( cx) ,
987
- } ,
985
+ ( InlineAsmRegClass :: Mips ( MipsInlineAsmRegClass :: reg) , Abi :: Scalar ( s) ) => {
986
+ match s. primitive ( ) {
987
+ // MIPS only supports register-length arithmetics.
988
+ Primitive :: Int ( Integer :: I8 | Integer :: I16 , _) => cx. type_i32 ( ) ,
989
+ Primitive :: F32 => cx. type_i32 ( ) ,
990
+ Primitive :: F64 => cx. type_i64 ( ) ,
991
+ _ => layout. llvm_type ( cx) ,
992
+ }
993
+ }
988
994
_ => layout. llvm_type ( cx) ,
989
995
}
990
996
}
0 commit comments