0.8.9.18
[sbcl.git] / src / compiler / early-assem.lisp
1 ;;;; constants and types for assembly
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
11
12 (in-package "SB!ASSEM")
13
14 ;;; FIXME: It might make sense to use SB!VM:BYTE-FOO values here
15 ;;; instead of the various ASSEMBLY-UNIT-FOO things, and then define a
16 ;;; BYTE type. One problem: BYTE is exported from the CL package, so
17 ;;; ANSI says that we're not supposed to be attaching any new meanings
18 ;;; to it. Perhaps rename SB!VM:BYTE-FOO to SB!VM:VMBYTE-FOO or
19 ;;; SB!VM:VM-BYTE-FOO, and then define the SB!VM:VMBYTE or
20 ;;; SB!VM:VM-BYTE types?
21 ;;;
22 ;;; If this was done, some of this file could go away, and the rest
23 ;;; could probably be merged back into assem.lisp. (This file was
24 ;;; created simply in order to move the ASSEMBLY-UNIT-related
25 ;;; definitions before compiler/generic/core.lisp in the build
26 ;;; sequence.)
27
28 ;;; ASSEMBLY-UNIT-BITS -- the number of bits in the minimum assembly
29 ;;; unit, (also referred to as a ``byte''). Hopefully, different
30 ;;; instruction sets won't require changing this.
31 (def!constant assembly-unit-bits 8)
32 (def!constant assembly-unit-mask (1- (ash 1 assembly-unit-bits)))
33
34 (deftype assembly-unit ()
35   `(unsigned-byte ,assembly-unit-bits))
36
37 ;;; Some functions which accept assembly units can meaningfully accept
38 ;;; signed values with the same number of bits and silently munge them
39 ;;; into appropriate unsigned values. (This is handy behavior e.g.
40 ;;; when assembling branch instructions on the X86.)
41 (deftype possibly-signed-assembly-unit ()
42   `(or assembly-unit
43        (signed-byte ,assembly-unit-bits)))
44
45 ;;; the maximum alignment we can guarantee given the object format. If
46 ;;; the loader only loads objects 8-byte aligned, we can't do any
47 ;;; better then that ourselves.
48 (def!constant max-alignment sb!vm:n-lowtag-bits)
49
50
51 (deftype alignment ()
52   `(integer 0 ,max-alignment))