/[cmucl]/src/tools/comcom.lisp
ViewVC logotype

Contents of /src/tools/comcom.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.57.22.1 - (hide annotations)
Fri Sep 26 18:56:43 2008 UTC (5 years, 6 months ago) by rtoy
Branch: sse2-branch
Changes since 1.57: +10 -1 lines
Initial support for SSE2.  This compiles itself ok on Linux, and
should work on OSX.  Much cleanup is needed, and still need to restore
buildability without SSE2.

Use bootfiles/19e/boot-2008-09-sse2.lisp as the cross-compile script.

The key changes are in these new files:

o float-sse2.lisp: implements all of the floating-point stuff with
  SSE2
o sse2-array.lisp: replacement vops using sse2 instead of x87
o sse2-c-call.lisp: replacement vops using sse2 instead of x87.
o sse2-sap.lisp: replacement vops using sse2 instead of x87



code/irrat.lisp:
o Basically turn off all the special routines that use the x87 trig,
  log, or exp instructions.  We don't support that currently.  (Would
  be nice, though.)
o Turn on %%sin and friends, like on ppc.
o Turn off %sin-quick and friends since we don't want to use x87 now.

code/misc.lisp:
o Register :sse2 feature.

compiler/float-tran.lisp:
o Disable transforms for x86 that use x87 instructions.  We don't
  support that with sse2.

compiler/loadbackend.lisp:
o Load up the appropriate sse2 files for the compiler.  This will
  currently overwrite existing vops with vops for SSE2.

compiler/x86/float.lisp:
o Disable various vops using the x87 instructions, since
  float-sse2.lisp doesn't have equivalents.  (Just in case.  Since
  this isn't compiled or loaded, we shouldn't need to do this.)

compiler/x86/insts.lisp:
o Add support for SSE2 instructions.  Shamelessly borrowed from our
  SBCL friends.

compiler/x86/vm.lisp:
o Turn off some fp-constants that are not supported with sse2.
o Print FP registers as XMM instead of FR.

lisp/Config.linux_gencgc:
lisp/Config.x86_darwin:
o Enable FEATURE_SSE2 flag when compiling.

lisp/Darwin-os.c:
lisp/Linux-os.c:
o Get the mxcsr status bits too when getting the FPU status from a
  sigcontext.

lisp/x86-assem.S:
o For SSE2, we copy any floating-point result (in ST(0)) to XMM0, so
  Lisp code can get it.

