comp: Make use of predicates in propagation for non builtin types

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-ctxt): Add `pred-type-h'
slot.
* lisp/emacs-lisp/comp.el (comp-known-predicate-p)
(comp-pred-to-cstr): Update.
This commit is contained in:
Andrea Corallo 2022-08-24 23:31:28 +02:00
parent f4de81af8f
commit d03dd07774
2 changed files with 13 additions and 2 deletions

View file

@ -641,11 +641,14 @@ Useful to hook into pass checkers.")
(defun comp-known-predicate-p (predicate)
"Return t if PREDICATE is known."
(when (gethash predicate comp-known-predicates-h) t))
(when (or (gethash predicate comp-known-predicates-h)
(gethash predicate (comp-cstr-ctxt-pred-type-h comp-ctxt)))
t))
(defun comp-pred-to-cstr (predicate)
"Given PREDICATE, return the corresponding constraint."
(gethash predicate comp-known-predicates-h))
(or (gethash predicate comp-known-predicates-h)
(gethash predicate (comp-cstr-ctxt-pred-type-h comp-ctxt))))
(defconst comp-symbol-values-optimizable '(most-positive-fixnum
most-negative-fixnum)