feat(asm): op=/clobber= 支持裸枚举名(CLOBBER_MEMORY) - 等价 ASM_DESCR.XXX
This commit is contained in:
1 parent
e796314a24
commit
d8648176e9
1 file changed
+10
@@ -670,6 +670,16 @@ novirtual class CallGenCBuiltin(CallGenBase.CallGenBase):
|
||||
if mod_nm2.id is not None and string.strcmp(mod_nm2.id, "ASM_DESCR") == 0: return self._resolve_register(at.attr)
|
||||
return ""
|
||||
|
||||
# 裸枚举名(不带 ASM_DESCR. / t. 前缀):`op=[CLOBBER_MEMORY, CLOBBER_RAX]`。
|
||||
# 只有确实解析成 ASM_DESCR 成员时才接受(_resolve_register 对未知名给不出非空串),
|
||||
# 否则返回空串交由调用方按"未知约束"处理,避免把普通变量名误当约束串。
|
||||
if k == ast.ASTKind.Name:
|
||||
nm_b: ast.Name* = ast.Name*(node)
|
||||
if nm_b.id is not None:
|
||||
rs_b: str = self._resolve_register(nm_b.id)
|
||||
if rs_b is not None and rs_b[0] != '\0': return rs_b
|
||||
return ""
|
||||
|
||||
# Constant: string constant
|
||||
if k == ast.ASTKind.Constant:
|
||||
cn: ast.Constant* = ast.Constant*(node)
|
||||
|
||||
Reference in new issue
Block a user