1; Part of Scheme 48 1.9. See file COPYING for notices and license. 2 3; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber 4 5; Optimizers 6 7(define optimizers-table (make-table)) 8 9(define (set-optimizer! name opt) 10 (table-set! optimizers-table name opt)) 11 12(define (get-optimizer names) 13 (lambda (forms package) 14 (apply-optimizers (map (lambda (name) 15 (or (table-ref optimizers-table name) 16 (begin 17 (note 'get-optimizer 18 "optional optimization pass not invoked" 19 name) 20 (lambda (forms package) forms)))) 21 names) 22 forms 23 package))) 24 25(define (apply-optimizers optimizers forms package) 26 (fold (lambda (optimizer forms) 27 (optimizer forms package)) 28 optimizers 29 forms)) 30 31