optimize.scm 725 B

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