This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/6] x86: drop "mem" operand type attribute
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: <binutils at sourceware dot org>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Thu, 02 Aug 2018 00:48:16 -0600
- Subject: [PATCH 1/6] x86: drop "mem" operand type attribute
- References: <5B62A83102000078001DA1F0@prv1-mh.provo.novell.com>
No template specifies this bit, so there's no point recording it in the
templates. Use a flags[] bit instead.
gas/
2018-08-02 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (Operand_Mem): Define.
(operand_size_match): Use it.
(check_VecOperands): Likewise.
(i386_att_operand): Likewise.
(swap_2_operands): Also swap flags fields.
* config/tc-i386-intel.c (i386_intel_operand): Likewise.
opcodes/
2018-08-02 Jan Beulich <jbeulich@suse.com>
* i386-gen.c (operand_types): Remove Mem field.
* i386-opc.h (union i386_operand_type): Remove mem field.
* i386-init.h, i386-tbl.h: Re-generate.
--- a/gas/config/tc-i386-intel.c
+++ b/gas/config/tc-i386-intel.c
@@ -875,7 +875,7 @@ i386_intel_operand (char *operand_string
i.mem_operands = 0;
i.disp_operands = 0;
i.imm_operands = 2;
- i.types[0].bitfield.mem = 0;
+ i.flags[0] &= ~Operand_Mem;
i.types[0].bitfield.disp16 = 0;
i.types[0].bitfield.disp32 = 0;
i.types[0].bitfield.disp32s = 0;
@@ -1009,7 +1009,7 @@ i386_intel_operand (char *operand_string
if (!i386_index_check (operand_string))
return 0;
- i.types[this_operand].bitfield.mem = 1;
+ i.flags[this_operand] |= Operand_Mem;
if (i.mem_operands == 0)
i.memop1_string = xstrdup (operand_string);
++i.mem_operands;
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -309,6 +309,7 @@ struct _i386_insn
/* Flags for operands. */
unsigned int flags[MAX_OPERANDS];
#define Operand_PCrel 1
+#define Operand_Mem 2
/* Relocation type for operand */
enum bfd_reloc_code_real reloc[MAX_OPERANDS];
@@ -2010,7 +2011,7 @@ operand_size_match (const insn_template
break;
}
- if (i.types[j].bitfield.mem && !match_mem_size (t, j, j))
+ if ((i.flags[j] & Operand_Mem) && !match_mem_size (t, j, j))
{
match = 0;
break;
@@ -2035,8 +2036,7 @@ mismatch:
&& !match_operand_size (t, j, !j))
goto mismatch;
- if (i.types[!j].bitfield.mem
- && !match_mem_size (t, j, !j))
+ if ((i.flags[!j] & Operand_Mem) && !match_mem_size (t, j, !j))
goto mismatch;
}
@@ -4753,14 +4753,21 @@ swap_2_operands (int xchg1, int xchg2)
{
union i386_op temp_op;
i386_operand_type temp_type;
+ unsigned int temp_flags;
enum bfd_reloc_code_real temp_reloc;
temp_type = i.types[xchg2];
i.types[xchg2] = i.types[xchg1];
i.types[xchg1] = temp_type;
+
+ temp_flags = i.flags[xchg2];
+ i.flags[xchg2] = i.flags[xchg1];
+ i.flags[xchg1] = temp_flags;
+
temp_op = i.op[xchg2];
i.op[xchg2] = i.op[xchg1];
i.op[xchg1] = temp_op;
+
temp_reloc = i.reloc[xchg2];
i.reloc[xchg2] = i.reloc[xchg1];
i.reloc[xchg1] = temp_reloc;
@@ -5180,7 +5187,7 @@ check_VecOperands (const insn_template *
and its broadcast bytes match the memory operand. */
op = i.broadcast->operand;
if (!t->opcode_modifier.broadcast
- || !i.types[op].bitfield.mem
+ || !(i.flags[op] & Operand_Mem)
|| (!i.types[op].bitfield.unspecified
&& !match_broadcast_size (t, op)))
{
@@ -5276,7 +5283,7 @@ check_VecOperands (const insn_template *
{
/* Find memory operand. */
for (op = 0; op < i.operands; op++)
- if (i.types[op].bitfield.mem)
+ if (i.flags[op] & Operand_Mem)
break;
gas_assert (op < i.operands);
if (op == i.operands - 1)
@@ -9814,7 +9821,7 @@ i386_att_operand (char *operand_string)
if (i386_index_check (operand_string) == 0)
return 0;
- i.types[this_operand].bitfield.mem = 1;
+ i.flags[this_operand] |= Operand_Mem;
if (i.mem_operands == 0)
i.memop1_string = xstrdup (operand_string);
i.mem_operands++;
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -685,7 +685,6 @@ static bitfield operand_types[] =
BITFIELD (JumpAbsolute),
BITFIELD (EsSeg),
BITFIELD (RegMem),
- BITFIELD (Mem),
BITFIELD (Byte),
BITFIELD (Word),
BITFIELD (Dword),
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -819,7 +819,6 @@ typedef union i386_operand_type
unsigned int jumpabsolute:1;
unsigned int esseg:1;
unsigned int regmem:1;
- unsigned int mem:1;
unsigned int byte:1;
unsigned int word:1;
unsigned int dword:1;