11use super :: { InlineAsmArch , InlineAsmType } ;
22use crate :: spec:: Target ;
33use rustc_macros:: HashStable_Generic ;
4+ use rustc_span:: { sym, Symbol } ;
45use std:: fmt;
56
67def_reg_class ! {
@@ -44,28 +45,28 @@ impl ArmInlineAsmRegClass {
4445 pub fn supported_types (
4546 self ,
4647 _arch : InlineAsmArch ,
47- ) -> & ' static [ ( InlineAsmType , Option < & ' static str > ) ] {
48+ ) -> & ' static [ ( InlineAsmType , Option < Symbol > ) ] {
4849 match self {
4950 Self :: reg => types ! { _: I8 , I16 , I32 , F32 ; } ,
50- Self :: sreg | Self :: sreg_low16 => types ! { " vfp2" : I32 , F32 ; } ,
51+ Self :: sreg | Self :: sreg_low16 => types ! { vfp2: I32 , F32 ; } ,
5152 Self :: dreg | Self :: dreg_low16 | Self :: dreg_low8 => types ! {
52- " vfp2" : I64 , F64 , VecI8 ( 8 ) , VecI16 ( 4 ) , VecI32 ( 2 ) , VecI64 ( 1 ) , VecF32 ( 2 ) ;
53+ vfp2: I64 , F64 , VecI8 ( 8 ) , VecI16 ( 4 ) , VecI32 ( 2 ) , VecI64 ( 1 ) , VecF32 ( 2 ) ;
5354 } ,
5455 Self :: qreg | Self :: qreg_low8 | Self :: qreg_low4 => types ! {
55- " neon" : VecI8 ( 16 ) , VecI16 ( 8 ) , VecI32 ( 4 ) , VecI64 ( 2 ) , VecF32 ( 4 ) ;
56+ neon: VecI8 ( 16 ) , VecI16 ( 8 ) , VecI32 ( 4 ) , VecI64 ( 2 ) , VecF32 ( 4 ) ;
5657 } ,
5758 }
5859 }
5960}
6061
6162// This uses the same logic as useR7AsFramePointer in LLVM
62- fn frame_pointer_is_r7 ( mut has_feature : impl FnMut ( & str ) -> bool , target : & Target ) -> bool {
63- target. is_like_osx || ( !target. is_like_windows && has_feature ( "thumb-mode" ) )
63+ fn frame_pointer_is_r7 ( mut has_feature : impl FnMut ( Symbol ) -> bool , target : & Target ) -> bool {
64+ target. is_like_osx || ( !target. is_like_windows && has_feature ( sym :: thumb_mode ) )
6465}
6566
6667fn frame_pointer_r11 (
6768 _arch : InlineAsmArch ,
68- has_feature : impl FnMut ( & str ) -> bool ,
69+ has_feature : impl FnMut ( Symbol ) -> bool ,
6970 target : & Target ,
7071) -> Result < ( ) , & ' static str > {
7172 if !frame_pointer_is_r7 ( has_feature, target) {
@@ -77,7 +78,7 @@ fn frame_pointer_r11(
7778
7879fn frame_pointer_r7 (
7980 _arch : InlineAsmArch ,
80- has_feature : impl FnMut ( & str ) -> bool ,
81+ has_feature : impl FnMut ( Symbol ) -> bool ,
8182 target : & Target ,
8283) -> Result < ( ) , & ' static str > {
8384 if frame_pointer_is_r7 ( has_feature, target) {
@@ -89,10 +90,10 @@ fn frame_pointer_r7(
8990
9091fn not_thumb1 (
9192 _arch : InlineAsmArch ,
92- mut has_feature : impl FnMut ( & str ) -> bool ,
93+ mut has_feature : impl FnMut ( Symbol ) -> bool ,
9394 _target : & Target ,
9495) -> Result < ( ) , & ' static str > {
95- if has_feature ( "thumb-mode" ) && !has_feature ( " thumb2" ) {
96+ if has_feature ( sym :: thumb_mode ) && !has_feature ( sym :: thumb2) {
9697 Err ( "high registers (r8+) cannot be used in Thumb-1 code" )
9798 } else {
9899 Ok ( ( ) )
@@ -101,14 +102,14 @@ fn not_thumb1(
101102
102103fn reserved_r9 (
103104 arch : InlineAsmArch ,
104- mut has_feature : impl FnMut ( & str ) -> bool ,
105+ mut has_feature : impl FnMut ( Symbol ) -> bool ,
105106 target : & Target ,
106107) -> Result < ( ) , & ' static str > {
107108 not_thumb1 ( arch, & mut has_feature, target) ?;
108109
109110 // We detect this using the reserved-r9 feature instead of using the target
110111 // because the relocation model can be changed with compiler options.
111- if has_feature ( "reserved-r9" ) {
112+ if has_feature ( sym :: reserved_r9 ) {
112113 Err ( "the RWPI static base register (r9) cannot be used as an operand for inline asm" )
113114 } else {
114115 Ok ( ( ) )
0 commit comments