fix(compiler): asm 约束映射补全 8 位寄存器 clobber(AL/AH/BL/BH/CL/CH/DL/DH)

This commit is contained in:
TermiNexus committed 2026-08-30 08:12:44 +08:00
1 parent a0d6dced00
commit d14415a4e6
1 file changed
+11
+11
View File
@@ -844,6 +844,17 @@ class CallGenCBuiltin(CallGenBase.CallGenBase):
if string.strcmp(attr_name, "CLOBBER_CX") == 0: return "cx"
if string.strcmp(attr_name, "CLOBBER_SI") == 0: return "si"
if string.strcmp(attr_name, "CLOBBER_DI") == 0: return "di"
# 8 位寄存器破坏描述符(对齐 t.py 标准常量集;缺 AL 曾致 AllocPage
# `rep stosb` 的 ~{al} 丢失——LLVM 不知 AL 被改,页地址 $0 可能被分配
# 进 RAX 被 mov al,0 破坏,A7 根因)
if string.strcmp(attr_name, "CLOBBER_AL") == 0: return "al"
if string.strcmp(attr_name, "CLOBBER_AH") == 0: return "ah"
if string.strcmp(attr_name, "CLOBBER_BL") == 0: return "bl"
if string.strcmp(attr_name, "CLOBBER_BH") == 0: return "bh"
if string.strcmp(attr_name, "CLOBBER_CL") == 0: return "cl"
if string.strcmp(attr_name, "CLOBBER_CH") == 0: return "ch"
if string.strcmp(attr_name, "CLOBBER_DL") == 0: return "dl"
if string.strcmp(attr_name, "CLOBBER_DH") == 0: return "dh"
# Output 输出约束
if string.strcmp(attr_name, "OUTPUT_REG") == 0: return "=r"