1 ;;;;------------------------------------------------------------------
3 ;;;; Copyright (C) 2001-2002, 2004,
4 ;;;; Department of Computer Science, University of Tromso, Norway.
6 ;;;; For distribution policy, see the accompanying file COPYING.
8 ;;;; Filename: alignment.lisp
10 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
11 ;;;; Created at: Wed Apr 10 12:47:08 2002
13 ;;;; $Id: alignment.lisp,v 1.3 2004/02/10 00:03:09 ffjeld Exp $
15 ;;;;------------------------------------------------------------------
19 (defclass alignment
()
22 :reader alignment-type
)))
24 (defmethod create-alignment ((alignment alignment
) pc
)
25 (ecase (first (alignment-type alignment
))
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
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
))
35 (when (< 8 (mod pc
16))
36 (nthcdr (mod pc
16) '#.
(make-list 16 :initial-element
#c
(#x90
1))))