f1e3bc2da06f89ccc2585455264775abde61b0db
[sbcl.git] / src / compiler / alpha / memory.lisp
1 ;;; -*- Package: ALPHA -*-
2 ;;;
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
6 ;;;
7
8 ;;;
9 ;;; **********************************************************************
10 ;;;
11 ;;;    This file contains the Alpha definitions of some general purpose memory
12 ;;; reference VOPs inherited by basic memory reference operations.
13 ;;;
14 ;;; Written by Rob MacLachlan
15 ;;;
16 ;;; Converted by Sean Hallgren.
17 ;;; 
18
19 (in-package "SB!VM")
20
21
22
23 ;;; Cell-Ref and Cell-Set are used to define VOPs like CAR, where the offset to
24 ;;; be read or written is a property of the VOP used.
25 ;;;
26 (define-vop (cell-ref)
27   (:args (object :scs (descriptor-reg)))
28   (:results (value :scs (descriptor-reg any-reg)))
29   (:variant-vars offset lowtag)
30   (:policy :fast-safe)
31   (:generator 4
32     (loadw value object offset lowtag)))
33 ;;;
34 (define-vop (cell-set)
35   (:args (object :scs (descriptor-reg))
36          (value :scs (descriptor-reg any-reg null zero)))
37   (:variant-vars offset lowtag)
38   (:policy :fast-safe)
39   (:generator 4
40     (storew value object offset lowtag)))
41
42 ;;; Slot-Ref and Slot-Set are used to define VOPs like Closure-Ref, where the
43 ;;; offset is constant at compile time, but varies for different uses.  We add
44 ;;; in the stardard g-vector overhead.
45 ;;;
46 (define-vop (slot-ref)
47   (:args (object :scs (descriptor-reg)))
48   (:results (value :scs (descriptor-reg any-reg)))
49   (:variant-vars base lowtag)
50   (:info offset)
51   (:generator 4
52     (loadw value object (+ base offset) lowtag)))
53 ;;;
54 (define-vop (slot-set)
55   (:args (object :scs (descriptor-reg))
56          (value :scs (descriptor-reg any-reg null zero)))
57   (:variant-vars base lowtag)
58   (:info offset)
59   (:generator 4
60     (storew value object (+ base offset) lowtag)))