Debian Codegraph @

src/cmp/cmptypes.lsp

raw
1 ;;;; -*- Mode: Lisp; Syntax: Common-Lisp; indent-tabs-mode: nil; Package: C -*-
2 ;;;; vim: set filetype=lisp tabstop=8 shiftwidth=2 expandtab:
3
4 ;;;;
5 ;;;; Copyright (c) 2010, Juan Jose Garcia-Ripoll
6 ;;;;
7 ;;;; See file 'LICENSE' for the copyright details.
8
9 ;;;;
10 ;;;; CMPTYPES -- Data types for the Lisp core structures
11 ;;;;
12
13 (in-package "COMPILER")
14
15 (defstruct (info)
16 (local-vars nil) ;;; List of var-objects created directly in the form.
17 (type '(VALUES &REST T)) ;;; Type of the form.
18 (sp-change nil) ;;; Whether execution of the form may change
19 ;;; the value of a special variable.
20 (volatile nil) ;;; whether there is a possible setjmp. Beppe
21 )
22
23 (defstruct (c1form (:include info)
24 (:print-object print-c1form)
25 (:constructor do-make-c1form))
26 (name nil)
27 (parents nil)
28 (env (cmp-env-copy)) ;; Environment in which this form was compiled
29 (args '())
30 (side-effects nil) ;;; Does it have side effects
31 (form nil)
32 (toplevel-form nil)
33 (file nil)
34 (file-position 0))
35
36 (defun print-c1form (form stream)
37 (format stream "#<form ~A ~X>" (c1form-name form) (si:pointer form)))
38
39 (defvar *c1form-level* 0)
40 (defun print-c1forms (form)
41 (cond ((consp form)
42 (let ((*c1form-level* (1+ *c1form-level*)))
43 (mapc #'print-c1forms form)))
44 ((c1form-p form)
45 (format t "~% ~D > ~A, parent ~A" *c1form-level* form (c1form-parents form))
46 (print-c1forms (c1form-args form))
47 form)))