[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 0255108 08/19: * Rename comp-cond-cstr into comp-add
From: |
Andrea Corallo |
Subject: |
feature/native-comp 0255108 08/19: * Rename comp-cond-cstr into comp-add-cstrs |
Date: |
Mon, 21 Dec 2020 14:52:39 -0500 (EST) |
branch: feature/native-comp
commit 02551085c121905146fdb48079f300b3376c5a99
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Rename comp-cond-cstr into comp-add-cstrs
* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs-target-mvar)
(comp-add-cond-cstrs, comp-add-cstrs): Rename comp-cond-cstr
-> comp-add-cstrs.
---
lisp/emacs-lisp/comp.el | 56 +++++++++++++++++++++++++------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 750c298..8791759 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -164,7 +164,7 @@ Can be one of: 'd-default', 'd-impure' or 'd-ephemeral'.
See `comp-ctxt'.")
comp-fwprop
comp-call-optim
comp-ipa-pure
- comp-cond-cstr
+ comp-add-cstrs
comp-fwprop
comp-dead-code
comp-tco
@@ -1884,24 +1884,6 @@ The assume is emitted at the beginning of the block BB."
(comp-block-insns bb)))
(setf (comp-func-ssa-status comp-func) 'dirty)))
-(defun comp-cond-cstr-target-mvar (mvar exit-insn bb)
- "Given MVAR search in BB what we'll use as assume target.
-Keep on searching till EXIT-INSN is encountered.
-Return the corresponding rhs mvar."
- (cl-flet ((targetp (x)
- ;; Ret t if x is an mvar and target the correct slot number.
- (and (comp-mvar-p x)
- (eql (comp-mvar-slot mvar) (comp-mvar-slot x)))))
- (cl-loop
- with res = nil
- for insn in (comp-block-insns bb)
- when (eq insn exit-insn)
- do (cl-return (and (comp-mvar-p res) res))
- do (pcase insn
- (`(,(pred comp-assign-op-p) ,(pred targetp) ,rhs)
- (setf res rhs)))
- finally (cl-assert nil))))
-
(defun comp-add-new-block-beetween (bb-symbol bb-a bb-b)
"Create a new basic-block named BB-SYMBOL and add it between BB-A and BB-B."
(cl-loop
@@ -1924,7 +1906,25 @@ Return the corresponding rhs mvar."
(cl-return (puthash bb-symbol new-bb (comp-func-blocks comp-func)))
finally (cl-assert nil)))
-(defun comp-cond-cstr-target-block (curr-bb target-bb-sym)
+(defun comp-add-cond-cstrs-target-mvar (mvar exit-insn bb)
+ "Given MVAR search in BB what we'll use as assume target.
+Keep on searching till EXIT-INSN is encountered.
+Return the corresponding rhs mvar."
+ (cl-flet ((targetp (x)
+ ;; Ret t if x is an mvar and target the correct slot number.
+ (and (comp-mvar-p x)
+ (eql (comp-mvar-slot mvar) (comp-mvar-slot x)))))
+ (cl-loop
+ with res = nil
+ for insn in (comp-block-insns bb)
+ when (eq insn exit-insn)
+ do (cl-return (and (comp-mvar-p res) res))
+ do (pcase insn
+ (`(,(pred comp-assign-op-p) ,(pred targetp) ,rhs)
+ (setf res rhs)))
+ finally (cl-assert nil))))
+
+(defun comp-add-cond-cstrs-target-block (curr-bb target-bb-sym)
"Return the appropriate basic block to add constraint assumptions into.
CURR-BB is the current basic block.
TARGET-BB-SYM is the symbol name of the target block."
@@ -1938,8 +1938,8 @@ TARGET-BB-SYM is the symbol name of the target block."
"_cstrs"))
curr-bb target-bb))))
-(defun comp-cond-cstr-func ()
- "`comp-cond-cstr' worker function for each selected function."
+(defun comp-add-cond-cstrs ()
+ "`comp-add-cstrs' worker function for each selected function."
(cl-loop
for b being each hash-value of (comp-func-blocks comp-func)
do
@@ -1954,11 +1954,13 @@ TARGET-BB-SYM is the symbol name of the target block."
(comment ,_comment-str)
(cond-jump ,cond ,(pred comp-mvar-p) . ,blocks))
(cl-loop
- with target-mvar1 = (comp-cond-cstr-target-mvar op1 (car insns-seq) b)
- with target-mvar2 = (comp-cond-cstr-target-mvar op2 (car insns-seq) b)
+ with target-mvar1 = (comp-add-cond-cstrs-target-mvar op1 (car
insns-seq)
+ b)
+ with target-mvar2 = (comp-add-cond-cstrs-target-mvar op2 (car
insns-seq)
+ b)
for branch-target-cell on blocks
for branch-target = (car branch-target-cell)
- for assume-target = (comp-cond-cstr-target-block b branch-target)
+ for assume-target = (comp-add-cond-cstrs-target-block b branch-target)
for negated in '(nil t)
do (setf (car branch-target-cell) (comp-block-name assume-target))
when target-mvar1
@@ -1967,7 +1969,7 @@ TARGET-BB-SYM is the symbol name of the target block."
do (comp-emit-assume target-mvar2 op1 assume-target negated)
finally (cl-return-from in-the-basic-block)))))))
-(defun comp-cond-cstr (_)
+(defun comp-add-cstrs (_)
"Rewrite conditional branches adding appropriate 'assume' insns.
This is introducing and placing 'assume' insns in use by fwprop
to propagate conditional branch test information on target basic
@@ -1980,7 +1982,7 @@ blocks."
(comp-func-l-p f)
(not (comp-func-has-non-local f)))
(let ((comp-func f))
- (comp-cond-cstr-func)
+ (comp-add-cond-cstrs)
(comp-log-func comp-func 3))))
(comp-ctxt-funcs-h comp-ctxt)))
- feature/native-comp updated (5b10a03 -> 9676e4d), Andrea Corallo, 2020/12/21
- feature/native-comp 2a117ad 01/19: * Add mvar pretty print support when dumping LIMPLE, Andrea Corallo, 2020/12/21
- feature/native-comp bad18f5 02/19: * Improve comp-fwprop pass, Andrea Corallo, 2020/12/21
- feature/native-comp a0c0daf 03/19: * Fix a number of type specifier simplification tests, Andrea Corallo, 2020/12/21
- feature/native-comp 34c1d75 05/19: * Enumerate and split type specifier tests in comp-tests.el to ease debug, Andrea Corallo, 2020/12/21
- feature/native-comp 7074988 06/19: * Add a type specifier test to comp-cstr-tests.el, Andrea Corallo, 2020/12/21
- feature/native-comp 0255108 08/19: * Rename comp-cond-cstr into comp-add-cstrs,
Andrea Corallo <=
- feature/native-comp 48d43f5 04/19: * Improve constraint simplification logic in comp-cstr.el, Andrea Corallo, 2020/12/21
- feature/native-comp 07b75de 10/19: Enhance type inference constraining function arguments, Andrea Corallo, 2020/12/21
- feature/native-comp e0f20da 14/19: Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t, Andrea Corallo, 2020/12/21
- feature/native-comp 6f3570c 16/19: Fix value type inference for doubly negate constraints, Andrea Corallo, 2020/12/21
- feature/native-comp d072ee9 07/19: * Two minors in comp.el, Andrea Corallo, 2020/12/21
- feature/native-comp 23791cf 09/19: * Allow for modifying insn-cell inside `comp-loop-insn-in-block', Andrea Corallo, 2020/12/21
- feature/native-comp 9bbe6ea 15/19: Fix native compiler tests when they are bytecompiled, Andrea Corallo, 2020/12/21
- feature/native-comp 8e816b0 11/19: Symplify type specifier (not t) as nil, Andrea Corallo, 2020/12/21
- feature/native-comp c70c080 12/19: * Allow for overlapping src and dst in cstr set operations, Andrea Corallo, 2020/12/21
- feature/native-comp 5376563 17/19: Fix `comp-add-call-cstr' and add a test, Andrea Corallo, 2020/12/21