Cleanup number optimizations.

original commit: 50ee4c75b285cd9a7b7254f9458661dddf883c30
This commit is contained in:
Eric Dobson 2013-09-04 21:46:59 -07:00
parent f789607929
commit 58e7c1f024

View File

@ -8,14 +8,11 @@
(provide number-opt-expr)
(define-literal-syntax-class unary-op (+ * min max))
(define-syntax-class number-opt-expr
#:commit
;; these cases are all identity
(pattern (#%plain-app (~and op (~or (~literal +) (~literal *)
(~literal min) (~literal max)))
f:expr)
#:with opt
(begin (log-optimization "unary number" "Identity elimination."
this-syntax)
(add-disappeared-use #'op)
((optimize) #'f))))
(pattern (#%plain-app op:unary-op f:opt-expr)
#:do [(log-opt "unary number" "Identity elimination.")]
#:with opt #'f.opt))