Add read-before-write for flags, and fix bugs caused by typos

This commit is contained in:
gingerBill
2026-08-25 10:26:27 +01:00
parent c200bfc189
commit 173443cdd1
2 changed files with 21 additions and 7 deletions

View File

@@ -1630,8 +1630,9 @@ gb_internal bool check_mnemonic(AsmCtx *asm_ctx, CheckerContext *ctx, Entity *tm
explicit_writes |= synth;
}
facts->gen_regs = produced | pinned_param_writes;
facts->gen_flags = cast(u16)clobber.flags_wr;
facts->gen_regs = produced | pinned_param_writes;
facts->gen_flags = cast(u16)clobber.flags_wr;
facts->read_flags = cast(u16)clobber.flags_rd;
// NOTE(bill): mnemonics such as `xor r, r` / `sub r, r` act as zeroing the destination
// independent of its prior value: the read is architecturally dead, so it must not count as a use.