@@ -20,16 +20,16 @@ macro_rules! def_reg_class {
2020 }
2121
2222 impl $arch_regclass {
23- pub fn name( self ) -> & ' static str {
23+ pub fn name( self ) -> rustc_span :: Symbol {
2424 match self {
25- $( Self :: $class => stringify! ( $class) , ) *
25+ $( Self :: $class => rustc_span :: symbol :: sym :: $class, ) *
2626 }
2727 }
2828
29- pub fn parse( _arch: super :: InlineAsmArch , name: & str ) -> Result <Self , & ' static str > {
29+ pub fn parse( _arch: super :: InlineAsmArch , name: rustc_span :: Symbol ) -> Result <Self , & ' static str > {
3030 match name {
3131 $(
32- stringify! ( $class) => Ok ( Self :: $class) ,
32+ rustc_span :: sym :: $class => Ok ( Self :: $class) ,
3333 ) *
3434 _ => Err ( "unknown register class" ) ,
3535 }
@@ -327,7 +327,7 @@ pub enum InlineAsmRegClass {
327327}
328328
329329impl InlineAsmRegClass {
330- pub fn name ( self ) -> & ' static str {
330+ pub fn name ( self ) -> Symbol {
331331 match self {
332332 Self :: X86 ( r) => r. name ( ) ,
333333 Self :: Arm ( r) => r. name ( ) ,
@@ -422,29 +422,22 @@ impl InlineAsmRegClass {
422422 }
423423
424424 pub fn parse ( arch : InlineAsmArch , name : Symbol ) -> Result < Self , & ' static str > {
425- // FIXME: use direct symbol comparison for register class names
426- name. with ( |name| {
427- Ok ( match arch {
428- InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
429- Self :: X86 ( X86InlineAsmRegClass :: parse ( arch, name) ?)
430- }
431- InlineAsmArch :: Arm => Self :: Arm ( ArmInlineAsmRegClass :: parse ( arch, name) ?) ,
432- InlineAsmArch :: AArch64 => {
433- Self :: AArch64 ( AArch64InlineAsmRegClass :: parse ( arch, name) ?)
434- }
435- InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
436- Self :: RiscV ( RiscVInlineAsmRegClass :: parse ( arch, name) ?)
437- }
438- InlineAsmArch :: Nvptx64 => Self :: Nvptx ( NvptxInlineAsmRegClass :: parse ( arch, name) ?) ,
439- InlineAsmArch :: Hexagon => {
440- Self :: Hexagon ( HexagonInlineAsmRegClass :: parse ( arch, name) ?)
441- }
442- InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
443- Self :: Mips ( MipsInlineAsmRegClass :: parse ( arch, name) ?)
444- }
445- InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmRegClass :: parse ( arch, name) ?) ,
446- InlineAsmArch :: Wasm32 => Self :: Wasm ( WasmInlineAsmRegClass :: parse ( arch, name) ?) ,
447- } )
425+ Ok ( match arch {
426+ InlineAsmArch :: X86 | InlineAsmArch :: X86_64 => {
427+ Self :: X86 ( X86InlineAsmRegClass :: parse ( arch, name) ?)
428+ }
429+ InlineAsmArch :: Arm => Self :: Arm ( ArmInlineAsmRegClass :: parse ( arch, name) ?) ,
430+ InlineAsmArch :: AArch64 => Self :: AArch64 ( AArch64InlineAsmRegClass :: parse ( arch, name) ?) ,
431+ InlineAsmArch :: RiscV32 | InlineAsmArch :: RiscV64 => {
432+ Self :: RiscV ( RiscVInlineAsmRegClass :: parse ( arch, name) ?)
433+ }
434+ InlineAsmArch :: Nvptx64 => Self :: Nvptx ( NvptxInlineAsmRegClass :: parse ( arch, name) ?) ,
435+ InlineAsmArch :: Hexagon => Self :: Hexagon ( HexagonInlineAsmRegClass :: parse ( arch, name) ?) ,
436+ InlineAsmArch :: Mips | InlineAsmArch :: Mips64 => {
437+ Self :: Mips ( MipsInlineAsmRegClass :: parse ( arch, name) ?)
438+ }
439+ InlineAsmArch :: SpirV => Self :: SpirV ( SpirVInlineAsmRegClass :: parse ( arch, name) ?) ,
440+ InlineAsmArch :: Wasm32 => Self :: Wasm ( WasmInlineAsmRegClass :: parse ( arch, name) ?) ,
448441 } )
449442 }
450443
@@ -484,7 +477,7 @@ impl fmt::Display for InlineAsmRegOrRegClass {
484477 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
485478 match self {
486479 Self :: Reg ( r) => write ! ( f, "\" {}\" " , r. name( ) ) ,
487- Self :: RegClass ( r) => f . write_str ( r. name ( ) ) ,
480+ Self :: RegClass ( r) => write ! ( f , "{}" , r. name( ) ) ,
488481 }
489482 }
490483}
0 commit comments