x86: have preprocessor expand macros

Message ID c51eafdc-0067-ef29-622f-d9501670c789@suse.com
State New
Headers show
Series
  • x86: have preprocessor expand macros
Related show

Commit Message

H.J. Lu via Binutils Feb. 15, 2021, 2:27 p.m.
There's no point having i386-gen's set_bitfield() to handle any aliases,
now that we pass the opcode table through the C preprocessor anyway.

opcodes/
2021-02-XX  Jan Beulich  <jbeulich@suse.com>

	* i386-gen.c (set_bitfield): Don't look for CpuFP, Mmword, nor
	Oword.
	* i386-opc.tbl (CpuFP, Mmword, Oword): Define.

Comments

H.J. Lu via Binutils Feb. 15, 2021, 2:47 p.m. | #1
On Mon, Feb 15, 2021 at 6:27 AM Jan Beulich <jbeulich@suse.com> wrote:
>

> There's no point having i386-gen's set_bitfield() to handle any aliases,

> now that we pass the opcode table through the C preprocessor anyway.

>

> opcodes/

> 2021-02-XX  Jan Beulich  <jbeulich@suse.com>

>

>         * i386-gen.c (set_bitfield): Don't look for CpuFP, Mmword, nor

>         Oword.

>         * i386-opc.tbl (CpuFP, Mmword, Oword): Define.

>

> --- a/opcodes/i386-gen.c

> +++ b/opcodes/i386-gen.c

> @@ -971,17 +971,6 @@ set_bitfield (char *f, bitfield *array,

>    if (*f == '\0')

>      return;

>

> -  if (strcmp (f, "CpuFP") == 0)

> -    {

> -      set_bitfield("Cpu387", array, value, size, lineno);

> -      set_bitfield("Cpu287", array, value, size, lineno);

> -      f = "Cpu8087";

> -    }

> -  else if (strcmp (f, "Mmword") == 0)

> -    f= "Qword";

> -  else if (strcmp (f, "Oword") == 0)

> -    f= "Xmmword";

> -

>    for (i = 0; i < size; i++)

>      if (strcasecmp (array[i].name, f) == 0)

>        {

> --- a/opcodes/i386-opc.tbl

> +++ b/opcodes/i386-opc.tbl

> @@ -58,6 +58,9 @@

>

>  #define RegBND Class=RegBND

>

> +#define Mmword Qword

> +#define Oword  Xmmword

> +

>  #define JumpByte         Jump=JUMP_BYTE

>  #define JumpDword        Jump=JUMP_DWORD

>  #define JumpAbsolute     Jump=JUMP_ABSOLUTE

> @@ -106,6 +109,8 @@

>  // operands may allow to switch from 3-byte to 2-byte VEX encoding.

>  #define C StaticRounding

>

> +#define CpuFP Cpu387|Cpu287|Cpu8087

> +

>  ### MARKER ###

>

>  // Move instructions.


OK.

Thanks.

-- 
H.J.

Patch

--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -971,17 +971,6 @@  set_bitfield (char *f, bitfield *array,
   if (*f == '\0')
     return;
 
-  if (strcmp (f, "CpuFP") == 0)
-    {
-      set_bitfield("Cpu387", array, value, size, lineno);
-      set_bitfield("Cpu287", array, value, size, lineno);
-      f = "Cpu8087";
-    }
-  else if (strcmp (f, "Mmword") == 0)
-    f= "Qword";
-  else if (strcmp (f, "Oword") == 0)
-    f= "Xmmword";
-
   for (i = 0; i < size; i++)
     if (strcasecmp (array[i].name, f) == 0)
       {
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -58,6 +58,9 @@ 
 
 #define RegBND Class=RegBND
 
+#define Mmword Qword
+#define Oword  Xmmword
+
 #define JumpByte         Jump=JUMP_BYTE
 #define JumpDword        Jump=JUMP_DWORD
 #define JumpAbsolute     Jump=JUMP_ABSOLUTE
@@ -106,6 +109,8 @@ 
 // operands may allow to switch from 3-byte to 2-byte VEX encoding.
 #define C StaticRounding
 
+#define CpuFP Cpu387|Cpu287|Cpu8087
+
 ### MARKER ###
 
 // Move instructions.