diff --git a/mlir/utils/emacs/mlir-mode.el b/mlir/utils/emacs/mlir-mode.el --- 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