@@ -157,6 +157,7 @@ mod riscv;
157157mod spirv;
158158mod wasm;
159159mod x86;
160+ mod xtensa;
160161
161162pub use aarch64:: { AArch64InlineAsmReg , AArch64InlineAsmRegClass } ;
162163pub use arm:: { ArmInlineAsmReg , ArmInlineAsmRegClass } ;
@@ -168,6 +169,7 @@ pub use powerpc::{PowerPCInlineAsmReg, PowerPCInlineAsmRegClass};
168169pub use riscv:: { RiscVInlineAsmReg , RiscVInlineAsmRegClass } ;
169170pub use spirv:: { SpirVInlineAsmReg , SpirVInlineAsmRegClass } ;
170171pub use wasm:: { WasmInlineAsmReg , WasmInlineAsmRegClass } ;
172+ pub use xtensa:: { XtensaInlineAsmReg , XtensaInlineAsmRegClass } ;
171173pub use x86:: { X86InlineAsmReg , X86InlineAsmRegClass } ;
172174
173175#[ derive( Copy , Clone , Encodable , Decodable , Debug , Eq , PartialEq , Hash ) ]
@@ -186,6 +188,7 @@ pub enum InlineAsmArch {
186188 PowerPC64 ,
187189 SpirV ,
188190 Wasm32 ,
191+ Xtensa ,
189192 Bpf ,
190193}
191194
@@ -208,6 +211,7 @@ impl FromStr for InlineAsmArch {
208211 "mips64" => Ok ( Self :: Mips64 ) ,
209212 "spirv" => Ok ( Self :: SpirV ) ,
210213 "wasm32" => Ok ( Self :: Wasm32 ) ,
214+ "xtensa" => Ok ( Self :: Xtensa ) ,
211215 "bpf" => Ok ( Self :: Bpf ) ,
212216 _ => Err ( ( ) ) ,
213217 }
@@ -237,6 +241,7 @@ pub enum InlineAsmReg {
237241 Mips ( MipsInlineAsmReg ) ,
238242 SpirV ( SpirVInlineAsmReg ) ,
239243 Wasm ( WasmInlineAsmReg ) ,
244+ Xtensa ( XtensaInlineAsmReg ) ,
240245 Bpf ( BpfInlineAsmReg ) ,
241246 // Placeholder for invalid register constraints for the current target
242247 Err ,
@@ -252,6 +257,7 @@ impl InlineAsmReg {
252257 Self :: PowerPC ( r) => r. name ( ) ,
253258 Self :: Hexagon ( r) => r. name ( ) ,
254259 Self :: Mips ( r) => r. name ( ) ,
260+ Self :: Xtensa ( r) => r. name ( ) ,
255261 Self :: Bpf ( r) => r. name ( ) ,
256262 Self :: Err => "<reg>" ,
257263 }
@@ -266,6 +272,7 @@ impl InlineAsmReg {
266272 Self :: PowerPC ( r) => InlineAsmRegClass :: PowerPC ( r. reg_class ( ) ) ,
267273 Self :: Hexagon ( r) => InlineAsmRegClass :: Hexagon ( r. reg_class ( ) ) ,
268274 Self :: Mips ( r) => InlineAsmRegClass :: Mips ( r. reg_class ( ) ) ,
275+ Self :: Xtensa ( r) => InlineAsmRegClass :: Xtensa ( r. reg_class ( ) ) ,
269276 Self :: Bpf ( r) => InlineAsmRegClass :: Bpf ( r. reg_class ( ) ) ,
270277 Self :: Err => InlineAsmRegClass :: Err ,
271278 }
@@ -311,6 +318,9 @@ impl InlineAsmReg {
311318 InlineAsmArch :: Wasm32 => {
312319 Self :: Wasm ( WasmInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
313320 }
321+ InlineAsmArch :: Xtensa => {
322+ Self :: Xtensa ( XtensaInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
323+ }
314324 InlineAsmArch :: Bpf => {
315325 Self :: Bpf ( BpfInlineAsmReg :: parse ( arch, has_feature, target, & name) ?)
316326 }
@@ -333,6 +343,7 @@ impl InlineAsmReg {
333343 Self :: PowerPC ( r) => r. emit ( out, arch, modifier) ,
334344 Self :: Hexagon ( r) => r. emit ( out, arch, modifier) ,
335345 Self :: Mips ( r) => r. emit ( out, arch, modifier) ,
346+ Self :: Xtensa ( r) => r. emit ( out, arch, modifier) ,
336347 Self :: Bpf ( r) => r. emit ( out, arch, modifier) ,
337348 Self :: Err => unreachable ! ( "Use of InlineAsmReg::Err" ) ,
338349 }
@@ -347,6 +358,7 @@ impl InlineAsmReg {
347358 Self :: PowerPC ( _) => cb ( self ) ,
348359 Self :: Hexagon ( r) => r. overlapping_regs ( |r| cb ( Self :: Hexagon ( r) ) ) ,
349360 Self :: Mips ( _) => cb ( self ) ,
361+ Self :: Xtensa ( _) => cb ( self ) ,
350362 Self :: Bpf ( r) => r. overlapping_regs ( |r| cb ( Self :: Bpf ( r) ) ) ,
351363 Self :: Err => unreachable ! ( "Use of InlineAsmReg::Err" ) ,
352364 }
@@ -376,6 +388,7 @@ pub enum InlineAsmRegClass {
376388 Mips ( MipsInlineAsmRegClass ) ,
377389 SpirV ( SpirVInlineAsmRegClass ) ,
378390 Wasm ( WasmInlineAsmRegClass ) ,
391+ Xtensa ( XtensaInlineAsmRegClass ) ,
379392 Bpf ( BpfInlineAsmRegClass ) ,
380393 // Placeholder for invalid register constraints for the current target
381394 Err ,
@@ -394,6 +407,7 @@ impl InlineAsmRegClass {
394407 Self :: Mips ( r) => r. name ( ) ,
395408 Self :: SpirV ( r) => r. name ( ) ,
396409 Self :: Wasm ( r) => r. name ( ) ,
410+ Self :: Xtensa ( r) => r. name ( ) ,
397411 Self :: Bpf ( r) => r. name ( ) ,
398412 Self :: Err => rustc_span:: symbol:: sym:: reg,
399413 }
@@ -414,6 +428,7 @@ impl InlineAsmRegClass {
414428 Self :: Mips ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Mips ) ,
415429 Self :: SpirV ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: SpirV ) ,
416430 Self :: Wasm ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Wasm ) ,
431+ Self :: Xtensa ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Xtensa ) ,
417432 Self :: Bpf ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Bpf ) ,
418433 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
419434 }
@@ -441,6 +456,7 @@ impl InlineAsmRegClass {
441456 Self :: Mips ( r) => r. suggest_modifier ( arch, ty) ,
442457 Self :: SpirV ( r) => r. suggest_modifier ( arch, ty) ,
443458 Self :: Wasm ( r) => r. suggest_modifier ( arch, ty) ,
459+ Self :: Xtensa ( r) => r. suggest_modifier ( arch, ty) ,
444460 Self :: Bpf ( r) => r. suggest_modifier ( arch, ty) ,
445461 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
446462 }
@@ -464,6 +480,7 @@ impl InlineAsmRegClass {
464480 Self :: Mips ( r) => r. default_modifier ( arch) ,
465481 Self :: SpirV ( r) => r. default_modifier ( arch) ,
466482 Self :: Wasm ( r) => r. default_modifier ( arch) ,
483+ Self :: Xtensa ( r) => r. default_modifier ( arch) ,
467484 Self :: Bpf ( r) => r. default_modifier ( arch) ,
468485 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
469486 }
@@ -486,6 +503,7 @@ impl InlineAsmRegClass {
486503 Self :: Mips ( r) => r. supported_types ( arch) ,
487504 Self :: SpirV ( r) => r. supported_types ( arch) ,
488505 Self :: Wasm ( r) => r. supported_types ( arch) ,
506+ Self :: Xtensa ( r) => r. supported_types ( arch) ,
489507 Self :: Bpf ( r) => r. supported_types ( arch) ,
490508 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
491509 }
@@ -511,6 +529,7 @@ impl InlineAsmRegClass {
511529 }
512530 InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmRegClass :: parse ( arch, name) ?) ,
513531 InlineAsmArch :: Wasm32 => Self :: Wasm ( WasmInlineAsmRegClass :: parse ( arch, name) ?) ,
532+ InlineAsmArch :: Xtensa => Self :: Xtensa ( XtensaInlineAsmRegClass :: parse ( arch, name) ?) ,
514533 InlineAsmArch :: Bpf => Self :: Bpf ( BpfInlineAsmRegClass :: parse ( arch, name) ?) ,
515534 } )
516535 }
@@ -529,6 +548,7 @@ impl InlineAsmRegClass {
529548 Self :: Mips ( r) => r. valid_modifiers ( arch) ,
530549 Self :: SpirV ( r) => r. valid_modifiers ( arch) ,
531550 Self :: Wasm ( r) => r. valid_modifiers ( arch) ,
551+ Self :: Xtensa ( r) => r. valid_modifiers ( arch) ,
532552 Self :: Bpf ( r) => r. valid_modifiers ( arch) ,
533553 Self :: Err => unreachable ! ( "Use of InlineAsmRegClass::Err" ) ,
534554 }
@@ -573,6 +593,7 @@ impl fmt::Display for InlineAsmRegOrRegClass {
573593/// Set of types which can be used with a particular register class.
574594#[ derive( Copy , Clone , Debug , Eq , PartialEq ) ]
575595pub enum InlineAsmType {
596+ I1 ,
576597 I8 ,
577598 I16 ,
578599 I32 ,
@@ -596,6 +617,7 @@ impl InlineAsmType {
596617
597618 pub fn size ( self ) -> Size {
598619 Size :: from_bytes ( match self {
620+ Self :: I1 => return Size :: from_bits ( 1 ) ,
599621 Self :: I8 => 1 ,
600622 Self :: I16 => 2 ,
601623 Self :: I32 => 4 ,
@@ -617,6 +639,7 @@ impl InlineAsmType {
617639impl fmt:: Display for InlineAsmType {
618640 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
619641 match * self {
642+ Self :: I1 => f. write_str ( "i1" ) ,
620643 Self :: I8 => f. write_str ( "i8" ) ,
621644 Self :: I16 => f. write_str ( "i16" ) ,
622645 Self :: I32 => f. write_str ( "i32" ) ,
@@ -699,6 +722,11 @@ pub fn allocatable_registers(
699722 wasm:: fill_reg_map ( arch, has_feature, target, & mut map) ;
700723 map
701724 }
725+ InlineAsmArch :: Xtensa => {
726+ let mut map = xtensa:: regclass_map ( ) ;
727+ xtensa:: fill_reg_map ( arch, has_feature, target, & mut map) ;
728+ map
729+ }
702730 InlineAsmArch :: Bpf => {
703731 let mut map = bpf:: regclass_map ( ) ;
704732 bpf:: fill_reg_map ( arch, has_feature, target, & mut map) ;
0 commit comments