This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch for include/opcode/cgen.h



hi.


i'd like to submit this patch to "opcode/cgen.h" to prepare for upcoming
changes to cgen.  it cleans up a small cgen API, and also increases a
buffer size (necessary for upcoming port).  it does not affect any 
current code in opcodes/gas that uses this file (fr30 & m32r).

thanks,


.mrg.


2000-05-29  matthew green  <mrg@cygnus.com>

	* opcode/cgen.h (CGEN_ACTUAL_MAX_SYNTAX_BYTES): Rename this ...
	(CGEN_ACTUAL_MAX_SYNTAX_SIZE): ... to this, now define as 40.
	(CGEN_MAX_SYNTAX_BYTES): Rename this ...
	(CGEN_MAX_SYNTAX_SIZE): ... to this.
	(CGEN_SYNTAX_TYPE): New typedef.
	(CGEN_SYNTAX): Use new CGEN_SYNTAX_TYPE.
	(CGEN_SYNTAX_VALUE): New macro, replaces CGEN_SYNTAX_STRING.
	(CGEN_SYNTAX_CHAR): Now cast to (char).
	(CGEN_SYNTAX_STRING): Define this in terms of CGEN_SYNTAX_VALUE.
	No functional change, but allows CGEN_SYNTAX_TYPE to be define as
	`unsigned int' with no other changes.


Index: opcode/cgen.h
===================================================================
RCS file: /cvs/src/src/include/opcode/cgen.h,v
retrieving revision 1.5
diff -p -r1.5 cgen.h
*** opcode/cgen.h	2000/05/16 19:28:07	1.5
--- opcode/cgen.h	2000/05/28 18:04:06
*************** typedef struct
*** 730,762 ****
  
     Each insn format and subexpression has one of these.
  
!    The syntax "string" consists of characters (n > 0 && n < 128), and operand
     values (n >= 128), and is terminated by 0.  Operand values are 128 + index
     into the operand table.  The operand table doesn't exist in C, per se, as
     the data is recorded in the parse/insert/extract/print switch statements. */
  
  /* This should be at least as large as necessary for any target. */
! #define CGEN_MAX_SYNTAX_BYTES 32
! 
  /* A target may know its own precise maximum.  Assert that it falls below
     the above limit. */
! #ifdef CGEN_ACTUAL_MAX_SYNTAX_BYTES
! #if CGEN_ACTUAL_MAX_SYNTAX_BYTES > CGEN_MAX_SYNTAX_BYTES
! #error "CGEN_ACTUAL_MAX_SYNTAX_BYTES too high - enlarge CGEN_MAX_SYNTAX_BYTES"
  #endif
  #endif
  
  
  typedef struct
  {
!   unsigned char syntax[CGEN_MAX_SYNTAX_BYTES];
  } CGEN_SYNTAX;
  
! #define CGEN_SYNTAX_STRING(syn) (syn->syntax)
! #define CGEN_SYNTAX_CHAR_P(c) ((c) < 128)
! #define CGEN_SYNTAX_CHAR(c) (c)
! #define CGEN_SYNTAX_FIELD(c) ((c) - 128)
  #define CGEN_SYNTAX_MAKE_FIELD(c) ((c) + 128)
  
  /* ??? I can't currently think of any case where the mnemonic doesn't come
     first [and if one ever doesn't building the hash tables will be tricky].
--- 730,766 ----
  
     Each insn format and subexpression has one of these.
  
!    The syntax "string" consists of ints (n > 0 && n < 128), and operand
     values (n >= 128), and is terminated by 0.  Operand values are 128 + index
     into the operand table.  The operand table doesn't exist in C, per se, as
     the data is recorded in the parse/insert/extract/print switch statements. */
  
  /* This should be at least as large as necessary for any target. */
! #define CGEN_MAX_SYNTAX_SIZE 40
!   
  /* A target may know its own precise maximum.  Assert that it falls below
     the above limit. */
! #ifdef CGEN_ACTUAL_MAX_SYNTAX_SIZE
! #if CGEN_ACTUAL_MAX_SYNTAX_SIZE > CGEN_MAX_SYNTAX_SIZE
! #error "CGEN_ACTUAL_MAX_SYNTAX_SIZE too high - enlarge CGEN_MAX_SYNTAX_SIZE"
  #endif
  #endif
  
+ typedef unsigned char CGEN_SYNTAX_TYPE;
  
  typedef struct
  {
!   CGEN_SYNTAX_TYPE syntax[CGEN_MAX_SYNTAX_SIZE];
  } CGEN_SYNTAX;
  
! #define CGEN_SYNTAX_VALUE(syn)	  ((syn)->syntax)
! #define CGEN_SYNTAX_CHAR_P(c)	  ((c) < 128)
! #define CGEN_SYNTAX_CHAR(c)	  (char)(c)
! #define CGEN_SYNTAX_FIELD(c)	  ((c) - 128)
  #define CGEN_SYNTAX_MAKE_FIELD(c) ((c) + 128)
+ 
+ /* Backwards compat */
+ #define CGEN_SYNTAX_STRING(syn)	  CGEN_SYNTAX_VALUE(syn)
  
  /* ??? I can't currently think of any case where the mnemonic doesn't come
     first [and if one ever doesn't building the hash tables will be tricky].

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]