1
- use crate :: abi:: Size ;
2
1
use crate :: spec:: Target ;
2
+ use crate :: { abi:: Size , spec:: RelocModel } ;
3
3
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
4
4
use rustc_macros:: HashStable_Generic ;
5
5
use rustc_span:: Symbol ;
@@ -81,6 +81,7 @@ macro_rules! def_regs {
81
81
82
82
pub fn parse(
83
83
_arch: super :: InlineAsmArch ,
84
+ _reloc_model: crate :: spec:: RelocModel ,
84
85
_target_features: & rustc_data_structures:: fx:: FxHashSet <Symbol >,
85
86
_target: & crate :: spec:: Target ,
86
87
_is_clobber: bool ,
@@ -89,7 +90,7 @@ macro_rules! def_regs {
89
90
match name {
90
91
$(
91
92
$( $alias) |* | $reg_name => {
92
- $( $filter( _arch, _target_features, _target, _is_clobber) ?; ) ?
93
+ $( $filter( _arch, _reloc_model , _target_features, _target, _is_clobber) ?; ) ?
93
94
Ok ( Self :: $reg)
94
95
}
95
96
) *
@@ -103,6 +104,7 @@ macro_rules! def_regs {
103
104
104
105
pub ( super ) fn fill_reg_map(
105
106
_arch: super :: InlineAsmArch ,
107
+ _reloc_model: crate :: spec:: RelocModel ,
106
108
_target_features: & rustc_data_structures:: fx:: FxHashSet <Symbol >,
107
109
_target: & crate :: spec:: Target ,
108
110
_map: & mut rustc_data_structures:: fx:: FxHashMap <
@@ -113,7 +115,7 @@ macro_rules! def_regs {
113
115
#[ allow( unused_imports) ]
114
116
use super :: { InlineAsmReg , InlineAsmRegClass } ;
115
117
$(
116
- if $( $filter( _arch, _target_features, _target, false ) . is_ok( ) &&) ? true {
118
+ if $( $filter( _arch, _reloc_model , _target_features, _target, false ) . is_ok( ) &&) ? true {
117
119
if let Some ( set) = _map. get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $class) ) {
118
120
set. insert( InlineAsmReg :: $arch( $arch_reg:: $reg) ) ;
119
121
}
@@ -297,6 +299,7 @@ impl InlineAsmReg {
297
299
298
300
pub fn parse (
299
301
arch : InlineAsmArch ,
302
+ reloc_model : RelocModel ,
300
303
target_features : & FxHashSet < Symbol > ,
301
304
target : & Target ,
302
305
is_clobber : bool ,
@@ -307,75 +310,75 @@ impl InlineAsmReg {
307
310
let name = name. as_str ( ) ;
308
311
Ok ( match arch {
309
312
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) ?)
311
314
}
312
315
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) ?)
314
317
}
315
318
InlineAsmArch :: AArch64 => Self :: AArch64 ( AArch64InlineAsmReg :: parse (
316
319
arch,
317
- target_features,
320
+ reloc_model , target_features,
318
321
target,
319
322
is_clobber,
320
323
name,
321
324
) ?) ,
322
325
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) ?,
324
327
) ,
325
328
InlineAsmArch :: Nvptx64 => Self :: Nvptx ( NvptxInlineAsmReg :: parse (
326
329
arch,
327
- target_features,
330
+ reloc_model , target_features,
328
331
target,
329
332
is_clobber,
330
333
name,
331
334
) ?) ,
332
335
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) ?,
334
337
) ,
335
338
InlineAsmArch :: Hexagon => Self :: Hexagon ( HexagonInlineAsmReg :: parse (
336
339
arch,
337
- target_features,
340
+ reloc_model , target_features,
338
341
target,
339
342
is_clobber,
340
343
name,
341
344
) ?) ,
342
345
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => Self :: Mips ( MipsInlineAsmReg :: parse (
343
346
arch,
344
- target_features,
347
+ reloc_model , target_features,
345
348
target,
346
349
is_clobber,
347
350
name,
348
351
) ?) ,
349
352
InlineAsmArch :: S390x => Self :: S390x ( S390xInlineAsmReg :: parse (
350
353
arch,
351
- target_features,
354
+ reloc_model , target_features,
352
355
target,
353
356
is_clobber,
354
357
name,
355
358
) ?) ,
356
359
InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmReg :: parse (
357
360
arch,
358
- target_features,
361
+ reloc_model , target_features,
359
362
target,
360
363
is_clobber,
361
364
name,
362
365
) ?) ,
363
366
InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => Self :: Wasm ( WasmInlineAsmReg :: parse (
364
367
arch,
365
- target_features,
368
+ reloc_model , target_features,
366
369
target,
367
370
is_clobber,
368
371
name,
369
372
) ?) ,
370
373
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) ?)
372
375
}
373
376
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) ?)
375
378
}
376
379
InlineAsmArch :: Msp430 => Self :: Msp430 ( Msp430InlineAsmReg :: parse (
377
380
arch,
378
- target_features,
381
+ reloc_model , target_features,
379
382
target,
380
383
is_clobber,
381
384
name,
@@ -749,78 +752,79 @@ impl fmt::Display for InlineAsmType {
749
752
// falling back to an external assembler.
750
753
pub fn allocatable_registers (
751
754
arch : InlineAsmArch ,
755
+ reloc_model : RelocModel ,
752
756
target_features : & FxHashSet < Symbol > ,
753
757
target : & crate :: spec:: Target ,
754
758
) -> FxHashMap < InlineAsmRegClass , FxHashSet < InlineAsmReg > > {
755
759
match arch {
756
760
InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
757
761
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) ;
759
763
map
760
764
}
761
765
InlineAsmArch :: Arm => {
762
766
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) ;
764
768
map
765
769
}
766
770
InlineAsmArch :: AArch64 => {
767
771
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) ;
769
773
map
770
774
}
771
775
InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
772
776
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) ;
774
778
map
775
779
}
776
780
InlineAsmArch :: Nvptx64 => {
777
781
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) ;
779
783
map
780
784
}
781
785
InlineAsmArch :: PowerPC | InlineAsmArch :: PowerPC64 => {
782
786
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) ;
784
788
map
785
789
}
786
790
InlineAsmArch :: Hexagon => {
787
791
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) ;
789
793
map
790
794
}
791
795
InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
792
796
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) ;
794
798
map
795
799
}
796
800
InlineAsmArch :: S390x => {
797
801
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) ;
799
803
map
800
804
}
801
805
InlineAsmArch :: SpirV => {
802
806
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) ;
804
808
map
805
809
}
806
810
InlineAsmArch :: Wasm32 | InlineAsmArch :: Wasm64 => {
807
811
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) ;
809
813
map
810
814
}
811
815
InlineAsmArch :: Bpf => {
812
816
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) ;
814
818
map
815
819
}
816
820
InlineAsmArch :: Avr => {
817
821
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) ;
819
823
map
820
824
}
821
825
InlineAsmArch :: Msp430 => {
822
826
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) ;
824
828
map
825
829
}
826
830
}
@@ -853,6 +857,7 @@ impl InlineAsmClobberAbi {
853
857
/// clobber ABIs for the target.
854
858
pub fn parse (
855
859
arch : InlineAsmArch ,
860
+ reloc_model : RelocModel ,
856
861
target_features : & FxHashSet < Symbol > ,
857
862
target : & Target ,
858
863
name : Symbol ,
@@ -878,7 +883,7 @@ impl InlineAsmClobberAbi {
878
883
} ,
879
884
InlineAsmArch :: AArch64 => match name {
880
885
"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 ( ) {
882
887
InlineAsmClobberAbi :: AArch64NoX18
883
888
} else {
884
889
InlineAsmClobberAbi :: AArch64
0 commit comments