OSDN Git Service

2001-03-20 Ben Elliston <bje@redhat.com>
authorbje <bje>
Tue, 20 Mar 2001 19:30:13 +0000 (19:30 +0000)
committerbje <bje>
Tue, 20 Mar 2001 19:30:13 +0000 (19:30 +0000)
* opc-itab.scm (-gen-insn-enum): Do not append a dummy `max'
instruction onto the instruction list. Define MAX_INSNS to be the
value of the last instruction enum plus one.

cgen/ChangeLog
cgen/opc-itab.scm

index 5516409..afa7ccc 100644 (file)
@@ -1,3 +1,9 @@
+2001-03-20  Ben Elliston  <bje@redhat.com>
+
+       * opc-itab.scm (-gen-insn-enum): Do not append a dummy `max'
+       instruction onto the instruction list. Define MAX_INSNS to be the
+       value of the last instruction enum plus one.
+
 2001-03-14  Nick Clifton  <nickc@redhat.com>
 
        * utils.scm (copyright-fsf): Add 2001.  Remove (C).
index 8f4f632..ca55b2a 100644 (file)
 
 (define (-gen-insn-enum)
   (logit 2 "Generating instruction enum ...\n")
-  (string-list
-   (gen-enum-decl 'cgen_insn_type "@arch@ instruction types"
-                 "@ARCH@_INSN_"
-                 (cons '(invalid)
-                       (append (gen-obj-list-enums (non-multi-insns (current-insn-list)))
-                               '((max)))))
-   "/* Index of `invalid' insn place holder.  */\n"
-   "#define CGEN_INSN_INVALID @ARCH@_INSN_INVALID\n\n"
-   "/* Total number of insns in table.  */\n"
-   "#define MAX_INSNS ((int) @ARCH@_INSN_MAX)\n\n"
+  (let ((insns (gen-obj-list-enums (non-multi-insns (current-insn-list)))))
+    (string-list
+     (gen-enum-decl 'cgen_insn_type "@arch@ instruction types"
+                   "@ARCH@_INSN_"
+                   (cons '(invalid) insns))
+     "/* Index of `invalid' insn place holder.  */\n"
+     "#define CGEN_INSN_INVALID @ARCH@_INSN_INVALID\n\n"
+     "/* Total number of insns in table.  */\n"
+     "#define MAX_INSNS ((int) @ARCH@_INSN_"
+     (string-upcase (gen-c-symbol (caar (list-take -1 insns)))) " + 1)\n\n"
    )
+  )
 )
 
 ; Return a reference to the format table entry of INSN.