#![doc(html_root_url = "https://docs.rs/rucc-asm/0.3.5")]
mod att;
mod format;
pub use crate::att::print;
pub use crate::format::Directives;
use std::fmt;
pub const MILESTONE: &str = "M3";
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
Opcode {
func: String,
opcode: String,
},
Virtual {
func: String,
opcode: String,
},
Machine {
triple: String,
},
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Opcode { func, opcode } => {
write!(f, "'{func}' has a '{opcode}' and the target does not say what one is")
}
Error::Virtual { func, opcode } => {
write!(f, "'{func}' reached the assembler with a virtual register in a '{opcode}'")
}
Error::Machine { triple } => {
write!(f, "there is no assembly writer for {triple} in this compiler yet")
}
}
}
}
#[cfg(test)]
mod tests {
#[test]
fn milestone_is_recorded() {
assert!(super::MILESTONE.starts_with('M'));
}
}