source: trunk/source/compiler/subprims.lisp

Last change on this file was 16685, checked in by rme, 5 years ago

Update copyright/license headers in files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1;;;-*- Mode: Lisp; Package: CCL -*-
2;;;
3;;; Copyright 1994-2009 Clozure Associates
4;;;
5;;; Licensed under the Apache License, Version 2.0 (the "License");
6;;; you may not use this file except in compliance with the License.
7;;; You may obtain a copy of the License at
8;;;
9;;;     http://www.apache.org/licenses/LICENSE-2.0
10;;;
11;;; Unless required by applicable law or agreed to in writing, software
12;;; distributed under the License is distributed on an "AS IS" BASIS,
13;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14;;; See the License for the specific language governing permissions and
15;;; limitations under the License.
16
17(in-package "CCL")
18
19(defstruct subprimitive-info
20  name
21  offset
22  platform-info
23  argument-mask
24  registers-used
25  )
26
27(defmethod make-load-form ((s subprimitive-info) &optional env)
28  (make-load-form-saving-slots s :environment env))
29
30(defmethod print-object ((s subprimitive-info) stream)
31  (print-unreadable-object (s stream :type t)
32    (format stream "~A @ #x~x" 
33            (subprimitive-info-name s)
34            (subprimitive-info-offset s))))
35
36(defun %subprim-name->offset (name table)
37  (let* ((sprec (find name table 
38                      :test #'string-equal 
39                      :key #'subprimitive-info-name)))
40    (if sprec
41      (subprimitive-info-offset sprec)
42      (error "subprim named ~s not found." name))))
43
44(defun backend-real-subprims-bias (backend)
45  (let* ((b (backend-lowmem-bias backend)))
46    (if (atom b) b (cdr b))))
47
48(defun subprim-name->offset (name &optional (backend *target-backend*))
49  ;; Don't care about speed, but for bootstrapping reasons avoid typechecking
50  ;; against symbols in the arch package.
51  (declare (optimize (speed 3) (safety 0)))
52  (+ (backend-real-subprims-bias backend)
53     (%subprim-name->offset name  (arch::target-subprims-table
54                                   (backend-target-arch backend)))))
55
56(provide "SUBPRIMS")
Note: See TracBrowser for help on using the repository browser.