Canonicalize <=, >=, and > primcalls to <
* module/language/tree-il/compile-cps.scm (canonicalize): Convert <=, >=, and > primcalls to <. * module/language/cps/primitives.scm (*comparisons*): * module/language/cps/effects-analysis.scm: Remove superfluous primcalls. * module/language/cps/specialize-numbers.scm (specialize-u64-scm-comparison): Only emit < primcalls for ordered comparisons. (specialize-scm-u64-comparison): New helper. * module/language/cps/specialize-numbers.scm (specialize-operations): Remove support for >=, <=, and the like. * module/language/cps/type-fold.scm: Remove folders for <= and so on. * module/language/cps/types.scm (define-=-inferrer, define-<-inferrer): New helpers; use them for all = and < variants. Remove checkers and inferrers for <= and the like. * module/language/cps/compile-bytecode.scm (compile-function): Remove unnecessary cases.
This commit is contained in:
parent
8b3258716c
commit
7a7f71de5c
7 changed files with 105 additions and 196 deletions
|
|
@ -1050,6 +1050,24 @@ integer."
|
|||
(($ <conditional>)
|
||||
(reduce-conditional exp))
|
||||
|
||||
(($ <primcall> src '<= (a b))
|
||||
;; No need to reduce as < is a branching primitive.
|
||||
(make-conditional src (make-primcall src '< (list b a))
|
||||
(make-const src #f)
|
||||
(make-const src #t)))
|
||||
|
||||
(($ <primcall> src '>= (a b))
|
||||
;; No need to reduce as < is a branching primitive.
|
||||
(make-conditional src (make-primcall src '< (list a b))
|
||||
(make-const src #f)
|
||||
(make-const src #t)))
|
||||
|
||||
(($ <primcall> src '> (a b))
|
||||
;; No need to reduce as < is a branching primitive.
|
||||
(make-conditional src (make-primcall src '< (list b a))
|
||||
(make-const src #t)
|
||||
(make-const src #f)))
|
||||
|
||||
(($ <primcall> src (? branching-primitive? name) args)
|
||||
;; No need to reduce because test is not reducible: reifying
|
||||
;; #t/#f is the right thing.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue