Have sign-extend-complex deal correctly with bytes of size 0.
[movitz-ia-x86.git] / symtab.lisp
blobaea7ab13706d2c3de211ce304ffee46f68d8bc6b
1 ;;;;------------------------------------------------------------------
2 ;;;;
3 ;;;; Copyright (C) 2000, 2004,
4 ;;;; Department of Computer Science, University of Tromso, Norway
5 ;;;;
6 ;;;; Filename: symtab.lisp
7 ;;;; Description: Assembly symbolic lookups.
8 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
9 ;;;; Created at: Tue Aug 22 10:01:38 2000
10 ;;;; Distribution: See the accompanying file COPYING.
11 ;;;;
12 ;;;; $Id: symtab.lisp,v 1.3 2004/02/10 00:04:19 ffjeld Exp $
13 ;;;;
14 ;;;;------------------------------------------------------------------
16 (in-package #:ia-x86)
18 ;;; A symtab is a stack-organized list of "frames", where each frame
19 ;;; is a hash-table.
21 (define-condition unresolved-labels ()
22 ((labels :initarg labels
23 :reader unresolved-labels-labels))
24 (:report (lambda (condition stream)
25 (format stream "Unable to resolve labels ~A."
26 (unresolved-labels-labels condition)))))
28 (defun make-symtab ()
29 nil)
31 (defun symtab-add-frame (symtab)
32 symtab)
34 (defun symtab-lookup-label (symtab label)
35 (or (symtab-try-lookup-label symtab label)
36 (error 'unresolved-labels 'labels (list label))))
38 (defun symtab-try-lookup-label (symtab label)
39 (declare (special *symtab-lookup*))
40 (or (cdr (assoc label symtab))
41 (if (and (boundp '*symtab-lookup*)
42 *symtab-lookup*)
43 (funcall *symtab-lookup* label)
44 nil)))
46 (defun symtab-def-label (symtab label value)
47 (when (symtab-try-lookup-label symtab label)
48 (error "Label ~A multiply defined." label))
49 (acons label value symtab))
51 (defun symtab-collapse-frames (symtab)
52 symtab)