1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 06:20:43 -08:00

some code for const propagation

This commit is contained in:
Andrea Corallo 2019-07-08 07:17:28 +02:00 committed by Andrea Corallo
parent 2782a07f4d
commit 02bd9340e2

View file

@ -37,6 +37,15 @@
(defconst comp-known-ret-types '((Fcons . cons)))
(defconst comp-mostly-pure-funcs
'(% * + - / /= 1+ 1- < <= = > >= cons list % concat logand logcount logior
lognot logxor regexp-opt regexp-quote string-to-char string-to-syntax
symbol-name)
"Functions on witch we do constant propagation."
;; Is it acceptable to move into the compile time functions that are
;; allocating memory? (these are technically not side effect free)
)
(cl-defstruct comp-args
mandatory nonrest rest)
@ -105,6 +114,13 @@
"Slot into the meta-stack pointed by sp + 1."
'(comp-slot-n (1+ (comp-sp))))
;; (defun comp-opt-call (inst)
;; "Optimize if possible a side-effect-free call in INST."
;; (cl-destructuring-bind (_ f &rest args) inst
;; (when (and (member f comp-mostly-pure-funcs)
;; (cl-every #'identity (mapcar #'comp-mvar-const-vld args)))
;; (apply f (mapcar #'comp-mvar-constant args)))))
(defmacro comp-push-call (x)
"Push call X into frame."
`(let ((src-slot ,x))