This is the mail archive of the binutils@sources.redhat.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]

cgen patch for MAX_OPERANDS > 128 : CGEN_SYNTAX_CHAR_TYPE


Hello,

This is a small patch for the MAX_OPERANDS > 128 : CGEN_SYNTAX_CHAR_TYPE 
problem.  CGEN_SYNTAX_CHAR_TYPE will now be typedef'd to an unsigned
short regardless of MAX_OPERAND.    

Also, renamed CGEN_MAX_SYNTAX_BYTES to CGEN_MAX_SYNTAX_ELEMENTS to
correctly describe the current logic/definitions and modified the
existing ports that used CGEN_MAX_SYNTAX_BYTES.

Any questions or problems?
 
Patrick

cgen ==========

 2001-01-30  Patrick Macdonald  <patrickm@redhat.com>
 
        * desc-cpu.scm (-gen-hash-defines): Rename
        CGEN_ACTUAL_MAX_SYNTAX_BYTES to CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS.
 
Index: src/cgen/desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.5
diff -c -p -r1.5 desc-cpu.scm
*** desc-cpu.scm        2001/01/06 12:11:09     1.5
--- desc-cpu.scm        2001/01/30 15:45:22
*************** const CGEN_HW_ENTRY @arch@_cgen_hw_table
*** 324,331 ****
     (if (all-true? (map isa-integral-insn? (current-isa-list))) "1" "0")
     "\n"
     "\n"
!    "/* Maximum nymber of syntax bytes in an instruction.  */\n"
!    "#define CGEN_ACTUAL_MAX_SYNTAX_BYTES "
     ; The +2 account for the leading "MNEM" and trailing 0.
     (number->string (+ 2 (apply max (map (lambda (insn) 
                                          (length (syntax-break-out (insn-syntax
insn))))
--- 324,331 ----
     (if (all-true? (map isa-integral-insn? (current-isa-list))) "1" "0")
     "\n"
     "\n"
!    "/* Maximum number of syntax bytes in an instruction.  */\n"
!    "#define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS "
     ; The +2 account for the leading "MNEM" and trailing 0.
     (number->string (+ 2 (apply max (map (lambda (insn) 
                                          (length (syntax-break-out (insn-syntax
insn))))



binutils ==========

 2001-01-30  Patrick Macdonald  <patrickm@redhat.com>
 
         * cgen.h (CGEN_SYNTAX_CHAR_TYPE): Typedef as unsigned short.
         (CGEN_MAX_SYNTAX_ELEMENTS): Rename from CGEN_MAX_SYNTAX_BYTES.
         (CGEN_SYNTAX): Define using CGEN_MAX_SYNTAX_ELEMENTS.
 
Index: src/include/opcode/cgen.h
===================================================================
RCS file: /cvs/src/src/include/opcode/cgen.h,v
retrieving revision 1.8
diff -c -p -r1.8 cgen.h
*** cgen.h      2001/01/09 17:01:07     1.8
--- cgen.h      2001/01/30 15:48:00
*************** typedef struct
*** 736,760 ****
     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 40
  
  /* 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
  
- #if !defined(MAX_OPERANDS) || MAX_OPERANDS <= 127
- typedef unsigned char CGEN_SYNTAX_CHAR_TYPE;
- #else
  typedef unsigned short CGEN_SYNTAX_CHAR_TYPE;
- #endif
  
  typedef struct
  {
!   CGEN_SYNTAX_CHAR_TYPE syntax[CGEN_MAX_SYNTAX_BYTES];
  } CGEN_SYNTAX;
  
  #define CGEN_SYNTAX_STRING(syn) (syn->syntax)
--- 736,756 ----
     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_ELEMENTS 40
  
  /* A target may know its own precise maximum.  Assert that it falls below
     the above limit. */
! #ifdef CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS
! #if CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS > CGEN_MAX_SYNTAX_ELEMENTS
! #error "CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS too high - enlarge
CGEN_MAX_SYNTAX_ELEMENTS"
  #endif
  #endif
  
  typedef unsigned short CGEN_SYNTAX_CHAR_TYPE;
  
  typedef struct
  {
!   CGEN_SYNTAX_CHAR_TYPE syntax[CGEN_MAX_SYNTAX_ELEMENTS];
  } CGEN_SYNTAX;
  
  #define CGEN_SYNTAX_STRING(syn) (syn->syntax)



 2001-01-30  Patrick Macdonald  <patrickm@redhat.com>
 
        * fr30-desc.h: Regenerate with CGEN_MAX_SYNTAX_ELEMENTS. 
        * m32r-desc.h: Regenerate.
  
Index: src/opcodes/fr30-desc.h
===================================================================
RCS file: /cvs/src/src/opcodes/fr30-desc.h,v
retrieving revision 1.6
diff -c -p -r1.6 fr30-desc.h
*** fr30-desc.h 2000/10/06 16:57:26     1.6
--- fr30-desc.h 2001/01/30 15:48:01
*************** with this program; if not, write to the 
*** 44,50 ****
  #define CGEN_INT_INSN_P 0
  
  /* Maximum nymber of syntax bytes in an instruction.  */
! #define CGEN_ACTUAL_MAX_SYNTAX_BYTES 15
  
  /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
     e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands
--- 44,50 ----
  #define CGEN_INT_INSN_P 0
  
  /* Maximum nymber of syntax bytes in an instruction.  */
! #define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15
  
  /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
     e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands
Index: src/opcodes/m32r-desc.h
===================================================================
RCS file: /cvs/src/src/opcodes/m32r-desc.h,v
retrieving revision 1.7
diff -c -p -r1.7 m32r-desc.h
*** m32r-desc.h 2000/10/06 16:57:26     1.7
--- m32r-desc.h 2001/01/30 15:48:01
*************** with this program; if not, write to the 
*** 45,51 ****
  #define CGEN_INT_INSN_P 1
  
  /* Maximum nymber of syntax bytes in an instruction.  */
! #define CGEN_ACTUAL_MAX_SYNTAX_BYTES 15
  
  /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
     e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands
--- 45,51 ----
  #define CGEN_INT_INSN_P 1
  
  /* Maximum nymber of syntax bytes in an instruction.  */
! #define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15
  
  /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
     e.g. In "b,a foo" the ",a" is an operand.  If mnemonics have operands

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