From e720d4802fbd210bdc9822ec1170d06d602fc8c5 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sun, 9 Aug 2026 04:31:37 +0900 Subject: [PATCH] w6a: delete dead text state and redundant rex arm --- cmd/w6a/asm.c | 5 +---- selfhost/cmd/w6a/asm.ww | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cmd/w6a/asm.c b/cmd/w6a/asm.c index 0a898c2e..02270860 100644 --- a/cmd/w6a/asm.c +++ b/cmd/w6a/asm.c @@ -144,7 +144,7 @@ emit_rex(Asm *a, int regbit, int rmbit, int w) if (w) b |= 0x08; if (regbit) b |= 0x04; if (rmbit) b |= 0x01; - if (b != 0x40 || w) a_emit_byte(a, b); + if (b != 0x40) a_emit_byte(a, b); } /* 8-bit register operands: SPL/BPL/SIL/DIL exist only WITH a REX @@ -304,8 +304,6 @@ int a_encode(Asm *a) { fixups = NULL; - const char *cur_text = NULL; - (void)cur_text; for (Aprog *p = a->head; p; p = p->link) { if (p->label) { Asym *s = a_intern(a, p->label); @@ -322,7 +320,6 @@ a_encode(Asm *a) s->is_text = 1; s->is_global = 1; s->addr = a->textlen; - cur_text = p->to.sym; break; } case A_DATA: { diff --git a/selfhost/cmd/w6a/asm.ww b/selfhost/cmd/w6a/asm.ww index 3172ceb9..a0c990d7 100644 --- a/selfhost/cmd/w6a/asm.ww +++ b/selfhost/cmd/w6a/asm.ww @@ -101,8 +101,7 @@ fn emitrex(a: *asm_, regbit: i32, rmbit: i32, w: i32) void = { if (w != 0) { b = b | 8u8; }; if (regbit != 0) { b = b | 4u8; }; if (rmbit != 0) { b = b | 1u8; }; - if (b != 64u8) { emitbyte(a, b); } - else { if (w != 0) { emitbyte(a, b); }; }; + if (b != 64u8) { emitbyte(a, b); }; }; // 8-bit register operands: SPL/BPL/SIL/DIL exist only WITH a REX