more asm cleanup

This commit is contained in:
2025-03-23 15:19:34 -04:00
parent a5a5f64c49
commit c766d34b6a
8 changed files with 52 additions and 59 deletions
+6 -3
View File
@@ -54,7 +54,8 @@ pub enum LinkerInstruction<R = Reg, S = Symbol> {
Call(S),
J(S),
Ret,
Ecall,
ECall,
EBreak,
Li {
dest: R,
imm: i32,
@@ -132,7 +133,8 @@ impl Instr for LinkerInstruction {
}
}
Self::Ret => ret(),
Self::Ecall => ecall(),
Self::ECall => ecall(),
Self::EBreak => ebreak(),
Self::Li { dest, imm } => addi(*dest, zero, BitsI32::new(*imm)),
};
data.extend(last.to_le_bytes());
@@ -170,7 +172,8 @@ impl LinkerInstruction {
impl<R: std::fmt::Debug, S: std::fmt::Debug> std::fmt::Debug for LinkerInstruction<R, S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Ecall => write!(f, "ecall"),
Self::ECall => write!(f, "ecall"),
Self::EBreak => write!(f, "ebreak"),
Self::Li { dest, imm } => write!(f, "li {dest:?}, {imm:?}"),
Self::Mv { dest, src } => write!(f, "mv {dest:?}, {src:?}"),
Self::La { dest, src } => write!(f, "la {dest:?}, {src:?}"),