1
Fork 0

Name explicit registers in conflict register errors for inline assembly

This commit is contained in:
George Wort 2023-11-28 10:25:22 +00:00
parent a6b8ae582a
commit e0bfb615da
6 changed files with 43 additions and 22 deletions

View file

@ -2237,6 +2237,18 @@ pub enum InlineAsmOperand {
},
}
impl InlineAsmOperand {
pub fn reg(&self) -> Option<&InlineAsmRegOrRegClass> {
match self {
Self::In { reg, .. }
| Self::Out { reg, .. }
| Self::InOut { reg, .. }
| Self::SplitInOut { reg, .. } => Some(reg),
Self::Const { .. } | Self::Sym { .. } => None,
}
}
}
/// Inline assembly.
///
/// E.g., `asm!("NOP");`.