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'.
(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))
)
"")
(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"))))
(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
;;; 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.