1
Fork 0

show supported register classes

in inline assembly, show the supported register classes when an invalid one is found
This commit is contained in:
Folkert de Vries 2025-01-29 11:57:37 +01:00
parent cf577f34c4
commit fbd30ea35f
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
7 changed files with 23 additions and 8 deletions

View file

@ -39,12 +39,12 @@ macro_rules! def_reg_class {
}
}
pub fn parse(name: rustc_span::Symbol) -> Result<Self, &'static str> {
pub fn parse(name: rustc_span::Symbol) -> Result<Self, &'static [rustc_span::Symbol]> {
match name {
$(
rustc_span::sym::$class => Ok(Self::$class),
)*
_ => Err("unknown register class"),
_ => Err(&[$(rustc_span::sym::$class),*]),
}
}
}
@ -635,7 +635,7 @@ impl InlineAsmRegClass {
}
}
pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result<Self, &'static str> {
pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result<Self, &'static [rustc_span::Symbol]> {
Ok(match arch {
InlineAsmArch::X86 | InlineAsmArch::X86_64 => {
Self::X86(X86InlineAsmRegClass::parse(name)?)