scsh-0.6/scheme/bcomp/optimize.scm

29 lines
679 B
Scheme
Raw Permalink Normal View History

1999-09-14 08:45:02 -04:00
; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING.
; Optimizers
(define optimizers-table (make-table))
(define (set-optimizer! name opt)
(table-set! optimizers-table name opt))
(define (get-optimizer names)
(lambda (forms package)
(apply-optimizers (map (lambda (name)
(or (table-ref optimizers-table name)
(begin
(signal 'note
"optional optimization pass not invoked"
name)
(lambda (forms package) forms))))
names)
forms
package)))
(define (apply-optimizers optimizers forms package)
(fold (lambda (optimizer forms)
(optimizer forms package))
optimizers
forms))