/[movitz]/ia-x86/alignment.lisp
ViewVC logotype

Contents of /ia-x86/alignment.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Tue Feb 10 00:03:09 2004 UTC (10 years, 2 months ago) by ffjeld
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
Designate the ia-x86 package with #:ia-x86 rather than "IA-X86".
Also, a few very minor edits.
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 ;;;;------------------------------------------------------------------
16
17 (in-package #:ia-x86)
18
19 (defclass alignment ()
20 ((type
21 :initarg :type
22 :reader alignment-type)))
23
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 )))))
38
39

  ViewVC Help
Powered by ViewVC 1.1.5