[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 2a117ad 01/19: * Add mvar pretty print support when
From: |
Andrea Corallo |
Subject: |
feature/native-comp 2a117ad 01/19: * Add mvar pretty print support when dumping LIMPLE |
Date: |
Mon, 21 Dec 2020 14:52:37 -0500 (EST) |
branch: feature/native-comp
commit 2a117ad3d7204fe40b12cb3ebdc88e18346fb145
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Add mvar pretty print support when dumping LIMPLE
* lisp/emacs-lisp/comp.el (comp-prettyformat-mvar)
(comp-prettyformat-insn): New function.
(comp-log-func): Update to use `comp-prettyformat-insn'.
(comp-finalize-phis): Change LIMPLE phi format to ease
`comp-prettyformat-insn' destructuring.
---
lisp/emacs-lisp/comp.el | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index c6f192d..24955c6 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -656,7 +656,7 @@ Assume allocation class 'd-default as default."
(defconst comp-limple-lock-keywords
`((,(rx bol "(comment" (1+ not-newline)) . font-lock-comment-face)
- (,(rx "#s(" (group-n 1 "comp-mvar"))
+ (,(rx "#(" (group-n 1 "mvar"))
(1 font-lock-function-name-face))
(,(rx bol "(" (group-n 1 "phi"))
(1 font-lock-variable-name-face))
@@ -715,15 +715,30 @@ log with `comp-log-to-buffer'."
(with-selected-window log-window
(goto-char (point-max)))))))
+(defun comp-prettyformat-mvar (mvar)
+ (format "#(mvar %s %s %S)"
+ (comp-mvar-id mvar)
+ (comp-mvar-slot mvar)
+ (comp-cstr-to-type-spec mvar)))
+
+(defun comp-prettyformat-insn (insn)
+ (cl-typecase insn
+ (comp-mvar (comp-prettyformat-mvar insn))
+ (atom (prin1-to-string insn))
+ (cons (concat "(" (mapconcat #'comp-prettyformat-insn insn " ") ")"))))
+
(defun comp-log-func (func verbosity)
"Log function FUNC.
VERBOSITY is a number between 0 and 3."
(when (>= comp-verbose verbosity)
(comp-log (format "\nFunction: %s\n" (comp-func-name func)) verbosity)
- (cl-loop for block-name being each hash-keys of (comp-func-blocks func)
- using (hash-value bb)
- do (comp-log (concat "<" (symbol-name block-name) ">") verbosity)
- (comp-log (comp-block-insns bb) verbosity t))))
+ (cl-loop
+ for block-name being each hash-keys of (comp-func-blocks func)
+ using (hash-value bb)
+ do (comp-log (concat "<" (symbol-name block-name) ">") verbosity)
+ (cl-loop
+ for insn in (comp-block-insns bb)
+ do (comp-log (comp-prettyformat-insn insn) verbosity)))))
(defun comp-log-edges (func)
"Log edges in FUNC."
@@ -2286,7 +2301,7 @@ PRE-LAMBDA and POST-LAMBDA are called in pre or
post-order if non-nil."
for e in (comp-block-in-edges b)
for b = (comp-edge-src e)
for in-frame = (comp-block-final-frame b)
- collect (cons (aref in-frame slot-n)
+ collect (list (aref in-frame slot-n)
(comp-block-name b))))))
(cl-loop for b being each hash-value of (comp-func-blocks comp-func)
- 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 <=
- 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, 2020/12/21
- 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