Skip to content

Commit

Permalink
feat(xlang-backend-mc): support conditional branching
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Redondo committed Jan 23, 2024
1 parent d1a6cec commit fbd9d02
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xlang/xlang_backend/src/mc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ pub enum MCInsn<Loc> {
/// Wdith of the source value
old_width: u16,
},
/// Conditional Branch
Branch(String, xlang::ir::BranchCondition, MaybeResolved<Loc>),
}

impl<Loc> Default for MCInsn<Loc> {
Expand Down Expand Up @@ -486,7 +488,8 @@ impl<F: MachineFeatures> FunctionRawCodegen for MCFunctionCodegen<F> {
}

fn branch(&mut self, target: u32, condition: xlang::ir::BranchCondition, val: Self::Loc) {
todo!("branch {} @{}: {:?}", condition, target, val)
let targ = format!("{}._T{}", self.fn_name, target);
self.mc_insns.push(MCInsn::Branch(targ, condition, val));
}

fn branch_compare(
Expand Down

0 comments on commit fbd9d02

Please sign in to comment.