1.0.30.3: deal with load-time-value constants more aggressively
authorPaul Khuong <pvk@pvk.ca>
Sat, 18 Jul 2009 17:53:00 +0000 (17:53 +0000)
committerPaul Khuong <pvk@pvk.ca>
Sat, 18 Jul 2009 17:53:00 +0000 (17:53 +0000)
* Revert 1.0.29.54.rc5 to allow constant moves from LTV TNs.

* Modify the relevant VOPs to handle LTV constants correctly.
  While this mostly results in duplicated code, VOPs can generate
  better code even for unknown values in the constant vector.

src/compiler/alpha/move.lisp
src/compiler/hppa/move.lisp
src/compiler/mips/move.lisp
src/compiler/ppc/move.lisp
src/compiler/represent.lisp
src/compiler/sparc/move.lisp
src/compiler/x86-64/move.lisp
src/compiler/x86/move.lisp
version.lisp-expr

index bfdb4fe..6416dc6 100644 (file)
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst li (tn-value x) y)))
+    (cond ((sc!c::tn-leaf x)
+           (inst li (tn-value x) y))
+          (t
+           (loadw y code-tn (tn-offset x) other-pointer-lowtag)
+           (inst sra y n-fixnum-tag-bits y)))))
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
 
index 724ab93..67b535b 100644 (file)
   (:arg-types tagged-num)
   (:note "fixnum untagging")
   (:generator 1
-    (inst sra x 2 y)))
+    (inst sra x n-fixnum-tag-bits y)))
 
 (define-move-vop move-to-word/fixnum :move
   (any-reg descriptor-reg) (signed-reg unsigned-reg))
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst li (tn-value x) y)))
+    (cond ((sb!c::tn-leaf x)
+           (inst li (tn-value x) y))
+          (t
+           (loadw y code-tn (tn-offset x) other-pointer-lowtag)
+           (inst sra y n-fixnum-tag-bits y)))))
 
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
index b839199..5bb0c85 100644 (file)
   (:arg-types tagged-num)
   (:note "fixnum untagging")
   (:generator 1
-    (inst sra y x 2)))
+    (inst sra y x n-fixnum-tag-bits)))
 ;;;
 (define-move-vop move-to-word/fixnum :move
   (any-reg descriptor-reg) (signed-reg unsigned-reg))
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst li y (tn-value x))))
+    (cond ((sb!c::tn-leaf x)
+           (inst li y (tn-value x)))
+          (t
+           (loadw y code-tn (tn-offset x) other-pointer-lowtag)
+           (inst sra y y n-fixnum-tag-bits)))))
 ;;;
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
index 966925b..a948dee 100644 (file)
   (:arg-types tagged-num)
   (:note "fixnum untagging")
   (:generator 1
-    (inst srawi y x 2)))
+    (inst srawi y x n-fixnum-tag-bits)))
 (define-move-vop move-to-word/fixnum :move
   (any-reg descriptor-reg) (signed-reg unsigned-reg))
 
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst lr y (tn-value x))))
+    (cond ((sb!c::tn-leaf x)
+           (inst lr y (tn-value x)))
+          (t
+           (loadw y code-tn (tn-offset x) other-pointer-lowtag)
+           (inst srawi y y n-fixnum-tag-bits)))))
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
 
index c4b92cc..8d2418e 100644 (file)
                    (operand-restriction-ok
                     (first (template-result-types info))
                     (if write-p op-ptype other-ptype)
-                    :t-ok nil)
-                   ;; KLUDGE: Move VOPs with constant SCs can't use
-                   ;; load-time-value TNs. FIXME: if the VOPs were more
-                   ;; clever they could -- this is the release bandaid.
-                   (or (not (eq 'constant (sc-name op-sc)))
-                       (tn-leaf op-tn)))
+                    :t-ok nil))
           (return info))))))
 
 ;;; Emit a coercion VOP for OP BEFORE the specifed VOP or die trying.
index 5b4bc1b..72080a2 100644 (file)
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst li y (tn-value x))))
+    (cond ((sb!c::tn-leaf x)
+           (inst li y (tn-value x)))
+          (t
+           (loadw y code-tn (tn-offset x) other-pointer-lowtag)
+           (inst sra y y n-fixnum-tag-bits)))))
 
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
index cd6642b..b5c628b 100644 (file)
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst mov y (tn-value x))))
+    (cond ((sb!c::tn-leaf x)
+           (inst mov y (tn-value x)))
+          (t
+           (inst mov y x)
+           (inst sar y n-fixnum-tag-bits)))))
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
 
index 2c198a9..344c572 100644 (file)
   (:note "fixnum untagging")
   (:generator 1
     (move y x)
-    (inst sar y 2)))
+    (inst sar y n-fixnum-tag-bits)))
 (define-move-vop move-to-word/fixnum :move
   (any-reg descriptor-reg) (signed-reg unsigned-reg))
 
   (:results (y :scs (signed-reg unsigned-reg)))
   (:note "constant load")
   (:generator 1
-    (inst mov y (tn-value x))))
+    (cond ((sb!c::tn-leaf x)
+           (inst mov y (tn-value x)))
+          (t
+           (inst mov y x)
+           (inst sar y n-fixnum-tag-bits)))))
 (define-move-vop move-to-word-c :move
   (constant) (signed-reg unsigned-reg))
 
index c5fcc61..f1151b4 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.30.2"
+"1.0.30.3"