summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-12-27 14:07:08 +0100
committerAndrea Corallo <akrl@sdf.org>2020-12-27 21:34:03 +0100
commit7d07a718416d6c24df0719483279c4278dce4acb (patch)
tree6bfd5b98e1a8ea06be5a9cfdb698b327b4c75752 /lisp/emacs-lisp/comp.el
parent92af4e8fc97a3af043904c32488b84c0e943473d (diff)
downloademacs-7d07a718416d6c24df0719483279c4278dce4acb.tar.gz
emacs-7d07a718416d6c24df0719483279c4278dce4acb.tar.bz2
emacs-7d07a718416d6c24df0719483279c4278dce4acb.zip
Add sum/subtraction integer range propagation support
* lisp/emacs-lisp/comp-cstr.el (comp-range-+, comp-range--): New functions. (comp-cstr-set-range-for-arithm): New macro. (comp-cstr-add-2, comp-cstr-sub-2, comp-cstr-add, comp-cstr-sub): New function. * lisp/emacs-lisp/comp.el (comp-fwprop-call): Wire-up + - integer range propagation.
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 936e47ff39a..336ed39145d 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2648,7 +2648,10 @@ Fold the call in case."
(setf (comp-mvar-range lval) (comp-cstr-range cstr)
(comp-mvar-valset lval) (comp-cstr-valset cstr)
(comp-mvar-typeset lval) (comp-cstr-typeset cstr)
- (comp-mvar-neg lval) (comp-cstr-neg cstr))))))
+ (comp-mvar-neg lval) (comp-cstr-neg cstr))))
+ (cl-case f
+ (+ (comp-cstr-add lval args))
+ (- (comp-cstr-sub lval args)))))
(defun comp-fwprop-insn (insn)
"Propagate within INSN."