mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-26 13:10:22 +02:00
Tree-il post-order rewriter no longer destructive
* module/language/tree-il.scm (pre-post-order): New helper, like pre-order! and post-order! but not destructive. (post-order): Implement in terms of pre-post-order, and rename from post-order!. * module/ice-9/compile-psyntax.scm (squeeze-tree-il): * module/language/tree-il/canonicalize.scm (canonicalize): * module/language/tree-il/fix-letrec.scm (fix-letrec): * module/language/tree-il/primitives.scm (resolve-primitives): Use post-order, and rename from the destructive variants (squeeze-tree-il!, canonicalize!, etc). Adapt callers. * test-suite/tests/tree-il.test (strip-source): Adapt to post-order. * test-suite/tests/cse.test: * test-suite/tests/peval.test: * module/language/tree-il/optimize.scm: Adapt callers.
This commit is contained in:
parent
64fc50c294
commit
403d78f915
10 changed files with 128 additions and 127 deletions
|
@ -1,7 +1,7 @@
|
|||
;;;; tree-il.test --- test suite for compiling tree-il -*- scheme -*-
|
||||
;;;; Andy Wingo <wingo@pobox.com> --- May 2009
|
||||
;;;;
|
||||
;;;; Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 2009, 2010, 2011, 2012, 2013 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
|
||||
|
@ -36,12 +36,12 @@
|
|||
((_ in pat)
|
||||
(pass-if 'in
|
||||
(let ((evaled (unparse-tree-il
|
||||
(canonicalize!
|
||||
(fix-letrec!
|
||||
(canonicalize
|
||||
(fix-letrec
|
||||
(cse
|
||||
(peval
|
||||
(expand-primitives!
|
||||
(resolve-primitives!
|
||||
(resolve-primitives
|
||||
(compile 'in #:from 'scheme #:to 'tree-il)
|
||||
(current-module))))))))))
|
||||
(pmatch evaled
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
((_ in pat)
|
||||
(pass-if-peval in pat
|
||||
(expand-primitives!
|
||||
(resolve-primitives!
|
||||
(resolve-primitives
|
||||
(compile 'in #:from 'scheme #:to 'tree-il)
|
||||
(current-module)))))
|
||||
((_ in pat code)
|
||||
|
@ -489,7 +489,7 @@
|
|||
;; <https://lists.gnu.org/archive/html/bug-guile/2011-09/msg00029.html>.
|
||||
(pmatch (unparse-tree-il
|
||||
(peval (expand-primitives!
|
||||
(resolve-primitives!
|
||||
(resolve-primitives
|
||||
(compile
|
||||
'(let ((make-adder
|
||||
(lambda (x) (lambda (y) (+ x y)))))
|
||||
|
|
|
@ -32,8 +32,10 @@
|
|||
;; information from the incoming tree-il.
|
||||
|
||||
(define (strip-source x)
|
||||
(post-order! (lambda (x) (set! (tree-il-src x) #f))
|
||||
x))
|
||||
(post-order (lambda (x)
|
||||
(set! (tree-il-src x) #f)
|
||||
x)
|
||||
x))
|
||||
|
||||
(define-syntax assert-tree-il->glil
|
||||
(syntax-rules (with-partial-evaluation without-partial-evaluation
|
||||
|
@ -64,7 +66,7 @@
|
|||
(beautify-user-module! m)
|
||||
m))
|
||||
(orig (parse-tree-il 'in))
|
||||
(resolved (expand-primitives! (resolve-primitives! orig module))))
|
||||
(resolved (expand-primitives! (resolve-primitives orig module))))
|
||||
(or (equal? (unparse-tree-il resolved) 'expected)
|
||||
(begin
|
||||
(format (current-error-port)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue