@@ -60,6 +60,7 @@ macro_rules! def_regs {
60
60
#error = [ $( $bad_reg: literal) ,+] => $error: literal,
61
61
) *
62
62
} ) => {
63
+ #[ allow( unreachable_code) ]
63
64
#[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug , Eq , PartialEq , Hash , HashStable_Generic ) ]
64
65
#[ allow( non_camel_case_types) ]
65
66
pub enum $arch_reg {
@@ -102,19 +103,20 @@ macro_rules! def_regs {
102
103
pub ( super ) fn fill_reg_map(
103
104
_arch: super :: InlineAsmArch ,
104
105
mut _has_feature: impl FnMut ( & str ) -> bool ,
105
- map : & mut rustc_data_structures:: fx:: FxHashMap <
106
+ _map : & mut rustc_data_structures:: fx:: FxHashMap <
106
107
super :: InlineAsmRegClass ,
107
108
rustc_data_structures:: fx:: FxHashSet <super :: InlineAsmReg >,
108
109
>,
109
110
) {
111
+ #[ allow( unused_imports) ]
110
112
use super :: { InlineAsmReg , InlineAsmRegClass } ;
111
113
$(
112
114
if $( $filter( _arch, & mut _has_feature, true ) . is_ok( ) &&) ? true {
113
- if let Some ( set) = map . get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $class) ) {
115
+ if let Some ( set) = _map . get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $class) ) {
114
116
set. insert( InlineAsmReg :: $arch( $arch_reg:: $reg) ) ;
115
117
}
116
118
$(
117
- if let Some ( set) = map . get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $extra_class) ) {
119
+ if let Some ( set) = _map . get_mut( & InlineAsmRegClass :: $arch( $arch_regclass:: $extra_class) ) {
118
120
set. insert( InlineAsmReg :: $arch( $arch_reg:: $reg) ) ;
119
121
}
120
122
) *
@@ -146,11 +148,13 @@ macro_rules! types {
146
148
147
149
mod aarch64;
148
150
mod arm;
151
+ mod nvptx;
149
152
mod riscv;
150
153
mod x86;
151
154
152
155
pub use aarch64:: { AArch64InlineAsmReg , AArch64InlineAsmRegClass } ;
153
156
pub use arm:: { ArmInlineAsmReg , ArmInlineAsmRegClass } ;
157
+ pub use nvptx:: { NvptxInlineAsmReg , NvptxInlineAsmRegClass } ;
154
158
pub use riscv:: { RiscVInlineAsmReg , RiscVInlineAsmRegClass } ;
155
159
pub use x86:: { X86InlineAsmReg , X86InlineAsmRegClass } ;
156
160
@@ -162,6 +166,7 @@ pub enum InlineAsmArch {
162
166
AArch64 ,
163
167
RiscV32 ,
164
168
RiscV64 ,
169
+ Nvptx64 ,
165
170
}
166
171
167
172
impl FromStr for InlineAsmArch {
@@ -175,6 +180,7 @@ impl FromStr for InlineAsmArch {
175
180
"aarch64" => Ok ( Self :: AArch64 ) ,
176
181
"riscv32" => Ok ( Self :: RiscV32 ) ,
177
182
"riscv64" => Ok ( Self :: RiscV64 ) ,
183
+ "nvptx64" => Ok ( Self :: Nvptx64 ) ,
178
184
_ => Err ( ( ) ) ,
179
185
}
180
186
}
@@ -196,6 +202,7 @@ pub enum InlineAsmReg {
196
202
Arm ( ArmInlineAsmReg ) ,
197
203
AArch64 ( AArch64InlineAsmReg ) ,
198
204
RiscV ( RiscVInlineAsmReg ) ,
205
+ Nvptx ( NvptxInlineAsmReg ) ,
199
206
}
200
207
201
208
impl InlineAsmReg {
@@ -236,6 +243,9 @@ impl InlineAsmReg {
236
243
InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
237
244
Self :: RiscV ( RiscVInlineAsmReg :: parse ( arch, has_feature, & name) ?)
238
245
}
246
+ InlineAsmArch :: Nvptx64 => {
247
+ Self :: Nvptx ( NvptxInlineAsmReg :: parse ( arch, has_feature, & name) ?)
248
+ }
239
249
} )
240
250
}
241
251
@@ -281,6 +291,7 @@ pub enum InlineAsmRegClass {
281
291
Arm ( ArmInlineAsmRegClass ) ,
282
292
AArch64 ( AArch64InlineAsmRegClass ) ,
283
293
RiscV ( RiscVInlineAsmRegClass ) ,
294
+ Nvptx ( NvptxInlineAsmRegClass ) ,
284
295
}
285
296
286
297
impl InlineAsmRegClass {
@@ -290,6 +301,7 @@ impl InlineAsmRegClass {
290
301
Self :: Arm ( r) => r. name ( ) ,
291
302
Self :: AArch64 ( r) => r. name ( ) ,
292
303
Self :: RiscV ( r) => r. name ( ) ,
304
+ Self :: Nvptx ( r) => r. name ( ) ,
293
305
}
294
306
}
295
307
@@ -302,6 +314,7 @@ impl InlineAsmRegClass {
302
314
Self :: Arm ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Arm ) ,
303
315
Self :: AArch64 ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: AArch64 ) ,
304
316
Self :: RiscV ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: RiscV ) ,
317
+ Self :: Nvptx ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Nvptx ) ,
305
318
}
306
319
}
307
320
@@ -321,6 +334,7 @@ impl InlineAsmRegClass {
321
334
Self :: Arm ( r) => r. suggest_modifier ( arch, ty) ,
322
335
Self :: AArch64 ( r) => r. suggest_modifier ( arch, ty) ,
323
336
Self :: RiscV ( r) => r. suggest_modifier ( arch, ty) ,
337
+ Self :: Nvptx ( r) => r. suggest_modifier ( arch, ty) ,
324
338
}
325
339
}
326
340
@@ -336,6 +350,7 @@ impl InlineAsmRegClass {
336
350
Self :: Arm ( r) => r. default_modifier ( arch) ,
337
351
Self :: AArch64 ( r) => r. default_modifier ( arch) ,
338
352
Self :: RiscV ( r) => r. default_modifier ( arch) ,
353
+ Self :: Nvptx ( r) => r. default_modifier ( arch) ,
339
354
}
340
355
}
341
356
@@ -350,6 +365,7 @@ impl InlineAsmRegClass {
350
365
Self :: Arm ( r) => r. supported_types ( arch) ,
351
366
Self :: AArch64 ( r) => r. supported_types ( arch) ,
352
367
Self :: RiscV ( r) => r. supported_types ( arch) ,
368
+ Self :: Nvptx ( r) => r. supported_types ( arch) ,
353
369
}
354
370
}
355
371
@@ -367,6 +383,7 @@ impl InlineAsmRegClass {
367
383
InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
368
384
Self :: RiscV ( RiscVInlineAsmRegClass :: parse ( arch, name) ?)
369
385
}
386
+ InlineAsmArch :: Nvptx64 => Self :: Nvptx ( NvptxInlineAsmRegClass :: parse ( arch, name) ?) ,
370
387
} )
371
388
} )
372
389
}
@@ -379,6 +396,7 @@ impl InlineAsmRegClass {
379
396
Self :: Arm ( r) => r. valid_modifiers ( arch) ,
380
397
Self :: AArch64 ( r) => r. valid_modifiers ( arch) ,
381
398
Self :: RiscV ( r) => r. valid_modifiers ( arch) ,
399
+ Self :: Nvptx ( r) => r. valid_modifiers ( arch) ,
382
400
}
383
401
}
384
402
}
@@ -518,5 +536,10 @@ pub fn allocatable_registers(
518
536
riscv:: fill_reg_map ( arch, has_feature, & mut map) ;
519
537
map
520
538
}
539
+ InlineAsmArch :: Nvptx64 => {
540
+ let mut map = nvptx:: regclass_map ( ) ;
541
+ nvptx:: fill_reg_map ( arch, has_feature, & mut map) ;
542
+ map
543
+ }
521
544
}
522
545
}
0 commit comments