Have sign-extend-complex deal correctly with bytes of size 0.
[movitz-ia-x86.git] / alignment.lisp
blob45fcbfbea74c0b576491854ba5964e845ad8d7ee
1 ;;;;------------------------------------------------------------------
2 ;;;;
3 ;;;; Copyright (C) 2001-2002, 2004,
4 ;;;; Department of Computer Science, University of Tromso, Norway.
5 ;;;;
6 ;;;; For distribution policy, see the accompanying file COPYING.
7 ;;;;
8 ;;;; Filename: alignment.lisp
9 ;;;; Description:
10 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
11 ;;;; Created at: Wed Apr 10 12:47:08 2002
12 ;;;;
13 ;;;; $Id: alignment.lisp,v 1.3 2004/02/10 00:03:09 ffjeld Exp $
14 ;;;;
15 ;;;;------------------------------------------------------------------
17 (in-package #:ia-x86)
19 (defclass alignment ()
20 ((type
21 :initarg :type
22 :reader alignment-type)))
24 (defmethod create-alignment ((alignment alignment) pc)
25 (ecase (first (alignment-type alignment))
26 (:code
27 ;; For optimal performance across the Intel Architecture family, it is recommended that:
28 ;; * Loop entry labels should be 16-byte aligned when less than eight bytes away from a
29 ;; 16-byte boundary.
30 ;; * Labels that follow a conditional branch should not be aligned.
31 ;; * Labels that follow an unconditional branch or function call should be 16-byte aligned
32 ;; when less than eight bytes away from a 16-byte boundary.
33 (ecase (second (alignment-type alignment))
34 (:loop
35 (when (< 8 (mod pc 16))
36 (nthcdr (mod pc 16) '#.(make-list 16 :initial-element #c(#x90 1))))
37 )))))