* Eliminates a jump-to-jump case in "flatten-code".

This commit is contained in:
Abdulaziz Ghuloum 2007-11-21 05:31:01 -05:00
parent 37aab027da
commit eb30e7ab58
4 changed files with 16 additions and 7 deletions

Binary file not shown.

View File

@ -2585,6 +2585,11 @@
(define (unique-label)
(label (gensym)))
;;;
(define (constant=? x k)
(struct-case x
[(constant k0) (equal? k0 k)]
[else #f]))
;;;
(define (P x lt lf ac)
(struct-case x
[(constant c)
@ -2595,6 +2600,10 @@
(E e0 (P e1 lt lf ac))]
[(conditional e0 e1 e2)
(cond
[(and (constant=? e1 #t) (constant=? e2 #f))
(P e0 lt lf ac)]
[(and (constant=? e1 #f) (constant=? e2 #t))
(P e0 lf lt ac)]
[(and lt lf)
(let ([l (unique-label)])
(P e0 #f l

View File

@ -1821,14 +1821,14 @@
cases)
cp free name))])]
[else (error who "invalid expression" (unparse x))]))
(when (assembler-output)
(printf "BEFORE\n")
(pretty-print (unparse x)))
;(when (assembler-output)
; (printf "BEFORE\n")
; (pretty-print (unparse x)))
(let ([x (E x)])
(let ([v (make-codes all-codes x)])
(when (assembler-output)
(printf "AFTER\n")
(pretty-print (unparse v)))
;(when (assembler-output)
; (printf "AFTER\n")
; (pretty-print (unparse v)))
v)))

View File

@ -1 +1 @@
1101
1102