aboutsummaryrefslogtreecommitdiff
path: root/opcodes/i386-opc.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-03-09 09:58:46 -0800
committerH.J. Lu <hjl.tools@gmail.com>2017-03-09 09:59:00 -0800
commit86fa6981e7487e2c2df4337aa75ed2d93c32eaf2 (patch)
tree3a2c124ce66bd4de896bcd0fca29dcb3f4f8f094 /opcodes/i386-opc.h
parentf03265d9cda1f5f8df238efa9b7a20330e5711f1 (diff)
downloadgdb-86fa6981e7487e2c2df4337aa75ed2d93c32eaf2.zip
gdb-86fa6981e7487e2c2df4337aa75ed2d93c32eaf2.tar.gz
gdb-86fa6981e7487e2c2df4337aa75ed2d93c32eaf2.tar.bz2
X86: Add pseudo prefixes to control encoding
Many x86 instructions have more than one encodings. Assembler picks the default one, usually the shortest one. Although the ".s", ".d8" and ".d32" suffixes can be used to swap register operands or specify displacement size, they aren't very flexible. This patch adds pseudo prefixes, {xxx}, to control instruction encoding. The available pseudo prefixes are {disp8}, {disp32}, {load}, {store}, {vex2}, {vex3} and {evex}. Pseudo prefixes are preferred over the ".s", ".d8" and ".d32" suffixes, which are deprecated. gas/ * config/tc-i386.c (_i386_insn): Add dir_encoding and vec_encoding. Remove swap_operand and need_vrex. (extra_symbol_chars): Add '}'. (md_begin): Mark '}' with LEX_BEGIN_NAME. Allow '}' in mnemonic. (build_vex_prefix): Don't use 2-byte VEX encoding with {vex3}. Check dir_encoding and load. (parse_insn): Check pseudo prefixes. Set dir_encoding. (VEX_check_operands): Likewise. (match_template): Check dir_encoding and load. (parse_real_register): Set vec_encoding instead of need_vrex. (parse_register): Likewise. * doc/c-i386.texi: Document {disp8}, {disp32}, {load}, {store}, {vex2}, {vex3} and {evex}. Remove ".s", ".d8" and ".d32" * testsuite/gas/i386/i386.exp: Run pseudos and x86-64-pseudos. * testsuite/gas/i386/pseudos.d: New file. * testsuite/gas/i386/pseudos.s: Likewise. * testsuite/gas/i386/x86-64-pseudos.d: Likewise. * testsuite/gas/i386/x86-64-pseudos.s: Likewise. opcodes/ * i386-gen.c (opcode_modifiers): Replace S with Load. * i386-opc.h (S): Removed. (Load): New. (i386_opcode_modifier): Replace s with load. * i386-opc.tbl: Add {disp8}, {disp32}, {swap}, {vex2}, {vex3} and {evex}. Replace S with Load. * i386-tbl.h: Regenerated.
Diffstat (limited to 'opcodes/i386-opc.h')
-rw-r--r--opcodes/i386-opc.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h
index 9e4355c..d1a6a45 100644
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -356,9 +356,8 @@ enum
D = 0,
/* set if operands can be words or dwords encoded the canonical way */
W,
- /* Skip the current insn and use the next insn in i386-opc.tbl to swap
- operand in encoding. */
- S,
+ /* load form instruction. Must be placed before store form. */
+ Load,
/* insn has a modrm byte. */
Modrm,
/* register is in low 3 bits of opcode */
@@ -598,7 +597,7 @@ typedef struct i386_opcode_modifier
{
unsigned int d:1;
unsigned int w:1;
- unsigned int s:1;
+ unsigned int load:1;
unsigned int modrm:1;
unsigned int shortform:1;
unsigned int jump:1;