close Warning: Can't use blame annotator:
No changeset 4032 in the repository

source: branches/acode-rewrite/source/compiler/PPC/PPC32/ppc32-backend.lisp

Last change on this file was 15997, checked in by Gary Byers, 11 years ago

Try to clean up some cross-compilation issues, get new type stuff
a little further along on PPC.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
RevLine 
1;;;-*- Mode: Lisp; Package: CCL -*-
2;;;
3;;; Copyright (C) 2009 Clozure Associates
4;;; Copyright (C) 1994-2001 Digitool, Inc
5;;; This file is part of Clozure CL.
6;;;
7;;; Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
8;;; License , known as the LLGPL and distributed with Clozure CL as the
9;;; file "LICENSE". The LLGPL consists of a preamble and the LGPL,
10;;; which is distributed with Clozure CL as the file "LGPL". Where these
11;;; conflict, the preamble takes precedence.
12;;;
13;;; Clozure CL is referenced in the preamble as the "LIBRARY."
14;;;
15;;; The LLGPL is also available online at
16;;; http://opensource.franz.com/preamble.html
17(in-package "CCL")
18(eval-when (:compile-toplevel :load-toplevel :execute)
19 (require "BACKEND"))
20
21(eval-when (:compile-toplevel :execute)
22 (require "NXENV")
23 (require "PPCENV")
24 (require "PPC32-ARCH"))
25
26
27
28
29
30(defvar *ppc32-vinsn-templates* (make-hash-table :test #'eq))
31
32
33
34
35(defvar *known-ppc32-backends* ())
36
37
38#+linuxppc-target
39(defvar *linuxppc32-backend*
40 (make-backend :lookup-opcode #'lookup-ppc-opcode
41 :lookup-macro #'ppc::ppc-macro-function
42 :lap-opcodes ppc::*ppc-opcodes*
43 :define-vinsn 'define-ppc-vinsn
44 :platform-syscall-mask (logior platform-os-linux platform-cpu-ppc)
45 :p2-dispatch *ppc2-specials*
46 :p2-vinsn-templates *ppc32-vinsn-templates*
47 :p2-template-hash-name '*ppc32-vinsn-templates*
48 :p2-compile 'ppc2-compile
49 :target-specific-features
50 '(:powerpc :ppc-target :eabi-target :linux-target :linuxppc-target :ppc32-target :32-bit-target :big-endian-target)
51 :target-fasl-pathname (make-pathname :type "pfsl")
52 :target-platform (logior platform-word-size-32
53 platform-cpu-ppc
54 platform-os-linux)
55 :target-os :linuxppc
56 :name :linuxppc32
57 :target-arch-name :ppc32
58 :target-foreign-type-data nil
59 :target-arch ppc32::*ppc32-target-arch*))
60
61
62#+darwinppc-target
63(defvar *darwinppc32-backend*
64 (make-backend :lookup-opcode #'lookup-ppc-opcode
65 :lookup-macro #'ppc::ppc-macro-function
66 :lap-opcodes ppc::*ppc-opcodes*
67 :define-vinsn 'define-ppc-vinsn
68 :platform-syscall-mask (logior platform-os-darwin platform-cpu-ppc)
69 :p2-dispatch *ppc2-specials*
70 :p2-vinsn-templates *ppc32-vinsn-templates*
71 :p2-template-hash-name '*ppc32-vinsn-templates*
72 :p2-compile 'ppc2-compile
73 :target-specific-features
74 '(:powerpc :ppc-target :darwin-target :darwinppc-target :ppc32-target :32-bit-target :big-endian-target)
75 :target-fasl-pathname (make-pathname :type "dfsl")
76 :target-platform (logior platform-word-size-32
77 platform-cpu-ppc
78 platform-os-darwin)
79 :target-os :darwinppc
80 :name :darwinppc32
81 :target-arch-name :ppc32
82 :target-foreign-type-data nil
83 :target-arch ppc32::*ppc32-target-arch*))
84
85#+linuxppc-target
86(pushnew *linuxppc32-backend* *known-ppc32-backends* :key #'backend-name)
87
88
89#+darwinppc-target
90(pushnew *darwinppc32-backend* *known-ppc32-backends* :key #'backend-name)
91
92(defvar *ppc32-backend* (car *known-ppc32-backends*))
93
94(defun fixup-ppc32-backend ()
95 (dolist (b *known-ppc32-backends*)
96 (setf (backend-lap-opcodes b) ppc::*ppc-opcodes*
97 (backend-p2-dispatch b) *ppc2-specials*
98 (backend-p2-vinsn-templates b) *ppc32-vinsn-templates*)
99 (or (backend-lap-macros b) (setf (backend-lap-macros b)
100 (make-hash-table :test #'equalp)))))
101
102
103
104(fixup-ppc32-backend)
105
106#+ppc32-target
107(setq *host-backend* *ppc32-backend* *target-backend* *ppc32-backend*)
108#-ppc32-target
109(unless (backend-target-foreign-type-data *ppc32-backend*)
110 (let* ((ftd (make-ftd
111 :interface-db-directory
112 #+darwinppc-target "ccl:darwin-headers;"
113 #+linuxppc-target "ccl:headers;"
114 :interface-package-name
115 #+darwinppc-target "DARWIN32"
116 #+linuxppc-target "LINUX32"
117 :attributes
118 #+darwinppc-target
119 '(:signed-char t
120 :struct-by-value t
121 :prepend-underscores t
122 :bits-per-word 32
123 :poweropen-alignment t)
124 #+linuxppc-target
125 '(:bits-per-word 32)
126 :ff-call-expand-function
127 #+linuxppc-target
128 'linux32::expand-ff-call
129 #+darwinppc-target
130 'darwin32::expand-ff-call
131 :ff-call-struct-return-by-implicit-arg-function
132 #+linuxppc-target
133 'linux32::record-type-returns-structure-as-first-arg
134 #+darwinppc-target
135 'darwin32::record-type-returns-structure-as-first-arg
136 :callback-bindings-function
137 #+linuxppc-target
138 'linux32::generate-callback-bindings
139 #+darwinppc-target
140 'darwin32::generate-callback-bindings
141 :callback-return-value-function
142 #+linuxppc-target
143 'linux32::generate-callback-return-value
144 #+darwinppc-target
145 'darwin32::generate-callback-return-value
146 )))
147 (install-standard-foreign-types ftd)
148 (use-interface-dir :libc ftd)
149 (setf (backend-target-foreign-type-data *ppc32-backend*) ftd)))
150
151
152(pushnew *ppc32-backend* *known-backends* :key #'backend-name)
153
154#+ppc32-target
155(require "PPC32-VINSNS")
156(provide "PPC32-BACKEND")
Note: See TracBrowser for help on using the repository browser.