]> sourceware.org Git - cgen.git/commitdiff
2001-04-02 Ben Elliston <bje@redhat.com>
authorBen Elliston <bje@air.not.au>
Mon, 2 Apr 2001 22:04:48 +0000 (22:04 +0000)
committerBen Elliston <bje@air.not.au>
Mon, 2 Apr 2001 22:04:48 +0000 (22:04 +0000)
* sim-decode.scm (@prefix@_init_idesc_table): Compute tabsize
using the size of the table and its elements.
(-gen-decode-insn-globals): Define the idesc table's size to be
the last instruction enum plus one, not @PREFIX@_INSN_MAX.
* sim-model.scm (-gen-mach-defns): Define CPU_MAX_INSNS as the
last instruction enum plus one, not @CPU@_INSN_MAX.

ChangeLog
sim-decode.scm
sim-model.scm

index b1a3a947408d9bea4797ddd79b63ac6a158a3d28..16f2d5b7bbe42524e0655db43e766a467d5bbffc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * sid.scm (gen-cpu-insn-enum-decl): Do not append a dummy `max'
        instruction onto the instruction list.
        
+       * sim-decode.scm (@prefix@_init_idesc_table): Compute tabsize
+       using the size of the table and its elements.
+       (-gen-decode-insn-globals): Define the idesc table's size to be
+       the last instruction enum plus one, not @PREFIX@_INSN_MAX.
+       * sim-model.scm (-gen-mach-defns): Define CPU_MAX_INSNS as the
+       last instruction enum plus one, not @CPU@_INSN_MAX.
+
 2001-03-28  Ben Elliston  <bje@redhat.com>
 
        * doc/version.texi (UPDATED, EDITION): Update.
index 7eeca055245d8032db826cd4b2a484b79f8e0fda..5b1aa67027cf477d15adabb2851f12213a01e283 100644 (file)
@@ -32,7 +32,9 @@
    teensy bit of cpu in the decoder.  Moving it to malloc space is trivial
    but won't be done until necessary (we don't currently support the runtime
    addition of instructions nor an SMP machine with different cpus).  */
-static IDESC " IDESC-TABLE-VAR "[@PREFIX@_INSN_MAX];
+static IDESC " IDESC-TABLE-VAR "[@PREFIX@_INSN_"
+   (string-upcase (gen-c-symbol (caar (list-take -1
+       (gen-obj-list-enums (non-multi-insns (current-insn-list))))))) " + 1];
 
 /* Commas between elements are contained in the macros.
    Some of these are conditionally compiled out.  */
@@ -145,7 +147,7 @@ void
 {
   IDESC *id,*tabend;
   const struct insn_sem *t,*tend;
-  int tabsize = @PREFIX@_INSN_MAX;
+  int tabsize = sizeof (" IDESC-TABLE-VAR ") / sizeof (IDESC);
   IDESC *table = " IDESC-TABLE-VAR ";
 
   memset (table, 0, tabsize * sizeof (IDESC));
index eb42c93af23c94859cca800d1a257dae9d06616f..8627889f31c880e817ffcee0289d5fe3c42fe3b4 100644 (file)
@@ -313,11 +313,13 @@ static const CGEN_INSN *
 ; Return C code to define the machine data.
 
 (define (-gen-mach-defns)
-  (string-list-map
-   (lambda (mach)
-     (gen-obj-sanitize
-      mach
-      (string-list "\
+  (let* ((insns (gen-obj-list-enums (non-multi-insns (current-insn-list))))
+        (last-insn (string-upcase (gen-c-symbol (caar (list-take -1 insns))))))
+    (string-list-map
+     (lambda (mach)
+       (gen-obj-sanitize
+       mach
+       (string-list "\
 static void\n"
 (gen-sym mach) "_init_cpu (SIM_CPU *cpu)
 {
@@ -326,7 +328,7 @@ static void\n"
   CPU_PC_FETCH (cpu) = " (gen-sym (mach-cpu mach)) "_h_pc_get;
   CPU_PC_STORE (cpu) = " (gen-sym (mach-cpu mach)) "_h_pc_set;
   CPU_GET_IDATA (cpu) = @cpu@_get_idata;
-  CPU_MAX_INSNS (cpu) = @CPU@_INSN_MAX;
+  CPU_MAX_INSNS (cpu) = @CPU@_INSN_" last-insn " + 1;
   CPU_INSN_NAME (cpu) = cgen_insn_name;
   CPU_FULL_ENGINE_FN (cpu) = @cpu@_engine_run_full;
 #if WITH_FAST
@@ -352,7 +354,7 @@ const MACH " (gen-sym mach) "_mach =
 
 ")))
 
-   (current-mach-list))
+   (current-mach-list)))
 )
 \f
 ; Top level file generators.
This page took 0.038798 seconds and 5 git commands to generate.