1
1
use super :: { InlineAsmArch , InlineAsmType } ;
2
2
use crate :: spec:: Target ;
3
3
use rustc_macros:: HashStable_Generic ;
4
+ use rustc_span:: { sym, Symbol } ;
4
5
use std:: fmt;
5
6
6
7
def_reg_class ! {
@@ -44,28 +45,28 @@ impl ArmInlineAsmRegClass {
44
45
pub fn supported_types (
45
46
self ,
46
47
_arch : InlineAsmArch ,
47
- ) -> & ' static [ ( InlineAsmType , Option < & ' static str > ) ] {
48
+ ) -> & ' static [ ( InlineAsmType , Option < Symbol > ) ] {
48
49
match self {
49
50
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 ; } ,
51
52
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 ) ;
53
54
} ,
54
55
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 ) ;
56
57
} ,
57
58
}
58
59
}
59
60
}
60
61
61
62
// 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 ) )
64
65
}
65
66
66
67
fn frame_pointer_r11 (
67
68
_arch : InlineAsmArch ,
68
- has_feature : impl FnMut ( & str ) -> bool ,
69
+ has_feature : impl FnMut ( Symbol ) -> bool ,
69
70
target : & Target ,
70
71
) -> Result < ( ) , & ' static str > {
71
72
if !frame_pointer_is_r7 ( has_feature, target) {
@@ -77,7 +78,7 @@ fn frame_pointer_r11(
77
78
78
79
fn frame_pointer_r7 (
79
80
_arch : InlineAsmArch ,
80
- has_feature : impl FnMut ( & str ) -> bool ,
81
+ has_feature : impl FnMut ( Symbol ) -> bool ,
81
82
target : & Target ,
82
83
) -> Result < ( ) , & ' static str > {
83
84
if frame_pointer_is_r7 ( has_feature, target) {
@@ -89,10 +90,10 @@ fn frame_pointer_r7(
89
90
90
91
fn not_thumb1 (
91
92
_arch : InlineAsmArch ,
92
- mut has_feature : impl FnMut ( & str ) -> bool ,
93
+ mut has_feature : impl FnMut ( Symbol ) -> bool ,
93
94
_target : & Target ,
94
95
) -> Result < ( ) , & ' static str > {
95
- if has_feature ( "thumb-mode" ) && !has_feature ( " thumb2" ) {
96
+ if has_feature ( sym :: thumb_mode ) && !has_feature ( sym :: thumb2) {
96
97
Err ( "high registers (r8+) cannot be used in Thumb-1 code" )
97
98
} else {
98
99
Ok ( ( ) )
@@ -101,14 +102,14 @@ fn not_thumb1(
101
102
102
103
fn reserved_r9 (
103
104
arch : InlineAsmArch ,
104
- mut has_feature : impl FnMut ( & str ) -> bool ,
105
+ mut has_feature : impl FnMut ( Symbol ) -> bool ,
105
106
target : & Target ,
106
107
) -> Result < ( ) , & ' static str > {
107
108
not_thumb1 ( arch, & mut has_feature, target) ?;
108
109
109
110
// We detect this using the reserved-r9 feature instead of using the target
110
111
// because the relocation model can be changed with compiler options.
111
- if has_feature ( "reserved-r9" ) {
112
+ if has_feature ( sym :: reserved_r9 ) {
112
113
Err ( "the RWPI static base register (r9) cannot be used as an operand for inline asm" )
113
114
} else {
114
115
Ok ( ( ) )
0 commit comments