@@ -81,14 +81,14 @@ macro_rules! def_regs {
8181
8282 pub fn parse(
8383 _arch: super :: InlineAsmArch ,
84- mut _has_feature : impl FnMut ( rustc_span :: Symbol ) -> bool ,
84+ _target_features : & rustc_data_structures :: fx :: FxHashSet < Symbol > ,
8585 _target: & crate :: spec:: Target ,
8686 name: & str ,
8787 ) -> Result <Self , & ' static str > {
8888 match name {
8989 $(
9090 $( $alias) |* | $reg_name => {
91- $( $filter( _arch, & mut _has_feature , _target) ?; ) ?
91+ $( $filter( _arch, _target_features , _target) ?; ) ?
9292 Ok ( Self :: $reg)
9393 }
9494 ) *
@@ -102,7 +102,7 @@ macro_rules! def_regs {
102102
103103 pub ( super ) fn fill_reg_map(
104104 _arch: super :: InlineAsmArch ,
105- mut _has_feature : impl FnMut ( rustc_span :: Symbol ) -> bool ,
105+ _target_features : & rustc_data_structures :: fx :: FxHashSet < Symbol > ,
106106 _target: & crate :: spec:: Target ,
107107 _map: & mut rustc_data_structures:: fx:: FxHashMap <
108108 super :: InlineAsmRegClass ,
@@ -112,7 +112,7 @@ macro_rules! def_regs {
112112 #[ allow( unused_imports) ]
113113 use super :: { InlineAsmReg , InlineAsmRegClass } ;
114114 $(
115- if $( $filter( _arch, & mut _has_feature , _target) . is_ok( ) &&) ? true {
115+ if $( $filter( _arch, _target_features , _target) . is_ok( ) &&) ? true {
116116 if let Some ( set) = _map. get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $class) ) {
117117 set. insert( InlineAsmReg :: $arch( $arch_reg:: $reg) ) ;
118118 }
@@ -289,7 +289,7 @@ impl InlineAsmReg {
289289
290290 pub fn parse (
291291 arch : InlineAsmArch ,
292- has_feature : impl FnMut ( Symbol ) -> bool ,
292+ target_features : & FxHashSet < Symbol > ,
293293 target : & Target ,
294294 name : Symbol ,
295295 ) -> Result < Self , & ' static str > {
@@ -298,43 +298,43 @@ impl InlineAsmReg {
298298 let name = name. as_str ( ) ;
299299 Ok ( match arch {
300300 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) ?)
302302 }
303303 InlineAsmArch :: Arm => {
304- Self :: Arm ( ArmInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
304+ Self :: Arm ( ArmInlineAsmReg :: parse ( arch, target_features , target, name) ?)
305305 }
306306 InlineAsmArch :: AArch64 => {
307- Self :: AArch64 ( AArch64InlineAsmReg :: parse ( arch, has_feature , target, name) ?)
307+ Self :: AArch64 ( AArch64InlineAsmReg :: parse ( arch, target_features , target, name) ?)
308308 }
309309 InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
310- Self :: RiscV ( RiscVInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
310+ Self :: RiscV ( RiscVInlineAsmReg :: parse ( arch, target_features , target, name) ?)
311311 }
312312 InlineAsmArch :: Nvptx64 => {
313- Self :: Nvptx ( NvptxInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
313+ Self :: Nvptx ( NvptxInlineAsmReg :: parse ( arch, target_features , target, name) ?)
314314 }
315315 InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => {
316- Self :: PowerPC ( PowerPCInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
316+ Self :: PowerPC ( PowerPCInlineAsmReg :: parse ( arch, target_features , target, name) ?)
317317 }
318318 InlineAsmArch :: Hexagon => {
319- Self :: Hexagon ( HexagonInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
319+ Self :: Hexagon ( HexagonInlineAsmReg :: parse ( arch, target_features , target, name) ?)
320320 }
321321 InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
322- Self :: Mips ( MipsInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
322+ Self :: Mips ( MipsInlineAsmReg :: parse ( arch, target_features , target, name) ?)
323323 }
324324 InlineAsmArch :: S390x => {
325- Self :: S390x ( S390xInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
325+ Self :: S390x ( S390xInlineAsmReg :: parse ( arch, target_features , target, name) ?)
326326 }
327327 InlineAsmArch :: SpirV => {
328- Self :: SpirV ( SpirVInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
328+ Self :: SpirV ( SpirVInlineAsmReg :: parse ( arch, target_features , target, name) ?)
329329 }
330330 InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => {
331- Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
331+ Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, target_features , target, name) ?)
332332 }
333333 InlineAsmArch :: Bpf => {
334- Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
334+ Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, target_features , target, name) ?)
335335 }
336336 InlineAsmArch :: Avr => {
337- Self :: Avr ( AvrInlineAsmReg :: parse ( arch, has_feature , target, name) ?)
337+ Self :: Avr ( AvrInlineAsmReg :: parse ( arch, target_features , target, name) ?)
338338 }
339339 } )
340340 }
@@ -695,73 +695,73 @@ impl fmt::Display for InlineAsmType {
695695// falling back to an external assembler.
696696pub fn allocatable_registers (
697697 arch : InlineAsmArch ,
698- has_feature : impl FnMut ( Symbol ) -> bool ,
698+ target_features : & FxHashSet < Symbol > ,
699699 target : & crate :: spec:: Target ,
700700) -> FxHashMap < InlineAsmRegClass , FxHashSet < InlineAsmReg > > {
701701 match arch {
702702 InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
703703 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) ;
705705 map
706706 }
707707 InlineAsmArch :: Arm => {
708708 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) ;
710710 map
711711 }
712712 InlineAsmArch :: AArch64 => {
713713 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) ;
715715 map
716716 }
717717 InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
718718 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) ;
720720 map
721721 }
722722 InlineAsmArch :: Nvptx64 => {
723723 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) ;
725725 map
726726 }
727727 InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => {
728728 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) ;
730730 map
731731 }
732732 InlineAsmArch :: Hexagon => {
733733 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) ;
735735 map
736736 }
737737 InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
738738 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) ;
740740 map
741741 }
742742 InlineAsmArch :: S390x => {
743743 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) ;
745745 map
746746 }
747747 InlineAsmArch :: SpirV => {
748748 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) ;
750750 map
751751 }
752752 InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => {
753753 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) ;
755755 map
756756 }
757757 InlineAsmArch :: Bpf => {
758758 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) ;
760760 map
761761 }
762762 InlineAsmArch :: Avr => {
763763 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) ;
765765 map
766766 }
767767 }
@@ -794,7 +794,7 @@ impl InlineAsmClobberAbi {
794794 /// clobber ABIs for the target.
795795 pub fn parse (
796796 arch : InlineAsmArch ,
797- has_feature : impl FnMut ( Symbol ) -> bool ,
797+ target_features : & FxHashSet < Symbol > ,
798798 target : & Target ,
799799 name : Symbol ,
800800 ) -> Result < Self , & ' static [ & ' static str ] > {
@@ -819,7 +819,7 @@ impl InlineAsmClobberAbi {
819819 } ,
820820 InlineAsmArch :: AArch64 => match name {
821821 "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 ( ) {
823823 InlineAsmClobberAbi :: AArch64NoX18
824824 } else {
825825 InlineAsmClobberAbi :: AArch64
0 commit comments