public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Patrick Macdonald <patrickm@redhat.com>
To: cgen@sources.redhat.com, binutils@sources.redhat.com
Subject: cgen patch for MAX_OPERANDS > 128 : CGEN_SYNTAX_CHAR_TYPE
Date: Tue, 30 Jan 2001 08:12:00 -0000	[thread overview]
Message-ID: <3A76E7F7.DE6286A5@redhat.com> (raw)

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

             reply	other threads:[~2001-01-30  8:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-30  8:12 Patrick Macdonald [this message]
2001-01-30 16:28 ` Ben Elliston
2001-01-30 17:02   ` Patrick Macdonald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A76E7F7.DE6286A5@redhat.com \
    --to=patrickm@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=cgen@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).