@@ -81,14 +81,14 @@ macro_rules! def_regs {
81
81
82
82
pub fn parse(
83
83
_arch: super :: InlineAsmArch ,
84
- mut _has_feature : impl FnMut ( rustc_span :: Symbol ) -> bool ,
84
+ _target_features : & rustc_data_structures :: fx :: FxHashSet < Symbol > ,
85
85
_target: & crate :: spec:: Target ,
86
86
name: & str ,
87
87
) -> Result <Self , & ' static str > {
88
88
match name {
89
89
$(
90
90
$( $alias) |* | $reg_name => {
91
- $( $filter( _arch, & mut _has_feature , _target) ?; ) ?
91
+ $( $filter( _arch, _target_features , _target) ?; ) ?
92
92
Ok ( Self :: $reg)
93
93
}
94
94
) *
@@ -102,7 +102,7 @@ macro_rules! def_regs {
102
102
103
103
pub ( super ) fn fill_reg_map(
104
104
_arch: super :: InlineAsmArch ,
105
- mut _has_feature : impl FnMut ( rustc_span :: Symbol ) -> bool ,
105
+ _target_features : & rustc_data_structures :: fx :: FxHashSet < Symbol > ,
106
106
_target: & crate :: spec:: Target ,
107
107
_map: & mut rustc_data_structures:: fx:: FxHashMap <
108
108
super :: InlineAsmRegClass ,
@@ -112,7 +112,7 @@ macro_rules! def_regs {
112
112
#[ allow( unused_imports) ]
113
113
use super :: { InlineAsmReg , InlineAsmRegClass } ;
114
114
$(
115
- if $( $filter( _arch, & mut _has_feature , _target) . is_ok( ) &&) ? true {
115
+ if $( $filter( _arch, _target_features , _target) . is_ok( ) &&) ? true {
116
116
if let Some ( set) = _map. get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $class) ) {
117
117
set. insert( InlineAsmReg :: $arch( $arch_reg:: $reg) ) ;
118
118
}
@@ -289,7 +289,7 @@ impl InlineAsmReg {
289
289
290
290
pub fn parse (
291
291
arch : InlineAsmArch ,
292
- has_feature : impl FnMut ( Symbol ) -> bool ,
292
+ target_features : & FxHashSet < Symbol > ,
293
293
target : & Target ,
294
294
name : Symbol ,
295
295
) -> Result < Self , & ' static str > {
@@ -298,43 +298,43 @@ impl InlineAsmReg {
298
298
let name = name. as_str ( ) ;
299
299
Ok ( match arch {
300
300
InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
301
- Self :: X86 ( X86InlineAsmReg :: parse ( arch, has_feature , target, name) ?)
301
+ Self :: X86 ( X86InlineAsmReg :: parse ( arch, target_features , target, name) ?)
302
302
}
303
303
InlineAsmArch :: Arm => {
304
- Self :: Arm ( ArmInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
304
+ Self :: Arm ( ArmInlineAsmReg :: parse ( arch, target_features , target, name) ?)
305
305
}
306
306
InlineAsmArch :: AArch64 => {
307
- Self :: AArch64 ( AArch64InlineAsmReg :: parse ( arch, has_feature , target, name) ?)
307
+ Self :: AArch64 ( AArch64InlineAsmReg :: parse ( arch, target_features , target, name) ?)
308
308
}
309
309
InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
310
- Self :: RiscV ( RiscVInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
310
+ Self :: RiscV ( RiscVInlineAsmReg :: parse ( arch, target_features , target, name) ?)
311
311
}
312
312
InlineAsmArch :: Nvptx64 => {
313
- Self :: Nvptx ( NvptxInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
313
+ Self :: Nvptx ( NvptxInlineAsmReg :: parse ( arch, target_features , target, name) ?)
314
314
}
315
315
InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => {
316
- Self :: PowerPC ( PowerPCInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
316
+ Self :: PowerPC ( PowerPCInlineAsmReg :: parse ( arch, target_features , target, name) ?)
317
317
}
318
318
InlineAsmArch :: Hexagon => {
319
- Self :: Hexagon ( HexagonInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
319
+ Self :: Hexagon ( HexagonInlineAsmReg :: parse ( arch, target_features , target, name) ?)
320
320
}
321
321
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
322
- Self :: Mips ( MipsInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
322
+ Self :: Mips ( MipsInlineAsmReg :: parse ( arch, target_features , target, name) ?)
323
323
}
324
324
InlineAsmArch :: S390x => {
325
- Self :: S390x ( S390xInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
325
+ Self :: S390x ( S390xInlineAsmReg :: parse ( arch, target_features , target, name) ?)
326
326
}
327
327
InlineAsmArch :: SpirV => {
328
- Self :: SpirV ( SpirVInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
328
+ Self :: SpirV ( SpirVInlineAsmReg :: parse ( arch, target_features , target, name) ?)
329
329
}
330
330
InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => {
331
- Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
331
+ Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, target_features , target, name) ?)
332
332
}
333
333
InlineAsmArch :: Bpf => {
334
- Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
334
+ Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, target_features , target, name) ?)
335
335
}
336
336
InlineAsmArch :: Avr => {
337
- Self :: Avr ( AvrInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
337
+ Self :: Avr ( AvrInlineAsmReg :: parse ( arch, target_features , target, name) ?)
338
338
}
339
339
} )
340
340
}
@@ -695,73 +695,73 @@ impl fmt::Display for InlineAsmType {
695
695
// falling back to an external assembler.
696
696
pub fn allocatable_registers (
697
697
arch : InlineAsmArch ,
698
- has_feature : impl FnMut ( Symbol ) -> bool ,
698
+ target_features : & FxHashSet < Symbol > ,
699
699
target : & crate :: spec:: Target ,
700
700
) -> FxHashMap < InlineAsmRegClass , FxHashSet < InlineAsmReg > > {
701
701
match arch {
702
702
InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
703
703
let mut map = x86:: regclass_map ( ) ;
704
- x86:: fill_reg_map ( arch, has_feature , target, & mut map) ;
704
+ x86:: fill_reg_map ( arch, target_features , target, & mut map) ;
705
705
map
706
706
}
707
707
InlineAsmArch :: Arm => {
708
708
let mut map = arm:: regclass_map ( ) ;
709
- arm:: fill_reg_map ( arch, has_feature , target, & mut map) ;
709
+ arm:: fill_reg_map ( arch, target_features , target, & mut map) ;
710
710
map
711
711
}
712
712
InlineAsmArch :: AArch64 => {
713
713
let mut map = aarch64:: regclass_map ( ) ;
714
- aarch64:: fill_reg_map ( arch, has_feature , target, & mut map) ;
714
+ aarch64:: fill_reg_map ( arch, target_features , target, & mut map) ;
715
715
map
716
716
}
717
717
InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
718
718
let mut map = riscv:: regclass_map ( ) ;
719
- riscv:: fill_reg_map ( arch, has_feature , target, & mut map) ;
719
+ riscv:: fill_reg_map ( arch, target_features , target, & mut map) ;
720
720
map
721
721
}
722
722
InlineAsmArch :: Nvptx64 => {
723
723
let mut map = nvptx:: regclass_map ( ) ;
724
- nvptx:: fill_reg_map ( arch, has_feature , target, & mut map) ;
724
+ nvptx:: fill_reg_map ( arch, target_features , target, & mut map) ;
725
725
map
726
726
}
727
727
InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => {
728
728
let mut map = powerpc:: regclass_map ( ) ;
729
- powerpc:: fill_reg_map ( arch, has_feature , target, & mut map) ;
729
+ powerpc:: fill_reg_map ( arch, target_features , target, & mut map) ;
730
730
map
731
731
}
732
732
InlineAsmArch :: Hexagon => {
733
733
let mut map = hexagon:: regclass_map ( ) ;
734
- hexagon:: fill_reg_map ( arch, has_feature , target, & mut map) ;
734
+ hexagon:: fill_reg_map ( arch, target_features , target, & mut map) ;
735
735
map
736
736
}
737
737
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
738
738
let mut map = mips:: regclass_map ( ) ;
739
- mips:: fill_reg_map ( arch, has_feature , target, & mut map) ;
739
+ mips:: fill_reg_map ( arch, target_features , target, & mut map) ;
740
740
map
741
741
}
742
742
InlineAsmArch :: S390x => {
743
743
let mut map = s390x:: regclass_map ( ) ;
744
- s390x:: fill_reg_map ( arch, has_feature , target, & mut map) ;
744
+ s390x:: fill_reg_map ( arch, target_features , target, & mut map) ;
745
745
map
746
746
}
747
747
InlineAsmArch :: SpirV => {
748
748
let mut map = spirv:: regclass_map ( ) ;
749
- spirv:: fill_reg_map ( arch, has_feature , target, & mut map) ;
749
+ spirv:: fill_reg_map ( arch, target_features , target, & mut map) ;
750
750
map
751
751
}
752
752
InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => {
753
753
let mut map = wasm:: regclass_map ( ) ;
754
- wasm:: fill_reg_map ( arch, has_feature , target, & mut map) ;
754
+ wasm:: fill_reg_map ( arch, target_features , target, & mut map) ;
755
755
map
756
756
}
757
757
InlineAsmArch :: Bpf => {
758
758
let mut map = bpf:: regclass_map ( ) ;
759
- bpf:: fill_reg_map ( arch, has_feature , target, & mut map) ;
759
+ bpf:: fill_reg_map ( arch, target_features , target, & mut map) ;
760
760
map
761
761
}
762
762
InlineAsmArch :: Avr => {
763
763
let mut map = avr:: regclass_map ( ) ;
764
- avr:: fill_reg_map ( arch, has_feature , target, & mut map) ;
764
+ avr:: fill_reg_map ( arch, target_features , target, & mut map) ;
765
765
map
766
766
}
767
767
}
@@ -794,7 +794,7 @@ impl InlineAsmClobberAbi {
794
794
/// clobber ABIs for the target.
795
795
pub fn parse (
796
796
arch : InlineAsmArch ,
797
- has_feature : impl FnMut ( Symbol ) -> bool ,
797
+ target_features : & FxHashSet < Symbol > ,
798
798
target : & Target ,
799
799
name : Symbol ,
800
800
) -> Result < Self , & ' static [ & ' static str ] > {
@@ -819,7 +819,7 @@ impl InlineAsmClobberAbi {
819
819
} ,
820
820
InlineAsmArch :: AArch64 => match name {
821
821
"C" | "system" | "efiapi" => {
822
- Ok ( if aarch64:: reserved_x18 ( arch, has_feature , target) . is_err ( ) {
822
+ Ok ( if aarch64:: reserved_x18 ( arch, target_features , target) . is_err ( ) {
823
823
InlineAsmClobberAbi :: AArch64NoX18
824
824
} else {
825
825
InlineAsmClobberAbi :: AArch64
0 commit comments