1- use crate :: abi:: Size ;
21use crate :: spec:: Target ;
2+ use crate :: { abi:: Size , spec:: RelocModel } ;
33use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
44use rustc_macros:: HashStable_Generic ;
55use rustc_span:: Symbol ;
@@ -81,6 +81,7 @@ macro_rules! def_regs {
8181
8282 pub fn parse(
8383 _arch: super :: InlineAsmArch ,
84+ _reloc_model: crate :: spec:: RelocModel ,
8485 _target_features: & rustc_data_structures:: fx:: FxHashSet <Symbol >,
8586 _target: & crate :: spec:: Target ,
8687 _is_clobber: bool ,
@@ -89,7 +90,7 @@ macro_rules! def_regs {
8990 match name {
9091 $(
9192 $( $alias) |* | $reg_name => {
92- $( $filter( _arch, _target_features, _target, _is_clobber) ?; ) ?
93+ $( $filter( _arch, _reloc_model , _target_features, _target, _is_clobber) ?; ) ?
9394 Ok ( Self :: $reg)
9495 }
9596 ) *
@@ -103,6 +104,7 @@ macro_rules! def_regs {
103104
104105 pub ( super ) fn fill_reg_map(
105106 _arch: super :: InlineAsmArch ,
107+ _reloc_model: crate :: spec:: RelocModel ,
106108 _target_features: & rustc_data_structures:: fx:: FxHashSet <Symbol >,
107109 _target: & crate :: spec:: Target ,
108110 _map: & mut rustc_data_structures:: fx:: FxHashMap <
@@ -113,7 +115,7 @@ macro_rules! def_regs {
113115 #[ allow( unused_imports) ]
114116 use super :: { InlineAsmReg , InlineAsmRegClass } ;
115117 $(
116- if $( $filter( _arch, _target_features, _target, false ) . is_ok( ) &&) ? true {
118+ if $( $filter( _arch, _reloc_model , _target_features, _target, false ) . is_ok( ) &&) ? true {
117119 if let Some ( set) = _map. get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $class) ) {
118120 set. insert( InlineAsmReg :: $arch( $arch_reg:: $reg) ) ;
119121 }
@@ -297,6 +299,7 @@ impl InlineAsmReg {
297299
298300 pub fn parse (
299301 arch : InlineAsmArch ,
302+ reloc_model : RelocModel ,
300303 target_features : & FxHashSet < Symbol > ,
301304 target : & Target ,
302305 is_clobber : bool ,
@@ -307,75 +310,75 @@ impl InlineAsmReg {
307310 let name = name. as_str ( ) ;
308311 Ok ( match arch {
309312 InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
310- Self :: X86 ( X86InlineAsmReg :: parse ( arch, target_features, target, is_clobber, name) ?)
313+ Self :: X86 ( X86InlineAsmReg :: parse ( arch, reloc_model , target_features, target, is_clobber, name) ?)
311314 }
312315 InlineAsmArch :: Arm => {
313- Self :: Arm ( ArmInlineAsmReg :: parse ( arch, target_features, target, is_clobber, name) ?)
316+ Self :: Arm ( ArmInlineAsmReg :: parse ( arch, reloc_model , target_features, target, is_clobber, name) ?)
314317 }
315318 InlineAsmArch :: AArch64 => Self :: AArch64 ( AArch64InlineAsmReg :: parse (
316319 arch,
317- target_features,
320+ reloc_model , target_features,
318321 target,
319322 is_clobber,
320323 name,
321324 ) ?) ,
322325 InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => Self :: RiscV (
323- RiscVInlineAsmReg :: parse ( arch, target_features, target, is_clobber, name) ?,
326+ RiscVInlineAsmReg :: parse ( arch, reloc_model , target_features, target, is_clobber, name) ?,
324327 ) ,
325328 InlineAsmArch :: Nvptx64 => Self :: Nvptx ( NvptxInlineAsmReg :: parse (
326329 arch,
327- target_features,
330+ reloc_model , target_features,
328331 target,
329332 is_clobber,
330333 name,
331334 ) ?) ,
332335 InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => Self :: PowerPC (
333- PowerPCInlineAsmReg :: parse ( arch, target_features, target, is_clobber, name) ?,
336+ PowerPCInlineAsmReg :: parse ( arch, reloc_model , target_features, target, is_clobber, name) ?,
334337 ) ,
335338 InlineAsmArch :: Hexagon => Self :: Hexagon ( HexagonInlineAsmReg :: parse (
336339 arch,
337- target_features,
340+ reloc_model , target_features,
338341 target,
339342 is_clobber,
340343 name,
341344 ) ?) ,
342345 InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => Self :: Mips ( MipsInlineAsmReg :: parse (
343346 arch,
344- target_features,
347+ reloc_model , target_features,
345348 target,
346349 is_clobber,
347350 name,
348351 ) ?) ,
349352 InlineAsmArch :: S390x => Self :: S390x ( S390xInlineAsmReg :: parse (
350353 arch,
351- target_features,
354+ reloc_model , target_features,
352355 target,
353356 is_clobber,
354357 name,
355358 ) ?) ,
356359 InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmReg :: parse (
357360 arch,
358- target_features,
361+ reloc_model , target_features,
359362 target,
360363 is_clobber,
361364 name,
362365 ) ?) ,
363366 InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => Self :: Wasm ( WasmInlineAsmReg :: parse (
364367 arch,
365- target_features,
368+ reloc_model , target_features,
366369 target,
367370 is_clobber,
368371 name,
369372 ) ?) ,
370373 InlineAsmArch :: Bpf => {
371- Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, target_features, target, is_clobber, name) ?)
374+ Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, reloc_model , target_features, target, is_clobber, name) ?)
372375 }
373376 InlineAsmArch :: Avr => {
374- Self :: Avr ( AvrInlineAsmReg :: parse ( arch, target_features, target, is_clobber, name) ?)
377+ Self :: Avr ( AvrInlineAsmReg :: parse ( arch, reloc_model , target_features, target, is_clobber, name) ?)
375378 }
376379 InlineAsmArch :: Msp430 => Self :: Msp430 ( Msp430InlineAsmReg :: parse (
377380 arch,
378- target_features,
381+ reloc_model , target_features,
379382 target,
380383 is_clobber,
381384 name,
@@ -749,78 +752,79 @@ impl fmt::Display for InlineAsmType {
749752// falling back to an external assembler.
750753pub fn allocatable_registers (
751754 arch : InlineAsmArch ,
755+ reloc_model : RelocModel ,
752756 target_features : & FxHashSet < Symbol > ,
753757 target : & crate :: spec:: Target ,
754758) -> FxHashMap < InlineAsmRegClass , FxHashSet < InlineAsmReg > > {
755759 match arch {
756760 InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
757761 let mut map = x86:: regclass_map ( ) ;
758- x86:: fill_reg_map ( arch, target_features, target, & mut map) ;
762+ x86:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
759763 map
760764 }
761765 InlineAsmArch :: Arm => {
762766 let mut map = arm:: regclass_map ( ) ;
763- arm:: fill_reg_map ( arch, target_features, target, & mut map) ;
767+ arm:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
764768 map
765769 }
766770 InlineAsmArch :: AArch64 => {
767771 let mut map = aarch64:: regclass_map ( ) ;
768- aarch64:: fill_reg_map ( arch, target_features, target, & mut map) ;
772+ aarch64:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
769773 map
770774 }
771775 InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
772776 let mut map = riscv:: regclass_map ( ) ;
773- riscv:: fill_reg_map ( arch, target_features, target, & mut map) ;
777+ riscv:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
774778 map
775779 }
776780 InlineAsmArch :: Nvptx64 => {
777781 let mut map = nvptx:: regclass_map ( ) ;
778- nvptx:: fill_reg_map ( arch, target_features, target, & mut map) ;
782+ nvptx:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
779783 map
780784 }
781785 InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => {
782786 let mut map = powerpc:: regclass_map ( ) ;
783- powerpc:: fill_reg_map ( arch, target_features, target, & mut map) ;
787+ powerpc:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
784788 map
785789 }
786790 InlineAsmArch :: Hexagon => {
787791 let mut map = hexagon:: regclass_map ( ) ;
788- hexagon:: fill_reg_map ( arch, target_features, target, & mut map) ;
792+ hexagon:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
789793 map
790794 }
791795 InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
792796 let mut map = mips:: regclass_map ( ) ;
793- mips:: fill_reg_map ( arch, target_features, target, & mut map) ;
797+ mips:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
794798 map
795799 }
796800 InlineAsmArch :: S390x => {
797801 let mut map = s390x:: regclass_map ( ) ;
798- s390x:: fill_reg_map ( arch, target_features, target, & mut map) ;
802+ s390x:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
799803 map
800804 }
801805 InlineAsmArch :: SpirV => {
802806 let mut map = spirv:: regclass_map ( ) ;
803- spirv:: fill_reg_map ( arch, target_features, target, & mut map) ;
807+ spirv:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
804808 map
805809 }
806810 InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => {
807811 let mut map = wasm:: regclass_map ( ) ;
808- wasm:: fill_reg_map ( arch, target_features, target, & mut map) ;
812+ wasm:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
809813 map
810814 }
811815 InlineAsmArch :: Bpf => {
812816 let mut map = bpf:: regclass_map ( ) ;
813- bpf:: fill_reg_map ( arch, target_features, target, & mut map) ;
817+ bpf:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
814818 map
815819 }
816820 InlineAsmArch :: Avr => {
817821 let mut map = avr:: regclass_map ( ) ;
818- avr:: fill_reg_map ( arch, target_features, target, & mut map) ;
822+ avr:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
819823 map
820824 }
821825 InlineAsmArch :: Msp430 => {
822826 let mut map = msp430:: regclass_map ( ) ;
823- msp430:: fill_reg_map ( arch, target_features, target, & mut map) ;
827+ msp430:: fill_reg_map ( arch, reloc_model , target_features, target, & mut map) ;
824828 map
825829 }
826830 }
@@ -853,6 +857,7 @@ impl InlineAsmClobberAbi {
853857 /// clobber ABIs for the target.
854858 pub fn parse (
855859 arch : InlineAsmArch ,
860+ reloc_model : RelocModel ,
856861 target_features : & FxHashSet < Symbol > ,
857862 target : & Target ,
858863 name : Symbol ,
@@ -878,7 +883,7 @@ impl InlineAsmClobberAbi {
878883 } ,
879884 InlineAsmArch :: AArch64 => match name {
880885 "C" | "system" | "efiapi" => {
881- Ok ( if aarch64:: reserved_x18 ( arch, target_features, target, true ) . is_err ( ) {
886+ Ok ( if aarch64:: reserved_x18 ( arch, reloc_model , target_features, target, true ) . is_err ( ) {
882887 InlineAsmClobberAbi :: AArch64NoX18
883888 } else {
884889 InlineAsmClobberAbi :: AArch64
0 commit comments