2007-09-25  H.J. Lu  <hongjiu.lu@intel.com>

	* config/tc-i386.c (output_insn): Use i.tm.opcode_length to
	check opcode length.

opcodes/

2007-09-25  H.J. Lu  <hongjiu.lu@intel.com>

	* i386-gen.c (process_i386_opcodes): Process opcode_length.

	* i386-opc.h (template): Add opcode_length.
	* 386-opc.tbl: Likewise.
	* i386-tbl.h: Regenerated.
This commit is contained in:
H.J. Lu 2007-09-26 04:42:47 +00:00
parent c828a49faf
commit 4dffcebc10
7 changed files with 2921 additions and 2894 deletions

View File

@ -1,3 +1,8 @@
2007-09-25 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (output_insn): Use i.tm.opcode_length to
check opcode length.
2007-09-25 Nathan Sidwell <nathan@codesourcery.com>
* config/tc-m68k.c (LONG_BRANCH_VIA_COND): New.

View File

@ -4976,38 +4976,35 @@ output_insn (void)
char *p;
unsigned char *q;
unsigned int prefix;
int opc_3b;
/* All opcodes on i386 have either 1 or 2 bytes. SSSE3 and
SSE4 and SSE5 instructions have 3 bytes. We may use one
more higher byte to specify a prefix the instruction
requires. Exclude instructions which are in both SSE4.2
and ABM. */
opc_3b = (i.tm.cpu_flags.bitfield.cpussse3
|| i.tm.cpu_flags.bitfield.cpusse5
|| i.tm.cpu_flags.bitfield.cpusse4_1
|| (i.tm.cpu_flags.bitfield.cpusse4_2
&& !i.tm.cpu_flags.bitfield.cpuabm));
if (opc_3b)
switch (i.tm.opcode_length)
{
case 3:
if (i.tm.base_opcode & 0xff000000)
{
prefix = (i.tm.base_opcode >> 24) & 0xff;
goto check_prefix;
}
}
else if ((i.tm.base_opcode & 0xff0000) != 0)
{
prefix = (i.tm.base_opcode >> 16) & 0xff;
if (i.tm.cpu_flags.bitfield.cpupadlock)
break;
case 2:
if ((i.tm.base_opcode & 0xff0000) != 0)
{
check_prefix:
if (prefix != REPE_PREFIX_OPCODE
|| i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE)
prefix = (i.tm.base_opcode >> 16) & 0xff;
if (i.tm.cpu_flags.bitfield.cpupadlock)
{
check_prefix:
if (prefix != REPE_PREFIX_OPCODE
|| i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE)
add_prefix (prefix);
}
else
add_prefix (prefix);
}
else
add_prefix (prefix);
break;
case 1:
break;
default:
abort ();
}
/* The prefix bytes. */
@ -5023,19 +5020,25 @@ output_insn (void)
}
/* Now the opcode; be careful about word order here! */
if (fits_in_unsigned_byte (i.tm.base_opcode))
if (i.tm.opcode_length == 1)
{
FRAG_APPEND_1_CHAR (i.tm.base_opcode);
}
else
{
if (opc_3b)
switch (i.tm.opcode_length)
{
case 3:
p = frag_more (3);
*p++ = (i.tm.base_opcode >> 16) & 0xff;
break;
case 2:
p = frag_more (2);
break;
default:
abort ();
break;
}
else
p = frag_more (2);
/* Put out high byte first: can't use md_number_to_chars! */
*p++ = (i.tm.base_opcode >> 8) & 0xff;

View File

@ -1,3 +1,11 @@
2007-09-25 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (process_i386_opcodes): Process opcode_length.
* i386-opc.h (template): Add opcode_length.
* 386-opc.tbl: Likewise.
* i386-tbl.h: Regenerated.
2007-09-21 H.J. Lu <hongjiu.lu@intel.com>
* i386-opc.h: Adjust whitespaces.

View File

@ -591,6 +591,7 @@ process_i386_opcodes (FILE *table)
unsigned int i;
char *str, *p, *last;
char *name, *operands, *base_opcode, *extension_opcode;
char *opcode_length;
char *cpu_flags, *opcode_modifier, *operand_types [MAX_OPERANDS];
if (fp == NULL)
@ -649,6 +650,12 @@ process_i386_opcodes (FILE *table)
/* Find extension_opcode. */
extension_opcode = next_field (str, ',', &str);
if (str >= last)
abort ();
/* Find opcode_length. */
opcode_length = next_field (str, ',', &str);
if (str >= last)
abort ();
@ -707,8 +714,9 @@ process_i386_opcodes (FILE *table)
}
}
fprintf (table, " { \"%s\", %s, %s, %s,\n",
name, operands, base_opcode, extension_opcode);
fprintf (table, " { \"%s\", %s, %s, %s, %s,\n",
name, operands, base_opcode, extension_opcode,
opcode_length);
process_i386_cpu_flag (table, cpu_flags, 0, ",", " ");
@ -737,7 +745,7 @@ process_i386_opcodes (FILE *table)
fclose (fp);
fprintf (table, " { NULL, 0, 0, 0,\n");
fprintf (table, " { NULL, 0, 0, 0, 0,\n");
process_i386_cpu_flag (table, "0", 0, ",", " ");

View File

@ -416,6 +416,9 @@ typedef struct template
unsigned int extension_opcode;
#define None 0xffff /* If no extension_opcode is possible. */
/* Opcode length. */
unsigned char opcode_length;
/* cpu feature flags */
i386_cpu_flags cpu_flags;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff