OSDN Git Service

* sim.scm (/operand-number-elaboration-written?): New variable.
authordevans <devans>
Sat, 21 Nov 2009 18:57:58 +0000 (18:57 +0000)
committerdevans <devans>
Sat, 21 Nov 2009 18:57:58 +0000 (18:57 +0000)
(/op-gen-written-update op): New function.
(/op-gen-set-trace, /op-gen-set-trace-parallel): Call it.

cgen/ChangeLog
cgen/sim.scm

index d820de7..10caab6 100644 (file)
@@ -1,5 +1,9 @@
 2009-11-21  Doug Evans  <dje@sebabeach.org>
 
+       * sim.scm (/operand-number-elaboration-written?): New variable.
+       (/op-gen-written-update op): New function.
+       (/op-gen-set-trace, /op-gen-set-trace-parallel): Call it.
+
        * read.scm (/cmd-define-rtl-version): Only log rtl version if changed.
 
        * operand.scm (op-nub): Delete.
index d91cbd3..82b6e0e 100644 (file)
        " = " (cx:c newval) ";\n"))
 )
 
+(define /operand-number-elaboration-written? #f)
+
+;; Return code to update `written'.
+
+(define (/op-gen-written-update op)
+  (if (op:cond? op)
+      ;; FIXME: we don't yet handle a large number of operands
+      (if (< (op:num op) 32)
+         (string-append "    written |= (1 << "
+                        (number->string (op:num op))
+                        ");\n")
+         (begin
+           ;; FIXME: This creates broken simulators if with-parallel-write?.
+           (message (if (with-parallel-write?) "Error: " "Warning: ")
+                    (obj:name op)
+                    " operand number " (op:num op)
+                    " is too large (>= 32)\n")
+           (if (not /operand-number-elaboration-written?)
+               (begin
+                 (message "This is a current internal cgen limitation.\n")
+                 (if (not (with-parallel-write?))
+                     (message "The only effect is a loss in profiling capability.\n"))
+                 (set! /operand-number-elaboration-written? #t)))
+           ""))
+      "")
+)
+
 (define (/op-gen-set-trace op estate mode index selector newval)
   (string-append
    "  {\n"
        ;else
        (send (op:type op) 'gen-set-quiet estate mode index selector
             (cx:make-with-atlist mode "opval" (cx:atlist newval))))
-   (if (op:cond? op)
-       (string-append "    written |= (1 << "
-                     (number->string (op:num op))
-                     ");\n")
-       "")
+   (/op-gen-written-update op)
 ; TRACE_RESULT_<MODE> (cpu, abuf, hwnum, opnum, value);
 ; For each insn record array of operand numbers [or indices into
 ; operand instance table].
            "")
        "    " /par-operand-macro " (" (gen-sym op) ")"
        " = opval;\n"))
-   (if (op:cond? op)
-       (string-append "    written |= (1 << "
-                     (number->string (op:num op))
-                     ");\n")
-       "")
+   (/op-gen-written-update op)
 ; TRACE_RESULT_<MODE> (cpu, abuf, hwnum, opnum, value);
 ; For each insn record array of operand numbers [or indices into
 ; operand instance table].