scanner: generalize the handling of {dfv=}

Change the handling of {dfv=} to a more general "braced constant"
expression, to be tagged with an instruction flag to make sure they
match the instruction in question.

This really ought to be an operand flag, but the opflags are precious;
as the CCMP/CTEST instructions can also take an immediate it probably
is necessary to invent a "special immediate" operand type that can
fold these together.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2024-07-27 18:06:51 -07:00
parent 4f0d89dbe6
commit 6389ac8e47
3 changed files with 9 additions and 4 deletions

View file

@ -170,10 +170,10 @@ rz-sae
sae
z
% TOKEN_DFV, 0, TFLAG_BRC, 0
% TOKEN_BRCCONST, IF_DFV, TFLAG_BRC, 0
dfv=
% TOKEN_DFV, 0, TFLAG_BRC | TFLAG_ORBIT, DFV_{dfv=*}
% TOKEN_BRCCONST, IF_DFV, TFLAG_BRC | TFLAG_ORBIT, DFV_{dfv=*}
dfv=cf
dfv=zf
dfv=sf

View file

@ -240,7 +240,7 @@ enum token_type { /* token types, other than chars */
TOKEN_SIZE, /* BYTE, WORD, DWORD, QWORD, etc */
TOKEN_SPECIAL, /* REL, FAR, NEAR, STRICT, NOSPLIT, etc */
TOKEN_PREFIX, /* A32, O16, LOCK, REPNZ, TIMES, etc */
TOKEN_DFV, /* {dfv=} */
TOKEN_BRCCONST, /* braced constant expression */
TOKEN_REG, /* register name */
TOKEN_INSN, /* instruction name */

View file

@ -23,7 +23,12 @@ if_("AR2", "SB, SW, SD applies to argument 2");
if_("AR3", "SB, SW, SD applies to argument 3");
if_("AR4", "SB, SW, SD applies to argument 4");
if_("OPT", "Optimizing assembly only");
if_("LATEVEX", "Only if EVEX instructions are disabled");
if_("LATEVEX", "Only if EVEX instructions are disabled");
#
# special immediates like {dfv=}
#
if_("DFV", "Destination flag values");
#
# dword bound - instruction feature filtering flags