]> git.eshelyaron.com Git - emacs.git/commit
LAP optimiser: more stack reduction hoisting
authorMattias Engdegård <mattiase@acm.org>
Sun, 12 Feb 2023 11:33:27 +0000 (12:33 +0100)
committerMattias Engdegård <mattiase@acm.org>
Mon, 13 Feb 2023 15:57:49 +0000 (16:57 +0100)
commit8aef401b4f66a64ddfa9390590fb2cae1f96d522
treefb54bed75d8cb6f6149e256350689ce94f06c8da
parenta3edacd3f547195740304139cb68aaa94d7b18ee
LAP optimiser: more stack reduction hoisting

Hoisting stack reduction ops allows them to coalesce and/or cancel out
pushing ops, and for useful operations to sink and combine, such as
not + goto-if-[not-]nil.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Add the rule

  UNARY discardN-preserve-tos --> discardN-preserve-tos UNARY

where UNARY pops and pushes one value.

Generalise the rule

  const discardN-preserve-tos --> discardN const

to any 0-ary op, not just const: varref, point, etc.
lisp/emacs-lisp/byte-opt.el