mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +02:00
Wire up `guild compile -O0 foo.scm'
* module/scripts/compile.scm (%options): Resurrect -O option and make it follow GCC, more or less. The default is equivalent to -O2. * module/language/cps/compile-bytecode.scm (lower-cps): * module/language/cps/optimize.scm (optimize-higher-order-cps): Move split-rec to run unconditionally for now, as closure conversion fails without it. (define-optimizer): Only verify the result if we are debugging, to save time. (cps-default-optimization-options): New exported procedure. * module/language/tree-il/optimize.scm (tree-il-default-optimization-options): New exported procedure.
This commit is contained in:
parent
2d4da30fde
commit
f169be9fc8
4 changed files with 105 additions and 15 deletions
|
@ -34,6 +34,7 @@
|
|||
#:use-module (language cps optimize)
|
||||
#:use-module (language cps reify-primitives)
|
||||
#:use-module (language cps renumber)
|
||||
#:use-module (language cps split-rec)
|
||||
#:use-module (language cps intmap)
|
||||
#:use-module (language cps intset)
|
||||
#:use-module (system vm assembler)
|
||||
|
@ -513,6 +514,11 @@
|
|||
env)))
|
||||
|
||||
(define (lower-cps exp opts)
|
||||
;; FIXME: For now the closure conversion pass relies on $rec instances
|
||||
;; being separated into SCCs. We should fix this to not be the case,
|
||||
;; and instead move the split-rec pass back to
|
||||
;; optimize-higher-order-cps.
|
||||
(set! exp (split-rec exp))
|
||||
(set! exp (optimize-higher-order-cps exp opts))
|
||||
(set! exp (convert-closures exp))
|
||||
(set! exp (optimize-first-order-cps exp opts))
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
#:use-module (language cps self-references)
|
||||
#:use-module (language cps simplify)
|
||||
#:use-module (language cps specialize-primcalls)
|
||||
#:use-module (language cps split-rec)
|
||||
#:use-module (language cps type-fold)
|
||||
#:use-module (language cps verify)
|
||||
#:export (optimize-higher-order-cps
|
||||
optimize-first-order-cps))
|
||||
optimize-first-order-cps
|
||||
cps-default-optimization-options))
|
||||
|
||||
(define (kw-arg-ref args kw default)
|
||||
(match (memq kw args)
|
||||
|
@ -75,8 +75,7 @@
|
|||
(maybe-verify (pass program))
|
||||
program))
|
||||
...
|
||||
(verify program)
|
||||
program))
|
||||
(maybe-verify program)))
|
||||
|
||||
;; Passes that are needed:
|
||||
;;
|
||||
|
@ -84,7 +83,11 @@
|
|||
;; calls, and eliding prompts if possible.
|
||||
;;
|
||||
(define-optimizer optimize-higher-order-cps
|
||||
(split-rec #:split-rec? #t)
|
||||
;; FIXME: split-rec call temporarily moved to compile-bytecode and run
|
||||
;; unconditionally, because closure conversion requires it. Move the
|
||||
;; pass back here when that's fixed.
|
||||
;;
|
||||
;; (split-rec #:split-rec? #t)
|
||||
(eliminate-dead-code #:eliminate-dead-code? #t)
|
||||
(prune-top-level-scopes #:prune-top-level-scopes? #t)
|
||||
(simplify #:simplify? #t)
|
||||
|
@ -106,3 +109,19 @@
|
|||
(eliminate-dead-code #:eliminate-dead-code? #t)
|
||||
(rotate-loops #:rotate-loops? #t)
|
||||
(simplify #:simplify? #t))
|
||||
|
||||
(define (cps-default-optimization-options)
|
||||
(list ;; #:split-rec? #t
|
||||
#:eliminate-dead-code? #t
|
||||
#:prune-top-level-scopes? #t
|
||||
#:contify? #t
|
||||
#:inline-constructors? #t
|
||||
#:specialize-primcalls? #t
|
||||
#:elide-values? #t
|
||||
#:prune-bailouts? #t
|
||||
#:peel-loops? #t
|
||||
#:cse? #t
|
||||
#:type-fold? #t
|
||||
#:resolve-self-references? #t
|
||||
#:licm? #t
|
||||
#:rotate-loops? #t))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; Tree-il optimizer
|
||||
|
||||
;; Copyright (C) 2009, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
|
||||
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -25,7 +25,8 @@
|
|||
#:use-module (language tree-il fix-letrec)
|
||||
#:use-module (language tree-il debug)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (optimize))
|
||||
#:export (optimize
|
||||
tree-il-default-optimization-options))
|
||||
|
||||
(define (optimize x env opts)
|
||||
(let ((peval (match (memq #:partial-eval? opts)
|
||||
|
@ -37,3 +38,6 @@
|
|||
(verify-tree-il
|
||||
(peval (expand-primitives (resolve-primitives x env))
|
||||
env)))))
|
||||
|
||||
(define (tree-il-default-optimization-options)
|
||||
'(#:partial-eval? #t))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue