feat(ir, parser): Support if/while/break/logical expr/cmp in parser and ir generator
This commit is contained in:
@@ -98,6 +98,7 @@ impl Generator {
|
||||
self.instrs.push(SubInstr::new_sp(stack_size_needed as i32));
|
||||
},
|
||||
IRInstr::DefineFunc(_, _, _) => unreachable!(),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,12 +190,6 @@ impl Generator {
|
||||
self.instrs.push(MulInstr::new(temp_reg, temp_reg, RegisterOrImm::Reg(right_reg)));
|
||||
self.instrs.push(SubInstr::new(dest_reg, left_reg, RegisterOrImm::Reg(temp_reg)));
|
||||
},
|
||||
IRBinaryOp::Le => todo!(),
|
||||
IRBinaryOp::Lt => todo!(),
|
||||
IRBinaryOp::Gt => todo!(),
|
||||
IRBinaryOp::Ge => todo!(),
|
||||
IRBinaryOp::Ne => todo!(),
|
||||
IRBinaryOp::Eq => todo!(),
|
||||
}
|
||||
let dest_stack_offset = var_index_to_stack_offset.get(&dest.index).expect("Variable not declared");
|
||||
self.instrs.push(StoreInstr::new_stack(dest_reg, *dest_stack_offset as i32));
|
||||
|
||||
Reference in New Issue
Block a user