fix: 自增减发射面 a 槽别名写改可见活寄存器序列,防冲毁活值

This commit is contained in:
2026-09-26 21:17:47 +00:00
parent 3bb6b1e353
commit 631d430772
3 changed files with 113 additions and 17 deletions
+2 -7
View File
@@ -278,13 +278,8 @@ impl Emitter {
Operand::Reg(idx_reg),
Operand::Reg(val_reg),
));
let tmp_reg = ctx.alloc_reg();
ctx.inst(Inst::new(
OpCode::INC_PRE,
Operand::Reg(idx_reg),
Operand::Reg(tmp_reg),
Operand::Reg(tmp_reg),
));
// a 槽别名 rd:增减指令双写合并为一次,idx_reg 新值供下一轮 SET_ELEM 使用。
ctx.inst(Inst::new(OpCode::INC_PRE, Operand::Reg(idx_reg), Operand::Reg(idx_reg), Operand::None));
ctx.inst(Inst::jmp(loop_start));
ctx.labels.set_label_pos(loop_end, ctx.insts.len());
Ok(rest_reg)