Tweaks to get sb-simd 1.3 to compile
[sbcl/simd.git] / src / compiler / policies.lisp
blob1ee4f10340b923f6f5fbb88609a7bf3c114d9bd2
1 ;;;; aimed optimization qualities
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!C")
14 (define-optimization-quality type-check
15 ;; FIXME: grepping the tree for "policy.*safety" yields some
16 ;; places which might want to use this instead -- or
17 ;; some other derived policy.
18 (cond ((= safety 0) 0)
19 ((and (< safety 2) (< safety speed)) 2)
20 (t 3))
21 ("no" "maybe" "weak" "full")
22 "Control the way to perform runtime type checking:
23 0: declared types are simply trusted; no runtime checks are performed;
24 2: fast checks are performed: declared types are weakened to
25 FIXNUM/SINGLE-FLOAT/FLOAT/NUMBER/structure/specialized array etc.;
26 3: declared types are fully checked (several exceptions exist;
27 see \"SBCL User Manual\", Compiler->Handling of Types->
28 Implementation Limitations for details).")
30 (define-optimization-quality check-tag-existence
31 (cond ((= safety 0) 0)
32 (t 3))
33 ("no" "maybe" "yes" "yes")
34 "Control whether GO and RETURN-FROM check liveness of the destination tag.
35 Enabling this option can increase heap consing of closures.")
37 (define-optimization-quality let-conversion
38 (if (<= debug speed) 3 0)
39 ("off" "maybe" "on" "on")
40 "Control inline-substitution of used-once local functions.")
42 (define-optimization-quality verify-arg-count
43 (if (zerop safety) 0 3)
44 ("no" "maybe" "yes" "yes"))
46 (define-optimization-quality merge-tail-calls
47 (if (or (> space debug)
48 (> speed debug))
51 ("no" "maybe" "yes" "yes")
52 "Control whether tail-calls should reuse caller stack frame.
53 Enabling this option make functions use less stack space, and make
54 tail-recursive functions execute in constant stack, but debugging
55 become harder, because backtraces show only part of function call
56 sequence.
58 This options has no effect when INSERT-DEBUG-CATCH is set.")
60 (define-optimization-quality insert-debug-catch
61 (if (> debug (max speed space))
64 ("no" "maybe" "yes" "yes")
65 "Enable possibility of returning from stack frames with the debugger.
67 Enabling this option effectively disables MERGE-TAIL-CALLS.")
69 (define-optimization-quality recognize-self-calls
70 (if (> (max speed space) debug)
73 ("no" "maybe" "yes" "yes")
74 "When enabled, reference to a function FOO inside the body of (DEFUN
75 FOO ...) is considered to be the reference to the function being
76 defined. Calls to FOO are compiled as local. This allows better
77 optimization and type checking, but TRACE will not show recursive
78 calls. If the function object is bound to another name BAR, and FOO is
79 bound to another function, calls to FOO inside BAR will remain to be
80 recursive.
82 When disabled, internal references to a function FOO will be
83 considered ti be a call of a function, bound to the symbol at
84 run-time, which is less efficient. TRACE will show recursive calls. In
85 case of renaming described above, calls to FOO will not be recursive
86 and will refer to the new function, bound to FOO.")
88 (define-optimization-quality stack-allocate-dynamic-extent
89 (if (and (> (max speed space) (max debug safety))
90 (< safety 3))
93 ("no" "maybe" "yes" "yes")
94 "Control whether allocate objects, declared DYNAMIC-EXTENT, on
95 stack.")
97 (define-optimization-quality stack-allocate-vector
98 (cond ((= stack-allocate-dynamic-extent 0) 0)
99 ((= safety 0) 3)
100 (t 2))
101 ("no" "maybe" "one page" "yes")
102 "Control what vectors, declared DYNAMIC-EXTENT, are allocated on stack:
103 0: no vectors are allocated on stack;
104 2: only short vectors (compiler knows them to fit on one page);
105 3: every.
107 This option has an effect only when STACK-ALLOCATE-DYNAMIC-EXTENT is
108 set.")
110 (define-optimization-quality float-accuracy
112 ("degraded" "full" "full" "full"))
114 (define-optimization-quality insert-step-conditions
115 (if (> debug (max speed space compilation-speed))
116 debug
118 ("no" "no" "partial" "full")
119 "Control instrumentation of code, enabling single-stepping through
120 it in the debugger.
122 This option has no effect without COMPUTE-DEBUG-FUN.")
124 (define-optimization-quality compute-debug-fun
125 debug
126 ("no" "minimal" "yes" "yes"))
128 (define-optimization-quality preserve-single-use-debug-variables
129 (if (and (>= debug 2)
130 (< speed 3))
133 ("no" "no" "no" "yes")
134 "When disabled, LET variable, which is never set and is referenced
135 exactly once, is eliminated and the reference is substituted with the
136 initial value. This allows better type inference and some algebraic
137 optimizations.
139 When enabled, the variable is preserved and can be seen in the
140 debugger.")
142 (define-optimization-quality insert-array-bounds-checks
143 (if (= safety 0) 0 3)
144 ("no" "yes" "yes" "yes"))
146 (define-optimization-quality store-xref-data
147 (if (= space 3)
150 ("no" "yes" "yes" "yes"))
152 (define-optimization-quality store-coverage-data
154 ("no" "no" "yes" "yes"))