summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-12-15 17:45:53 +0100
committerAndrea Corallo <akrl@sdf.org>2020-12-21 20:22:02 +0100
commit23791cf74da9c2e6369f2c15ef180ef2a8c21656 (patch)
tree582c416290ac9f92c7f372d0f51605ba796a89ce /lisp/emacs-lisp/comp.el
parent02551085c121905146fdb48079f300b3376c5a99 (diff)
downloademacs-23791cf74da9c2e6369f2c15ef180ef2a8c21656.tar.gz
emacs-23791cf74da9c2e6369f2c15ef180ef2a8c21656.tar.bz2
emacs-23791cf74da9c2e6369f2c15ef180ef2a8c21656.zip
* Allow for modifying insn-cell inside `comp-loop-insn-in-block'
* lisp/emacs-lisp/comp.el (comp-loop-insn-in-block): Update.
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 8791759aaf5..e8db2383c41 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -759,14 +759,15 @@ VERBOSITY is a number between 0 and 3."
(defmacro comp-loop-insn-in-block (basic-block &rest body)
"Loop over all insns in BASIC-BLOCK executing BODY.
-Inside BODY `insn' can be used to read or set the current
-instruction."
+Inside BODY `insn' and `insn-cell'can be used to read or set the
+current instruction or its cell."
(declare (debug (form body))
(indent defun))
- (let ((sym-cell (gensym "cell-")))
- `(cl-symbol-macrolet ((insn (car ,sym-cell)))
- (cl-loop for ,sym-cell on (comp-block-insns ,basic-block)
- do ,@body))))
+ `(cl-symbol-macrolet ((insn (car insn-cell)))
+ (let ((insn-cell (comp-block-insns ,basic-block)))
+ (while insn-cell
+ ,@body
+ (setf insn-cell (cdr insn-cell))))))
;;; spill-lap pass specific code.