-
Notifications
You must be signed in to change notification settings - Fork 313
/
describe-policy.lisp
36 lines (32 loc) · 1.62 KB
/
describe-policy.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;;; DESCRIBE-COMPILER-POLICY
;;;; This software is part of the SBCL system. See the README file for
;;;; more information.
;;;;
;;;; This software is derived from the CMU CL system, which was
;;;; written at Carnegie Mellon University and released into the
;;;; public domain. The software is in the public domain and is
;;;; provided with absolutely no warranty. See the COPYING and CREDITS
;;;; files for more information.
(in-package "SB-C")
(defun describe-compiler-policy (&optional spec)
"Print all global optimization settings, augmented by SPEC."
(let ((policy (process-optimize-decl (cons 'optimize spec) *policy*)))
(fresh-line)
(format t " Basic qualities:~%")
(dovector (quality +policy-primary-qualities+)
(format t "~S = ~D~%" quality (policy-quality policy quality)))
(format t " Dependent qualities:~%")
(loop for info across **policy-dependent-qualities**
for quality = (policy-dependent-quality-name info)
for values-documentation = (policy-dependent-quality-values-documentation info)
for explicit-value = (policy-quality policy quality)
do (if (= explicit-value 1)
(let* ((getter (policy-dependent-quality-getter info))
(value (funcall getter policy))
(documentation (elt values-documentation value)))
(format t "~S = ~D -> ~D (~A)~%"
quality explicit-value value documentation))
(let ((documentation (elt values-documentation explicit-value)))
(format t "~S = ~D (~A)~%"
quality explicit-value documentation)))))
(values))