OSDN Git Service

* ifield.scm (ifld-encode-mode): Add FIXME.
authordevans <devans>
Wed, 19 Aug 2009 04:20:29 +0000 (04:20 +0000)
committerdevans <devans>
Wed, 19 Aug 2009 04:20:29 +0000 (04:20 +0000)
* opcodes.scm (<ifield> 'gen-insert): Handle encode parameters with
modes.
(<ifield> 'gen-extract): Similarly.

* read.scm (parse-error): Handle #f for context-location.
* utils-cgen.scm (unspecified-location): Fix building of
single-location.

cgen/ChangeLog
cgen/ifield.scm
cgen/opcodes.scm
cgen/read.scm
cgen/utils-cgen.scm

index c2bd845..3dd5345 100644 (file)
@@ -1,11 +1,20 @@
 2009-08-18  Doug Evans  <dje@sebabeach.org>
 
+       * ifield.scm (ifld-encode-mode): Add FIXME.
+       * opcodes.scm (<ifield> 'gen-insert): Handle encode parameters with
+       modes.
+       (<ifield> 'gen-extract): Similarly.
+
+       * read.scm (parse-error): Handle #f for context-location.
+       * utils-cgen.scm (unspecified-location): Fix building of
+       single-location.
+
        * doc/rtl.texi: Document how to write hex and boolean values.
 
-       * gas-test.scm (<hw-asm>, test-data): Handle () values.
-       (<keyword>, test-data): Convert symbols to strings before passing
+       * gas-test.scm (<hw-asm> test-data): Handle () values.
+       (<keyword> test-data): Convert symbols to strings before passing
        to string-append.
-       (<hw-index>, test-data): Enumerate all cases.  Emit correctly sized
+       (<hw-index> test-data): Enumerate all cases.  Emit correctly sized
        result for scalars.
 
        * operand.scm (hw-index-scalar): Set `name'.
index 16616c1..d8dd0c5 100644 (file)
@@ -82,6 +82,8 @@
 (define (ifld-encode-mode f)
   (if (ifld-decode f)
       ; cadr/cadr gets WI in ((value pc) (sra WI ...))
+      ; FIXME: That's wrong for a fully canonical expression like
+      ; ((value pc) (sra () WI ...)).
       (mode:lookup (cadr (cadr (ifld-decode f))))
       (ifld-mode f))
 )
index cb2c28b..5ed8891 100644 (file)
          "")
       (if encode
          (string-append "        value = "
+                        ;; NOTE: ENCODE is either, e.g.,
+                        ;; ((value pc) (sra DI value 1))
+                        ;; or
+                        ;; (((<mode> value) (<mode> pc)) (sra DI value 1))
                         (let ((expr (cadr encode))
-                              (value (caar encode))
-                              (pc (cadar encode)))
+                              (value (if (symbol? (caar encode)) (caar encode) (cadr (caar encode))))
+                              (pc (if (symbol? (cadar encode)) (cadar encode) (cadr (cadar encode)))))
                           (rtl-c DFLT expr
                                  (list (list value (obj:name (ifld-encode-mode self)) "value")
                                        (list pc 'IAI "pc"))))
       ");\n"
       (if decode
          (string-append "        value = "
+                        ;; NOTE: DECODE is either, e.g.,
+                        ;; ((value pc) (sll DI value 1))
+                        ;; or
+                        ;; (((<mode> value) (<mode> pc)) (sll DI value 1))
                         (let ((expr (cadr decode))
-                              (value (caar decode))
-                              (pc (cadar decode)))
+                              (value (if (symbol? (caar decode)) (caar decode) (cadr (caar decode))))
+                              (pc (if (symbol? (cadar decode)) (cadar decode) (cadr (cadar decode)))))
                           (rtl-c DFLT expr
                                  (list (list value (obj:name (ifld-decode-mode self)) "value")
                                        (list pc 'IAI "pc"))))
index 1eca982..b66a1a6 100644 (file)
 (define (parse-error context message expr . maybe-help-text)
   (if (not context)
       (set! context (make <context> (current-reader-location) #f)))
-  (let* ((loc (context-location context))
+  (let* ((loc (or (context-location context) (unspecified-location)))
         (top-sloc (location-top loc))
         (prefix (context-prefix context)))
     (error
index 2ee2a50..662b7a4 100644 (file)
@@ -85,6 +85,7 @@
 ;;; A single source location.
 ;;; This is recorded as a vector for simplicity.
 ;;; END? is true if the location marks the end of the expression.
+;;; NOTE: LINE and COLUMN are origin-0 (the first line is line 0).
 
 (define (make-single-location file line column end?)
   (vector file line column end?)
 )
 
 ;;; Return an unspecified <location>.
-;;; This is for use in debugging utilities.
+;;; This is mainly for use in debugging utilities.
+;;; Ideally for .cpu-file related stuff we always have a location,
+;;; but that's not always true.
 
 (define (unspecified-location)
-  (make <location> (list (cons "unspecified" 1)))
+  (make <location> (list (make-single-location "unspecified" 0 0 #f)))
 )
 
 ;;; Return a <location> object for the current input port.