[Mlir-commits] [mlir] 55e4417 - [mlir][emacs] Enable loading bytecode files as text

Jacques Pienaar llvmlistbot at llvm.org
Fri Sep 16 15:09:06 PDT 2022


Author: Jacques Pienaar
Date: 2022-09-16T15:08:55-07:00
New Revision: 55e4417bb9a9040b71ee7506b1e32b7d2d95f2aa

URL: https://github.com/llvm/llvm-project/commit/55e4417bb9a9040b71ee7506b1e32b7d2d95f2aa
DIFF: https://github.com/llvm/llvm-project/commit/55e4417bb9a9040b71ee7506b1e32b7d2d95f2aa.diff

LOG: [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

Added: 
    

Modified: 
    mlir/utils/emacs/mlir-mode.el

Removed: 
    


################################################################################
diff  --git a/mlir/utils/emacs/mlir-mode.el b/mlir/utils/emacs/mlir-mode.el
index 636c5db99619e..9810a4c7cb9a7 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


        


More information about the Mlir-commits mailing list