diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-07-13 20:35:20 +0200 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-07-15 09:34:16 +0200 |
commit | 4c46f8bac0ad3ee89ada767a6dd651411c1319a5 (patch) | |
tree | 2f2dbeaeb75e0e7aee6ed71a8b5f4d6caf0f0874 /lisp/emacs-lisp/comp.el | |
parent | 5be335e6b5d1a948a94206869d75c04684104203 (diff) | |
download | emacs-4c46f8bac0ad3ee89ada767a6dd651411c1319a5.tar.gz emacs-4c46f8bac0ad3ee89ada767a6dd651411c1319a5.tar.bz2 emacs-4c46f8bac0ad3ee89ada767a6dd651411c1319a5.zip |
* Add a simple major mode for coloring LIMPLE in the log buffer
* lisp/emacs-lisp/comp.el (comp-limple-lock-keywords): New const.
(comp-limple-mode): New major mode.
(comp-log-to-buffer): Enable `comp-limple-mode' in the log buffer.
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r-- | lisp/emacs-lisp/comp.el | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 065417d1d97..24b2a4f6dcd 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -471,6 +471,27 @@ Assume allocaiton class 'd-default as default." (puthash obj t (comp-data-container-idx (comp-alloc-class-to-container comp-curr-allocation-class)))) + +;;; Log rountines. + +(defconst comp-limple-lock-keywords + `((,(rx bol "(comment" (1+ not-newline)) . font-lock-comment-face) + (,(rx "#s(" (group-n 1 "comp-mvar")) + (1 font-lock-function-name-face)) + (,(rx bol "(" (group-n 1 "phi")) + (1 font-lock-variable-name-face)) + (,(rx (group-n 1 (or "entry" + (seq (or "entry_" "entry_fallback_" "bb_") + (1+ num))))) + (1 font-lock-constant-face)) + (,(rx "(" (group-n 1 (1+ (or word "-")))) + (1 font-lock-keyword-face))) + "Highlights used by comp-limple-mode.") + +(define-derived-mode comp-limple-mode fundamental-mode "LIMPLE" + "Syntax highlight LIMPLE IR." + (setf font-lock-defaults '(comp-limple-lock-keywords))) + (cl-defun comp-log (data &optional (level 1)) "Log DATA at LEVEL. LEVEL is a number from 1-3; if it is less than `comp-verbose', do @@ -495,6 +516,8 @@ log with `comp-log-to-buffer'." (inhibit-read-only t) at-end-p) (with-current-buffer log-buffer + (unless (eq major-mode 'comp-limple-mode) + (comp-limple-mode)) (when (= (point) (point-max)) (setf at-end-p t)) (save-excursion @@ -534,6 +557,8 @@ VERBOSITY is a number between 0 and 3." 2)) edges))) + + (defun comp-output-directory (src) "Return the compilation direcotry for source SRC." (let* ((src (if (symbolp src) (symbol-name src) src)) |