* operand.scm (op:new-mode): Update. mode-name.
(op-natural-mode?) New fn.
* rtl.scm (hw): Set hw-name,mode-name.
plus some comment tweaks
2002-12-19 Doug Evans <dje@sebabeach.org>
+ * mode.scm (mode-sem-mode): New fn.
+ * operand.scm (op:new-mode): Update. mode-name.
+ (op-natural-mode?) New fn.
+ * rtl.scm (hw): Set hw-name,mode-name.
+
Back out sim*.scm changes of 2001-04-02 Ben Elliston <bje@redhat.com>
Instead do:
* sim-decode.scm (-gen-decode-insn-globals): Use @PREFIX@_INSN__MAX
(mode:lookup (mode-real-name m))
)
+; Return the version of MODE to use in semantic expressions.
+; This (essentially) converts aliases to their real value and then uses
+; mode:sem-mode. The implementation is the opposite but the effect is the
+; same.
+; ??? Less efficient than it should be. One improvement would be to
+; disallow unsigned modes from being aliased and set sem-mode for aliased
+; modes.
+
+(define (mode-sem-mode m)
+ (let* ((m1 (mode:lookup m))
+ (sm (mode:sem-mode m1)))
+ (if sm
+ sm
+ (mode-real-mode m1)))
+)
+
; Return #t if mode M1-NAME is bigger than mode M2-NAME.
(define (mode-bigger? m1-name m2-name)
; Mode support.
; Create a copy of operand OP in mode NEW-MODE-NAME.
+; NOTE: Even if the mode isn't changing this creates a copy.
; If OP has been subclassed the result must contain the complete class
; (e.g. the behaviour of `object-copy-top').
(if (not new-mode)
(error "op:new-mode: internal error, bad mode"
new-mode-name))
+ (elm-xset! result 'mode-name new-mode-name)
(elm-xset! result 'mode new-mode)
result)
(parse-error "op:new-mode"
"'")
new-mode-name))))
)
+
+; Return #t if operand OP references its h/w element in its natural mode.
+
+(define (op-natural-mode? op)
+ (or (eq? (op:mode-name op) 'DFLT)
+ (mode-compatible? 'samesize (op:mode op) (hw-default-mode (op:type op))))
+)
\f
; Ifield support.
(if (not (hw-mode-ok? hw (obj:name mode) (elm-xget result 'index)))
(parse-error "hw" "invalid mode for hardware" mode-name))
+ (elm-xset! result 'hw-name hw-name)
(elm-xset! result 'type hw)
+ (elm-xset! result 'mode-name mode-name)
(elm-xset! result 'mode mode)
(op:set-pretty-sem-name! result hw-name)
(else #f))
)
-; Simplify an rtl expresion.
+; Simplify an rtl expression.
; EXPR must be in source form.
; The result is a possibly simplified EXPR, still in source form.
;
)
; Return a boolean indicating if two bitranges overlap.
+;
+; lsb0? = #t: 31 ... 0
+; lsb0? = #f: 0 ... 31
(define (bitrange-overlap? start1 length1 start2 length2 lsb0?)
(if lsb0?