#| -*-Scheme-*-
-$Id: midend.scm,v 1.7 1995/01/17 23:00:51 adams Exp $
+$Id: midend.scm,v 1.8 1995/01/19 23:43:16 adams Exp $
Copyright (c) 1994 Massachusetts Institute of Technology
(lambda (program)
(set! *current-phase* this-phase)
(set! *current-phase-input* (and *debugging?* program))
+ (phase/pre-hook program)
(if *announce-phases?*
(begin
(newline)
(lambda ()
(show-program "Output from phase " result))))
result)))))
+ (phase/post-hook program result)
(gather-phase-statistics program result)
result)))))
(lambda (program)
(set! *code-rewrite-table* *previous-code-rewrite-table*)
(rewrite program)))
+
+(define (phase/pre-hook program)
+ program
+ unspecific)
+
+(define (phase/post-hook program program*)
+ program program*
+ unspecific)
+#|
+Example:
+(define *phase/pp/ann?* #T)
+(define *phases-to-pp/ann* 'all)
+(define (phase/post-hook prog result)
+ (if (and *phase/pp/ann?*
+ (or (eq? *phases-to-pp/ann* 'all)
+ (memq *current-phase* *phases-to-pp/ann*)))
+ (begin
+ (pp/ann result *code-rewrite-table*)
+ (pp `(phase is ,*current-phase*))
+ (bkpt ";; proceed"))))
+|#
\f
;;;; Top level