Skip to content
Browse files
define more move functions and vops
The compiler needs to know how to move quantities between locations
and between representations.  The MOVE-VOPs are used to move them
within a routine; the MOVE-FUNs are for register spilling and
save/restore, at least according to a comment.

We also need to extend the storage base definition of ANY-REG, so that
it knows that constants in the IMMEDIATE storage class can be moved
into ANY-REG locations.

This gets us as far as failing to pack (choose actual registers for
our Temporary Names) which is reasonable since we haven't actually
given any of these storage classes any actual registers.
  • Loading branch information
csrhodes committed Aug 13, 2018
1 parent 86ea59e commit 3da9509e10a0e106673eb70ddc9c4b5053ec4bce
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
@@ -11,6 +11,16 @@

(in-package "SB!VM")

(define-move-fun (load-immediate 1) (vop x y)
((immediate) (any-reg descriptor-reg))
(let ((val (tn-value x)))
(etypecase val
(integer (load-immediate-word y (fixnumize val))))))

(define-move-fun (load-number 1) (vop x y)
((immediate) (signed-reg unsigned-reg))
(load-immediate-word y (tn-value x)))

(define-move-fun (load-stack 5) (vop x y)
((control-stack) (any-reg descriptor-reg))
(load-stack-tn y x))
@@ -37,12 +47,36 @@
(:args (x :scs (any-reg descriptor-reg)))
(:results (y :scs (any-reg descriptor-reg control-stack)))
(:generator 0))
(define-move-vop move :move
(any-reg descriptor-reg) (any-reg descriptor-reg))

(define-vop (move-to-word/fixnum)
(:args (x :scs (any-reg descriptor-reg)))
(:results (y :scs (signed-reg unsigned-reg)))
(:arg-types tagged-num)
(:generator 1))
(define-move-vop move-to-word/fixnum :move
(any-reg descriptor-reg) (signed-reg unsigned-reg))
(define-vop (move-from-word/fixnum)
(:args (x :scs (signed-reg unsigned-reg) :target y))
(:results (y :scs (any-reg descriptor-reg)))
(:result-types tagged-num)
(:generator 0))
(:generator 1))
(define-move-vop move-from-word/fixnum :move
(signed-reg unsigned-reg) (any-reg descriptor-reg))

(define-vop (move-from-signed)
(:args (x :scs (signed-reg unsigned-reg) :target y))
(:results (y :scs (any-reg descriptor-reg)))
(:generator 18))
(define-move-vop move-from-signed :move
(signed-reg) (descriptor-reg))
(define-vop (move-from-unsigned)
(:args (x :scs (signed-reg unsigned-reg) :target y))
(:results (y :scs (any-reg descriptor-reg)))
(:generator 20))
(define-move-vop move-from-unsigned :move
(unsigned-reg) (descriptor-reg))

(define-vop (word-move)
(:args (x :scs (signed-reg unsigned-reg) :target y))
@@ -28,7 +28,7 @@
(zero immediate-constant)

(control-stack control-stack)
(any-reg registers :alternate-scs (control-stack))
(any-reg registers :alternate-scs (control-stack) :constant-scs (immediate))
(descriptor-reg registers :alternate-scs (control-stack))
(non-descriptor-reg registers)

0 comments on commit 3da9509

Please sign in to comment.