(in-package "SB!VM")
-;(def-assembler-params
-; :scheduler-p nil ; t when we trust the scheduler not to "fill delay slots"
-; :max-locations 70)
+;;; needs a little more work in the assembler, to realise that the
+;;; delays requested here are not mandatory, so that the assembler
+;;; shouldn't fill gaps with NOPs but with real instructions. -- CSR,
+;;; 2003-09-08
+#+nil
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (setf sb!assem:*assem-scheduler-p* t)
+ (setf sb!assem:*assem-max-locations* 70))
\f
;;;; Constants, types, conversion functions, some disassembler stuff.
(:printer x ((op ,op) (xo ,xo)))
(:delay ,cost)
(:cost ,cost)
- (:dependencies (reads ra) (reads rb) ,@ other-reads
+ (:dependencies (reads ra) (reads rb) (reads :memory) ,@other-reads
(writes rt) ,@other-writes)
(:emitter
(emit-x-form-inst segment ,op
(:delay ,cost)
(:cost ,cost)
(:dependencies (reads ra) (reads rb) (reads rs) ,@other-reads
- ,@other-writes)
+ (writes :memory :partially t) ,@other-writes)
(:emitter
(emit-x-form-inst segment ,op
(reg-tn-encoding rs)
(:delay ,cost)
(:cost ,cost)
(:dependencies (reads ra) (reads rb) (reads frs) ,@other-reads
- ,@other-writes)
+ (writes :memory :partially t) ,@other-writes)
(:emitter
(emit-x-form-inst segment ,op
(fp-reg-tn-encoding frs)
(:delay ,cost)
(:cost ,cost)
,@(when pinned '(:pinned))
- (:dependencies (reads ra) ,@other-reads
+ (:dependencies (reads ra) (reads :memory) ,@other-reads
(writes rt) ,@other-writes)
(:emitter
(emit-d-form-inst segment ,op (reg-tn-encoding rt) (reg-tn-encoding ra) si)))))
(:printer d-frt ((op ,op)))
(:delay ,cost)
(:cost ,cost)
- (:dependencies (reads ra) ,@other-reads
+ (:dependencies (reads ra) (reads :memory) ,@other-reads
(writes frt) ,@other-writes)
(:emitter
(emit-d-form-inst segment ,op (fp-reg-tn-encoding frt) (reg-tn-encoding ra) si)))))
(define-a-tac-instruction (name op xo rc &key (cost 1) other-dependencies)
(multiple-value-bind (other-reads other-writes) (classify-dependencies other-dependencies)
- `(define-instruction ,name (segment frt fra frc)
+ `(define-instruction ,name (segment frt fra frb)
(:printer a-tac ((op ,op) (xo ,xo) (rc ,rc)))
(:cost ,cost)
(:delay 1)
(fp-reg-tn-encoding frt)
(fp-reg-tn-encoding fra)
0
- (fp-reg-tn-encoding frc)
+ (fp-reg-tn-encoding frb)
,xo
,rc)))))
(define-instruction twi (segment tcond ra si)
(:printer d-to ((op 3)))
- (:delay 1)
+ (:delay 0)
:pinned
(:emitter (emit-d-form-inst segment 3 (valid-tcond-encoding tcond) (reg-tn-encoding ra) si)))
(define-instruction bc (segment bo bi target)
(:declare (type label target))
(:printer b ((op 16) (aa 0) (lk 0)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr))
(:emitter
(emit-conditional-branch segment bo bi target)))
(define-instruction bcl (segment bo bi target)
(:declare (type label target))
(:printer b ((op 16) (aa 0) (lk 1)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr))
(:emitter
(emit-conditional-branch segment bo bi target nil t)))
(define-instruction bca (segment bo bi target)
(:declare (type label target))
(:printer b ((op 16) (aa 1) (lk 0)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr))
(:emitter
(emit-conditional-branch segment bo bi target t)))
(define-instruction bcla (segment bo bi target)
(:declare (type label target))
(:printer b ((op 16) (aa 1) (lk 1)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr))
(:emitter
(emit-conditional-branch segment bo bi target t t)))
-;;; There may (or may not) be a good reason to use this in preference to "b[la] target".
-;;; I can't think of a -bad- reason ...
+;;; There may (or may not) be a good reason to use this in preference
+;;; to "b[la] target". I can't think of a -bad- reason ...
(define-instruction bu (segment target)
(:declare (type label target))
(:printer b ((op 16) (bo #.(valid-bo-encoding :bo-u)) (bi 0) (aa 0) (lk 0))
'(:name :tab bd))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(emit-conditional-branch segment #.(valid-bo-encoding :bo-u) 0 target nil nil)))
(define-instruction bt (segment bi target)
(:printer b ((op 16) (bo #.(valid-bo-encoding :bo-t)) (aa 0) (lk 0))
'(:name :tab bi "," bd))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(emit-conditional-branch segment #.(valid-bo-encoding :bo-t) bi target nil nil)))
(define-instruction bf (segment bi target)
(:printer b ((op 16) (bo #.(valid-bo-encoding :bo-f)) (aa 0) (lk 0))
'(:name :tab bi "," bd))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(emit-conditional-branch segment #.(valid-bo-encoding :bo-f) bi target nil nil)))
(define-instruction b? (segment cr-field-name cr-name &optional (target nil target-p))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(unless target-p
(setq target cr-name cr-name cr-field-name cr-field-name :cr0))
(define-instruction sc (segment)
(:printer sc ((op 17)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
:pinned
(:emitter (emit-sc-form-inst segment 17 2)))
(define-instruction b (segment target)
(:printer i ((op 18) (aa 0) (lk 0)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(emit-i-form-branch segment target nil)))
(define-instruction ba (segment target)
(:printer i-abs ((op 18) (aa 1) (lk 0)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(when (typep target 'fixup)
(note-fixup segment :ba target)
(define-instruction bl (segment target)
(:printer i ((op 18) (aa 0) (lk 1)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(emit-i-form-branch segment target t)))
(define-instruction bla (segment target)
(:printer i-abs ((op 18) (aa 1) (lk 1)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:emitter
(when (typep target 'fixup)
(note-fixup segment :ba target)
(define-instruction blr (segment)
(:printer xl-bo-bi ((op 19) (xo 16) (bo #.(valid-bo-encoding :bo-u))(bi 0) (lk 0)) '(:name))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :ctr))
(:emitter
(emit-x-form-inst segment 19 (valid-bo-encoding :bo-u) 0 0 16 0)))
(define-instruction bclr (segment bo bi)
(:printer xl-bo-bi ((op 19) (xo 16)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :lr))
(:emitter
(emit-x-form-inst segment 19 (valid-bo-encoding bo) (valid-bi-encoding bi) 0 16 0)))
(define-instruction bclrl (segment bo bi)
(:printer xl-bo-bi ((op 19) (xo 16) (lk 1)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :lr))
(:emitter
(emit-x-form-inst segment 19 (valid-bo-encoding bo)
(define-instruction bcctr (segment bo bi)
(:printer xl-bo-bi ((op 19) (xo 528)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :ctr))
(:emitter
(emit-x-form-inst segment 19 (valid-bo-encoding bo) (valid-bi-encoding bi) 0 528 0)))
(define-instruction bcctrl (segment bo bi)
(:printer xl-bo-bi ((op 19) (xo 528) (lk 1)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :ctr) (writes :lr))
(:emitter
(emit-x-form-inst segment 19 (valid-bo-encoding bo) (valid-bi-encoding bi) 0 528 1)))
(define-instruction bctr (segment)
(:printer xl-bo-bi ((op 19) (xo 528) (bo #.(valid-bo-encoding :bo-u)) (bi 0) (lk 0)) '(:name))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :ctr))
(:emitter
(emit-x-form-inst segment 19 #.(valid-bo-encoding :bo-u) 0 0 528 0)))
(define-instruction bctrl (segment)
(:printer xl-bo-bi ((op 19) (xo 528) (bo #.(valid-bo-encoding :bo-u)) (bi 0) (lk 1)) '(:name))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
(:dependencies (reads :ccr) (reads :ctr))
(:emitter
(emit-x-form-inst segment 19 #.(valid-bo-encoding :bo-u) 0 0 528 1)))
(define-instruction tw (segment tcond ra rb)
(:printer x-19 ((op 31) (xo 4)))
- (:delay 1)
+ (:attributes branch)
+ (:delay 0)
:pinned
(:emitter (emit-x-form-inst segment 31 (valid-tcond-encoding tcond) (reg-tn-encoding ra) (reg-tn-encoding rb) 4 0)))
(:unless (:same-as rs) "," rb)))
(:delay 1)
(:cost 1)
- (:dependencies (reads rb) (reads rs) (writes ra))
+ (:dependencies (reads rb) (reads rs) (writes ra) (writes :ccr))
(:emitter
(emit-x-form-inst segment
31
(:printer x-9 ((op 31) (xo 824) (rc 1)))
(:cost 1)
(:delay 1)
- (:dependencies (reads rs) (writes ra))
+ (:dependencies (reads rs) (writes ra) (writes :ccr))
(:emitter
(emit-x-form-inst segment 31
(reg-tn-encoding rs)
(:printer d ((op 32)))
(:delay 2)
(:cost 2)
- (:dependencies (reads ra) (writes rt))
+ (:dependencies (reads ra) (writes rt) (reads :memory))
(:emitter
(when (typep si 'fixup)
(note-fixup segment :l si)
(define-instruction mffs. (segment frd)
(:printer x-22 ((op 63) (xo 583) (rc 1)))
(:delay 1)
- (:dependencies (reads :fpscr) (writes frd))
+ (:dependencies (reads :fpscr) (writes frd) (writes :ccr))
(:emitter (emit-x-form-inst segment
63
(fp-reg-tn-encoding frd)