tools/comcom.lisp:
o Compile up the SSE2 files as needed.
1 toy 1.56 ;;; -*- Package: CL-USER -*-
2 wlott 1.1 ;;;
3 dtc 1.51 ;;; **********************************************************************
4     ;;;
5     (ext:file-comment
6 rtoy 1.57.22.1 "$Header: /tiger/var/lib/cvsroots/cmucl/src/tools/comcom.lisp,v 1.57.22.1 2008/09/26 18:56:43 rtoy Exp $")
7 dtc 1.51 ;;;
8     ;;; **********************************************************************
9     ;;;
10 emarsden 1.54 ;;; Loading this file causes the CMUCL compiler to be compiled.
11     ;;;
12 gerd 1.55 (in-package "CL-USER")
13 wlott 1.1
14 ram 1.12 #+bootstrap
15 ram 1.36 (copy-packages (cons (c::backend-name c::*target-backend*) '("NEW-ASSEM" "C")))
16 ram 1.9
17 ram 1.39 (defvar *load-stuff*
18 wlott 1.35 #+bootstrap t
19     #-bootstrap (eq c:*backend* c:*native-backend*))
20 wlott 1.13
21 ram 1.44 (defvar *byte-compile* #+small t #-small :maybe)
22 toy 1.52
23     (unless (find-package "OLD-C")
24     (rename-package "C" "C" '("OLD-C")))
25 ram 1.44
26 emarsden 1.54 ;;; Import so that these types which appear in the globaldb are the same...
27 ram 1.12 #+bootstrap
28     (import '(old-c::approximate-function-type
29     old-c::function-info old-c::defstruct-description
30     old-c::defstruct-slot-description)
31     "C")
32 wlott 1.1
33 ram 1.48
34 ram 1.16 (with-compiler-log-file
35     ("target:compile-compiler.log"
36     :optimize
37     '(optimize (speed 2) (space 2) (inhibit-warnings 2)
38     (safety #+small 0 #-small 1)
39 ram 1.42 (debug #+small .5 #-small 2))
40 ram 1.16 :optimize-interface
41     '(optimize-interface (safety #+small 1 #-small 2)
42 ram 1.42 (debug #+small .5 #-small 2))
43 ram 1.16 :context-declarations
44     '(#+small
45     ((:or :macro
46     (:match "$SOURCE-TRANSFORM-" "$IR1-CONVERT-"
47     "$PRIMITIVE-TRANSLATE-" "$PARSE-"))
48     (declare (optimize (safety 1))))
49 ram 1.46 ((:or :macro (:match "$%PRINT-"))
50 ram 1.45 (declare (optimize (speed 0))))
51 ram 1.42 (:external (declare (optimize-interface (safety 2) (debug 1))))))
52 wlott 1.1
53 toy 1.56
54     (setf lisp::*enable-package-locked-errors* nil)
55 ram 1.48
56 dtc 1.50 (comf "target:compiler/macros"
57 dtc 1.49 :byte-compile #+bootstrap t #-bootstrap *byte-compile*)
58 dtc 1.50 (when *load-stuff*
59     (load "target:compiler/macros"))
60 ram 1.48
61 dtc 1.50 (comf "target:compiler/generic/vm-macs" :proceed t
62 ram 1.48 :byte-compile #+bootstrap t #-bootstrap nil)
63 dtc 1.50 (when *load-stuff*
64     (load "target:compiler/generic/vm-macs"))
65 ram 1.48
66 dtc 1.50 (comf "target:compiler/backend" :proceed t
67 ram 1.48 :byte-compile #+bootstrap t #-bootstrap nil)
68 dtc 1.50 (when *load-stuff*
69     (load "target:compiler/backend"))
70 wlott 1.1
71 ram 1.12 (defvar c::*target-backend* (c::make-backend))
72 wlott 1.1
73 ram 1.44 (comf (vmdir "target:compiler/parms") :proceed t)
74 moore 1.53 ;(when *load-stuff*
75     ; (load (vmdir "target:compiler/parms")))
76 ram 1.48
77 wlott 1.17 (comf "target:compiler/generic/objdef" :proceed t)
78 wlott 1.27 (comf "target:compiler/generic/interr")
79 wlott 1.1
80 ram 1.12 (comf "target:code/struct") ; For defstruct description structures.
81     (comf "target:compiler/proclaim") ; For COOKIE structure.
82     (comf "target:compiler/globals")
83 wlott 1.1
84 ram 1.12 (comf "target:compiler/sset")
85 ram 1.43 (comf "target:compiler/bit-util")
86 ram 1.12 (comf "target:compiler/node")
87     (comf "target:compiler/ctype")
88     (comf "target:compiler/vop" :proceed t)
89 wlott 1.34 (comf "target:compiler/vmdef")
90 ram 1.48
91 dtc 1.49 #-bootstrap
92 ram 1.44 (comf "target:compiler/meta-vmdef" :proceed t)
93 ram 1.48 #+bootstrap ;; pw adds
94     (comf "target:compiler/meta-vmdef" :byte-compile t)
95 ram 1.44 (when *load-stuff*
96     (load "target:compiler/meta-vmdef"))
97     (comf "target:compiler/disassem" :byte-compile *byte-compile*)
98 wlott 1.28 (comf "target:compiler/new-assem")
99 moore 1.53 (when *load-stuff*
100     (load "target:compiler/new-assem"))
101 ram 1.12 (comf "target:compiler/alloc")
102     (comf "target:compiler/knownfun")
103     (comf "target:compiler/fndb")
104     (comf "target:compiler/generic/vm-fndb")
105     (comf "target:compiler/main")
106 wlott 1.1
107 ram 1.16 (with-compilation-unit
108 ram 1.47 (:optimize '(optimize (safety 1)))
109     (comf "target:compiler/ir1tran"))
110    
111     (with-compilation-unit
112     (:optimize '(optimize (debug 2)))
113 ram 1.16 (comf "target:compiler/ir1util")
114     (comf "target:compiler/ir1opt"))
115    
116 rtoy 1.57 (comf "target:compiler/loop")
117 ram 1.12 (comf "target:compiler/ir1final")
118 ram 1.48 ;;try(comf "target:compiler/srctran")
119 ram 1.44 (comf "target:compiler/array-tran" :byte-compile *byte-compile*)
120     (comf "target:compiler/seqtran" :byte-compile *byte-compile*)
121     (comf "target:compiler/typetran" :byte-compile *byte-compile*)
122     (comf "target:compiler/generic/vm-typetran" :byte-compile *byte-compile*)
123     (comf "target:compiler/float-tran" :byte-compile *byte-compile*)
124     (comf "target:compiler/saptran" :byte-compile *byte-compile*)
125 ram 1.48 (comf "target:compiler/srctran") ;; try
126 ram 1.12 (comf "target:compiler/locall")
127     (comf "target:compiler/dfo")
128     (comf "target:compiler/checkgen")
129     (comf "target:compiler/constraint")
130     (comf "target:compiler/envanal")
131 ram 1.6
132 ram 1.48
133 ram 1.12 (comf "target:compiler/tn")
134     (comf "target:compiler/life")
135 ram 1.4
136 ram 1.12 (comf "target:code/debug-info")
137 ram 1.4
138 ram 1.12 (comf "target:compiler/debug-dump")
139     (comf "target:compiler/generic/utils")
140 dtc 1.49 #-bootstrap
141 ram 1.44 (comf "target:assembly/assemfile")
142 ram 1.48 #+bootstrap
143     (comf "target:assembly/assemfile" :byte-compile t)
144 ram 1.44 (when *load-stuff* (load "target:assembly/assemfile"))
145 ram 1.48
146    
147 ram 1.16 (with-compilation-unit
148 ram 1.44 (:optimize '(optimize (safety #+small 0 #-small 1) #+small (debug 0)))
149 ram 1.16
150 dtc 1.50 #+original
151 ram 1.48 (progn ; this is distributed order
152     (comf (vmdir "target:compiler/insts"))
153     (comf (vmdir "target:compiler/macros") :load *load-stuff*)
154     (comf (vmdir "target:compiler/vm")))
155 dtc 1.50 #+original
156 ram 1.48 (progn ; this works for x86
157     (comf (vmdir "target:compiler/vm"))
158     (comf (vmdir "target:compiler/macros") :load *load-stuff*)
159     (comf (vmdir "target:compiler/insts")))
160 dtc 1.50 #-tryit
161     (progn ; this also works - better??
162 ram 1.48 (comf (vmdir "target:compiler/vm"))
163     (comf (vmdir "target:compiler/insts"))
164 dtc 1.50 (comf (vmdir "target:compiler/macros")
165 ram 1.48 :byte-compile #+bootstrap t #-bootstrap nil)
166 dtc 1.50 (when *load-stuff*
167     (load (vmdir "target:compiler/macros")))
168     )
169 ram 1.48
170 ram 1.44 (comf "target:compiler/generic/primtype")
171 dtc 1.50 (comf (vmdir "target:assembly/support")
172 ram 1.48 :byte-compile #+bootstrap t #-bootstrap nil) ; pw
173 dtc 1.50 (when *load-stuff*
174     (load (vmdir "target:assembly/support")))
175 ram 1.44 (comf (vmdir "target:compiler/move"))
176     (comf (vmdir "target:compiler/float") :byte-compile *byte-compile*)
177 rtoy 1.57.22.1 (when (c:target-featurep :sse2)
178     (comf (vmdir "target:compiler/float-sse2")
179     :byte-compile *byte-compile*))
180 ram 1.44 (comf (vmdir "target:compiler/sap") :byte-compile *byte-compile*)
181 rtoy 1.57.22.1 (when (c:target-featurep :sse2)
182     (comf (vmdir "target:compiler/sse2-sap") :byte-compile *byte-compile*))
183 ram 1.44 (comf (vmdir "target:compiler/system") :byte-compile *byte-compile*)
184     (comf (vmdir "target:compiler/char") :byte-compile *byte-compile*)
185     (comf (vmdir "target:compiler/memory"))
186     (comf (vmdir "target:compiler/static-fn"))
187     (comf (vmdir "target:compiler/arith"))
188     (comf (vmdir "target:compiler/subprim") :byte-compile *byte-compile*)
189 ram 1.48
190 ram 1.44 (comf (vmdir "target:compiler/debug") :byte-compile *byte-compile*)
191     (comf (vmdir "target:compiler/c-call") :byte-compile *byte-compile*)
192 rtoy 1.57.22.1 (when (c:target-featurep :sse2)
193     (comf (vmdir "target:compiler/sse2-c-call") :byte-compile *byte-compile*))
194 ram 1.44 (comf (vmdir "target:compiler/cell"))
195     (comf (vmdir "target:compiler/values") :byte-compile *byte-compile*)
196     (comf (vmdir "target:compiler/alloc"))
197     (comf (vmdir "target:compiler/call"))
198     (comf (vmdir "target:compiler/nlx") :byte-compile *byte-compile*)
199     (comf (vmdir "target:compiler/print") :byte-compile *byte-compile*)
200     (comf (vmdir "target:compiler/array") :byte-compile *byte-compile*)
201 rtoy 1.57.22.1 (when (c:target-featurep :sse2)
202     (comf (vmdir "target:compiler/sse2-array") :byte-compile *byte-compile*))
203 ram 1.44 (comf (vmdir "target:compiler/pred"))
204     (comf (vmdir "target:compiler/type-vops") :byte-compile *byte-compile*)
205 wlott 1.1
206 ram 1.44 (comf (vmdir "target:assembly/assem-rtns") :byte-compile *byte-compile*)
207     (comf (vmdir "target:assembly/array") :byte-compile *byte-compile*)
208     (comf (vmdir "target:assembly/arith"))
209     (comf (vmdir "target:assembly/alloc"))
210 wlott 1.1
211 ram 1.12 (comf "target:compiler/pseudo-vops")
212 ram 1.14
213 ram 1.16 ); with-compilation-unit for back end.
214 wlott 1.1
215 ram 1.44 (comf "target:compiler/aliencomp" :byte-compile *byte-compile*)
216 ram 1.48
217 wlott 1.21 (comf "target:compiler/ltv")
218 ram 1.12 (comf "target:compiler/gtn")
219 ram 1.16 (with-compilation-unit
220 ram 1.47 (:optimize '(optimize (debug 2)))
221 ram 1.16 (comf "target:compiler/ltn"))
222 ram 1.12 (comf "target:compiler/stack")
223     (comf "target:compiler/control")
224     (comf "target:compiler/entry")
225 ram 1.16 (with-compilation-unit
226 ram 1.47 (:optimize '(optimize (debug 2)))
227 wlott 1.38 (comf "target:compiler/ir2tran")
228     (comf "target:compiler/generic/vm-ir2tran"))
229 ram 1.12 (comf "target:compiler/copyprop")
230 ram 1.16 (with-compilation-unit
231 ram 1.47 (:optimize '(optimize (debug 2)))
232 ram 1.16 (comf "target:compiler/represent"))
233 ram 1.12 (comf "target:compiler/generic/vm-tran")
234 ram 1.16 (with-compilation-unit
235 ram 1.47 (:optimize '(optimize (debug 2)))
236 ram 1.16 (comf "target:compiler/pack"))
237 ram 1.12 (comf "target:compiler/codegen")
238 ram 1.23 (with-compilation-unit
239 ram 1.42 (:optimize '(optimize (debug 2) (safety 2)))
240 emarsden 1.54 (comf "target:compiler/debug" :byte-compile *byte-compile*)
241     (comf "target:compiler/xref" :byte-compile *byte-compile*))
242 ram 1.44 #+nil
243 ram 1.12 (comf "target:compiler/statcount")
244     (comf "target:compiler/dyncount")
245 ram 1.3
246 ram 1.12 (comf "target:compiler/dump")
247 wlott 1.1
248 ram 1.12 (comf "target:compiler/generic/core")
249 wlott 1.37 (comf "target:compiler/generic/new-genesis")
250 wlott 1.1
251 ram 1.12 (comf "target:compiler/eval-comp")
252     (comf "target:compiler/eval")
253 ram 1.40 (comf "target:compiler/byte-comp")
254 wlott 1.1
255     ); with-compiler-error-log

  ViewVC Help
Powered by ViewVC 1.1.5