fix(ir): Binary syntax and func var declare

This commit is contained in:
2026-05-09 20:21:50 +08:00
parent 04284000d6
commit b8d678a634
2 changed files with 17 additions and 6 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ impl Display for IRInstr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
IRInstr::Entry => write!(f, "entry"),
IRInstr::Binary(dest, left, op, right) => write!(f, "{} = {} {} {}", dest, op, left, right),
IRInstr::Binary(dest, left, op, right) => write!(f, "{} = {} {},{}", dest, op, left, right),
IRInstr::Exit(v) => if let Some(v) = v { write!(f, "exit {}", v) } else { write!(f, "exit") },
IRInstr::FuncCall(func, args, dest) => {
if let Some(dest) = dest {
@@ -89,7 +89,7 @@ pub struct Variable {
impl Display for Variable {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let prefix = match self.var_type {
VariableType::Global => "@",
VariableType::Global => "@g",
VariableType::Local => "%l",
VariableType::Temp => "%t",
VariableType::ParamTemp => "%t",