From: Jacques Pienaar Date: Fri, 16 Sep 2022 22:08:55 +0000 (-0700) Subject: [mlir][emacs] Enable loading bytecode files as text X-Git-Tag: upstream/17.0.6~33295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55e4417bb9a9040b71ee7506b1e32b7d2d95f2aa;p=platform%2Fupstream%2Fllvm.git [mlir][emacs] Enable loading bytecode files as text Use auto-compression-mode to read bytecode files in human readable manner. Differential Revision: https://reviews.llvm.org/D133879 --- diff --git a/mlir/utils/emacs/mlir-mode.el b/mlir/utils/emacs/mlir-mode.el index 636c5db..9810a4c 100644 --- a/mlir/utils/emacs/mlir-mode.el +++ b/mlir/utils/emacs/mlir-mode.el @@ -74,6 +74,22 @@ ;;;###autoload (add-to-list 'auto-mode-alist (cons "\\.mlir\\'" 'mlir-mode)) +;; Set default value of opt-tool to use as mlir-opt. +(defcustom mlir-opt "mlir-opt" + "Commandline MLIR opt tool to use." + :type 'string) + +;; Enable reading/writing .mlirbc files. +(require 'jka-compr) +(add-to-list 'jka-compr-compression-info-list + (vector "\\.mlirbc\\'" + "mlir-to-bytecode" mlir-opt (vector "--mlir-print-debuginfo" "--emit-bytecode" "-o" "-" "-") + "mlir-bytecode-to-text" mlir-opt (vector "--mlir-print-debuginfo") + nil nil "ML\357R")) +(jka-compr-update) +(auto-compression-mode t) +(add-to-list 'auto-mode-alist (cons "\\.mlirbc\\'" 'mlir-mode)) + (provide 'mlir-mode) ;;; mlir-mode.el ends here