@@ -157,6 +157,7 @@ mod riscv;
157
157
mod spirv;
158
158
mod wasm;
159
159
mod x86;
160
+ mod xtensa;
160
161
161
162
pub use aarch64:: { AArch64InlineAsmReg , AArch64InlineAsmRegClass } ;
162
163
pub use arm:: { ArmInlineAsmReg , ArmInlineAsmRegClass } ;
@@ -168,6 +169,7 @@ pub use powerpc::{PowerPCInlineAsmReg, PowerPCInlineAsmRegClass};
168
169
pub use riscv:: { RiscVInlineAsmReg , RiscVInlineAsmRegClass } ;
169
170
pub use spirv:: { SpirVInlineAsmReg , SpirVInlineAsmRegClass } ;
170
171
pub use wasm:: { WasmInlineAsmReg , WasmInlineAsmRegClass } ;
172
+ pub use xtensa:: { XtensaInlineAsmReg , XtensaInlineAsmRegClass } ;
171
173
pub use x86:: { X86InlineAsmReg , X86InlineAsmRegClass } ;
172
174
173
175
#[ derive( Copy , Clone , Encodable , Decodable , Debug , Eq , PartialEq , Hash ) ]
@@ -186,6 +188,7 @@ pub enum InlineAsmArch {
186
188
PowerPC64 ,
187
189
SpirV ,
188
190
Wasm32 ,
191
+ Xtensa ,
189
192
Bpf ,
190
193
}
191
194
@@ -208,6 +211,7 @@ impl FromStr for InlineAsmArch {
208
211
"mips64" => Ok ( Self :: Mips64 ) ,
209
212
"spirv" => Ok ( Self :: SpirV ) ,
210
213
"wasm32" => Ok ( Self :: Wasm32 ) ,
214
+ "xtensa" => Ok ( Self :: Xtensa ) ,
211
215
"bpf" => Ok ( Self :: Bpf ) ,
212
216
_ => Err ( ( ) ) ,
213
217
}
@@ -237,6 +241,7 @@ pub enum InlineAsmReg {
237
241
Mips ( MipsInlineAsmReg ) ,
238
242
SpirV ( SpirVInlineAsmReg ) ,
239
243
Wasm ( WasmInlineAsmReg ) ,
244
+ Xtensa ( XtensaInlineAsmReg ) ,
240
245
Bpf ( BpfInlineAsmReg ) ,
241
246
// Placeholder for invalid register constraints for the current target
242
247
Err ,
@@ -252,6 +257,7 @@ impl InlineAsmReg {
252
257
Self :: PowerPC ( r) => r. name ( ) ,
253
258
Self :: Hexagon ( r) => r. name ( ) ,
254
259
Self :: Mips ( r) => r. name ( ) ,
260
+ Self :: Xtensa ( r) => r. name ( ) ,
255
261
Self :: Bpf ( r) => r. name ( ) ,
256
262
Self :: Err => "<reg>" ,
257
263
}
@@ -266,6 +272,7 @@ impl InlineAsmReg {
266
272
Self :: PowerPC ( r) => InlineAsmRegClass :: PowerPC ( r. reg_class ( ) ) ,
267
273
Self :: Hexagon ( r) => InlineAsmRegClass :: Hexagon ( r. reg_class ( ) ) ,
268
274
Self :: Mips ( r) => InlineAsmRegClass :: Mips ( r. reg_class ( ) ) ,
275
+ Self :: Xtensa ( r) => InlineAsmRegClass :: Xtensa ( r. reg_class ( ) ) ,
269
276
Self :: Bpf ( r) => InlineAsmRegClass :: Bpf ( r. reg_class ( ) ) ,
270
277
Self :: Err => InlineAsmRegClass :: Err ,
271
278
}
@@ -311,6 +318,9 @@ impl InlineAsmReg {
311
318
InlineAsmArch :: Wasm32 => {
312
319
Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
313
320
}
321
+ InlineAsmArch :: Xtensa => {
322
+ Self :: Xtensa ( XtensaInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
323
+ }
314
324
InlineAsmArch :: Bpf => {
315
325
Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
316
326
}
@@ -333,6 +343,7 @@ impl InlineAsmReg {
333
343
Self :: PowerPC ( r) => r. emit ( out, arch, modifier) ,
334
344
Self :: Hexagon ( r) => r. emit ( out, arch, modifier) ,
335
345
Self :: Mips ( r) => r. emit ( out, arch, modifier) ,
346
+ Self :: Xtensa ( r) => r. emit ( out, arch, modifier) ,
336
347
Self :: Bpf ( r) => r. emit ( out, arch, modifier) ,
337
348
Self :: Err => unreachable ! ( "Use of InlineAsmReg::Err" ) ,
338
349
}
@@ -347,6 +358,7 @@ impl InlineAsmReg {
347
358
Self :: PowerPC ( _) => cb ( self ) ,
348
359
Self :: Hexagon ( r) => r. overlapping_regs ( |r| cb ( Self :: Hexagon ( r) ) ) ,
349
360
Self :: Mips ( _) => cb ( self ) ,
361
+ Self :: Xtensa ( _) => cb ( self ) ,
350
362
Self :: Bpf ( r) => r. overlapping_regs ( |r| cb ( Self :: Bpf ( r) ) ) ,
351
363
Self :: Err => unreachable ! ( "Use of InlineAsmReg::Err" ) ,
352
364
}
@@ -376,6 +388,7 @@ pub enum InlineAsmRegClass {
376
388
Mips ( MipsInlineAsmRegClass ) ,
377
389
SpirV ( SpirVInlineAsmRegClass ) ,
378
390
Wasm ( WasmInlineAsmRegClass ) ,
391
+ Xtensa ( XtensaInlineAsmRegClass ) ,
379
392
Bpf ( BpfInlineAsmRegClass ) ,
380
393
// Placeholder for invalid register constraints for the current target
381
394
Err ,
@@ -394,6 +407,7 @@ impl InlineAsmRegClass {
394
407
Self :: Mips ( r) => r. name ( ) ,
395
408
Self :: SpirV ( r) => r. name ( ) ,
396
409
Self :: Wasm ( r) => r. name ( ) ,
410
+ Self :: Xtensa ( r) => r. name ( ) ,
397
411
Self :: Bpf ( r) => r. name ( ) ,
398
412
Self :: Err => rustc_span:: symbol:: sym:: reg,
399
413
}
@@ -414,6 +428,7 @@ impl InlineAsmRegClass {
414
428
Self :: Mips ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Mips ) ,
415
429
Self :: SpirV ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: SpirV ) ,
416
430
Self :: Wasm ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Wasm ) ,
431
+ Self :: Xtensa ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Xtensa ) ,
417
432
Self :: Bpf ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Bpf ) ,
418
433
Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
419
434
}
@@ -441,6 +456,7 @@ impl InlineAsmRegClass {
441
456
Self :: Mips ( r) => r. suggest_modifier ( arch, ty) ,
442
457
Self :: SpirV ( r) => r. suggest_modifier ( arch, ty) ,
443
458
Self :: Wasm ( r) => r. suggest_modifier ( arch, ty) ,
459
+ Self :: Xtensa ( r) => r. suggest_modifier ( arch, ty) ,
444
460
Self :: Bpf ( r) => r. suggest_modifier ( arch, ty) ,
445
461
Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
446
462
}
@@ -464,6 +480,7 @@ impl InlineAsmRegClass {
464
480
Self :: Mips ( r) => r. default_modifier ( arch) ,
465
481
Self :: SpirV ( r) => r. default_modifier ( arch) ,
466
482
Self :: Wasm ( r) => r. default_modifier ( arch) ,
483
+ Self :: Xtensa ( r) => r. default_modifier ( arch) ,
467
484
Self :: Bpf ( r) => r. default_modifier ( arch) ,
468
485
Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
469
486
}
@@ -486,6 +503,7 @@ impl InlineAsmRegClass {
486
503
Self :: Mips ( r) => r. supported_types ( arch) ,
487
504
Self :: SpirV ( r) => r. supported_types ( arch) ,
488
505
Self :: Wasm ( r) => r. supported_types ( arch) ,
506
+ Self :: Xtensa ( r) => r. supported_types ( arch) ,
489
507
Self :: Bpf ( r) => r. supported_types ( arch) ,
490
508
Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
491
509
}
@@ -511,6 +529,7 @@ impl InlineAsmRegClass {
511
529
}
512
530
InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmRegClass :: parse ( arch, name) ?) ,
513
531
InlineAsmArch :: Wasm32 => Self :: Wasm ( WasmInlineAsmRegClass :: parse ( arch, name) ?) ,
532
+ InlineAsmArch :: Xtensa => Self :: Xtensa ( XtensaInlineAsmRegClass :: parse ( arch, name) ?) ,
514
533
InlineAsmArch :: Bpf => Self :: Bpf ( BpfInlineAsmRegClass :: parse ( arch, name) ?) ,
515
534
} )
516
535
}
@@ -529,6 +548,7 @@ impl InlineAsmRegClass {
529
548
Self :: Mips ( r) => r. valid_modifiers ( arch) ,
530
549
Self :: SpirV ( r) => r. valid_modifiers ( arch) ,
531
550
Self :: Wasm ( r) => r. valid_modifiers ( arch) ,
551
+ Self :: Xtensa ( r) => r. valid_modifiers ( arch) ,
532
552
Self :: Bpf ( r) => r. valid_modifiers ( arch) ,
533
553
Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
534
554
}
@@ -573,6 +593,7 @@ impl fmt::Display for InlineAsmRegOrRegClass {
573
593
/// Set of types which can be used with a particular register class.
574
594
#[ derive( Copy , Clone , Debug , Eq , PartialEq ) ]
575
595
pub enum InlineAsmType {
596
+ I1 ,
576
597
I8 ,
577
598
I16 ,
578
599
I32 ,
@@ -596,6 +617,7 @@ impl InlineAsmType {
596
617
597
618
pub fn size ( self ) -> Size {
598
619
Size :: from_bytes ( match self {
620
+ Self :: I1 => return Size :: from_bits ( 1 ) ,
599
621
Self :: I8 => 1 ,
600
622
Self :: I16 => 2 ,
601
623
Self :: I32 => 4 ,
@@ -617,6 +639,7 @@ impl InlineAsmType {
617
639
impl fmt:: Display for InlineAsmType {
618
640
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
619
641
match * self {
642
+ Self :: I1 => f. write_str ( "i1" ) ,
620
643
Self :: I8 => f. write_str ( "i8" ) ,
621
644
Self :: I16 => f. write_str ( "i16" ) ,
622
645
Self :: I32 => f. write_str ( "i32" ) ,
@@ -699,6 +722,11 @@ pub fn allocatable_registers(
699
722
wasm:: fill_reg_map ( arch, has_feature, target, & mut map) ;
700
723
map
701
724
}
725
+ InlineAsmArch :: Xtensa => {
726
+ let mut map = xtensa:: regclass_map ( ) ;
727
+ xtensa:: fill_reg_map ( arch, has_feature, target, & mut map) ;
728
+ map
729
+ }
702
730
InlineAsmArch :: Bpf => {
703
731
let mut map = bpf:: regclass_map ( ) ;
704
732
bpf:: fill_reg_map ( arch, has_feature, target, & mut map) ;
0 commit comments