summaryrefslogtreecommitdiff
path: root/module/scripts
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-01-05 09:54:03 +0100
committerAndy Wingo <wingo@pobox.com>2018-01-05 10:19:54 +0100
commit16db934bbcac87c1a41557af18ae875d395c63c2 (patch)
tree8f5bb2e9887b56a1548d69408e808a7e8835a5d2 /module/scripts
parent118f516a8b24ddbfd425603312da351fa8197a5c (diff)
downloadguile-16db934bbcac87c1a41557af18ae875d395c63c2.tar.gz
Add (system base optimize) module
* module/system/base/optimize.scm: New module. * module/Makefile.am (SOURCES): * am/bootstrap.am (SOURCES): Add new module. * module/language/tree-il/optimize.scm (tree-il-optimizations): Rename from tree-il-default-optimization-options. Directly specify the optimization level at which a pass should be enabled. * module/language/cps/optimize.scm (cps-optimizations): Likewise, rename from cps-default-optimization-options. * module/scripts/compile.scm (%options, show-optimization-help): Adapt to use new module.
Diffstat (limited to 'module/scripts')
-rw-r--r--module/scripts/compile.scm26
1 files changed, 5 insertions, 21 deletions
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index 939fb2564..26c79f1ee 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -1,6 +1,6 @@
;;; Compile --- Command-line Guile Scheme compiler -*- coding: iso-8859-1 -*-
-;; Copyright 2005, 2008-2011, 2013, 2014, 2015 Free Software Foundation, Inc.
+;; Copyright 2005, 2008-2011, 2013, 2014, 2015, 2018 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
@@ -32,8 +32,7 @@
#:use-module ((system base compile) #:select (compile-file))
#:use-module (system base target)
#:use-module (system base message)
- #:use-module (language tree-il optimize)
- #:use-module (language cps optimize)
+ #:use-module (system base optimize)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-13)
#:use-module (srfi srfi-37)
@@ -48,20 +47,6 @@
(format (current-error-port) "error: ~{~a~}~%" messages)
(exit 1))
-(define (available-optimizations)
- (append (tree-il-default-optimization-options)
- (cps-default-optimization-options)))
-
-;; Turn on all optimizations unless -O0.
-(define (optimizations-for-level level)
- (let lp ((options (available-optimizations)))
- (match options
- (() '())
- ((#:partial-eval? val . options)
- (cons* #:partial-eval? (> level 0) (lp options)))
- ((kw val . options)
- (cons* kw (> level 1) (lp options))))))
-
(define %options
;; Specifications of the command-line options.
(list (option '(#\h "help") #f #f
@@ -101,7 +86,7 @@
(define (return-option name val)
(let ((kw (symbol->keyword
(string->symbol (string-append name "?")))))
- (unless (memq kw (available-optimizations))
+ (unless (assq kw (available-optimizations))
(fail "Unknown optimization pass `~a'" name))
(return (list kw val))))
(cond
@@ -170,11 +155,10 @@ There is NO WARRANTY, to the extent permitted by law.~%"))
(let lp ((options (available-optimizations)))
(match options
(() #t)
- ((kw val . options)
+ (((kw level) . options)
(let ((name (string-trim-right (symbol->string (keyword->symbol kw))
#\?)))
- (format #t " -O~a~%"
- (if val name (string-append "no-" name)))
+ (format #t " -O~a~%" name)
(lp options)))))
(format #t "~%")
(format #t "To disable an optimization, prepend it with `no-', for example~%")