[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp b31b0eb 03/14: * Rework some test logic for generali
From: |
Andrea Corallo |
Subject: |
feature/native-comp b31b0eb 03/14: * Rework some test logic for generality |
Date: |
Thu, 9 Jul 2020 11:57:51 -0400 (EDT) |
branch: feature/native-comp
commit b31b0ebefef3c9ea378342f624ce18a0eb6d30ae
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Rework some test logic for generality
* test/src/comp-tests.el (comp-tests-make-insn-checker): New
function splitting logic from `comp-tests-tco-checker' to have it
more general.
(comp-tests-tco-checker): Make use of
`comp-tests-make-insn-checker'.
---
test/src/comp-tests.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index fd1c513..aefb2f0 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -603,19 +603,28 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
'comment)
(comp-tests-mentioned-p-1 x insn)))
-(defun comp-tests-tco-checker (_)
- "Check that inside `comp-tests-tco-f' we have no recursion."
+(defun comp-tests-make-insn-checker (func-name checker)
+ "Apply CHECKER to each insn in FUNC-NAME.
+CHECKER should always return nil to have a pass."
(should-not
(cl-loop
named checker-loop
- with func-name = (comp-c-func-name 'comp-tests-tco-f "F" t)
- with f = (gethash func-name (comp-ctxt-funcs-h comp-ctxt))
+ with func-c-name = (comp-c-func-name func-name "F" t)
+ with f = (gethash func-c-name (comp-ctxt-funcs-h comp-ctxt))
for bb being each hash-value of (comp-func-blocks f)
do (cl-loop
for insn in (comp-block-insns bb)
- when (or (comp-tests-mentioned-p 'comp-tests-tco-f insn)
- (comp-tests-mentioned-p func-name insn))
- do (cl-return-from checker-loop 'mentioned)))))
+ when (funcall checker insn)
+ do (cl-return-from checker-loop 'mentioned)))))
+
+(defun comp-tests-tco-checker (_)
+ "Check that inside `comp-tests-tco-f' we have no recursion."
+ (comp-tests-make-insn-checker
+ 'comp-tests-tco-f
+ (lambda (insn)
+ (or (comp-tests-mentioned-p 'comp-tests-tco-f insn)
+ (comp-tests-mentioned-p (comp-c-func-name 'comp-tests-tco-f "F" t)
+ insn)))))
(ert-deftest comp-tests-tco ()
"Check for tail recursion elimination."
- feature/native-comp updated (2593bbe -> 5f13016), Andrea Corallo, 2020/07/09
- feature/native-comp 0b81044 02/14: * Clean-up some const folding logic and add `comp-function-pure-p', Andrea Corallo, 2020/07/09
- feature/native-comp b31b0eb 03/14: * Rework some test logic for generality,
Andrea Corallo <=
- feature/native-comp 3d43d45 01/14: Merge remote-tracking branch 'savannah/master' into HEAD, Andrea Corallo, 2020/07/09
- feature/native-comp 4348969 06/14: * test/src/comp-test-funcs.el (comp-tests-aref-aset-f) : Fix UB., Andrea Corallo, 2020/07/09
- feature/native-comp 5688739 07/14: * Add `comp-call-op-p', Andrea Corallo, 2020/07/09
- feature/native-comp 9aaca82 12/14: * Add `comp-disabled-passes', Andrea Corallo, 2020/07/09
- feature/native-comp e6ab4e3 04/14: * Add a test targeting forward propagation, Andrea Corallo, 2020/07/09
- feature/native-comp 3db6ace 05/14: * Define `comp-symbol-func-to-fun', Andrea Corallo, 2020/07/09
- feature/native-comp 7622740 08/14: * Introduce a new pass ipa-pure, Andrea Corallo, 2020/07/09
- feature/native-comp b4de6ba 09/14: * Optimize pure functions defined by the compilation environment, Andrea Corallo, 2020/07/09
- feature/native-comp 5f13016 14/14: Merge remote-tracking branch 'savannah/master' into wip2, Andrea Corallo, 2020/07/09
- feature/native-comp a53b446 10/14: Add some tests for pure function optimization, Andrea Corallo, 2020/07/09