diff options
Diffstat (limited to 'utils/emacs')
-rw-r--r-- | utils/emacs/emacs.el | 21 | ||||
-rw-r--r-- | utils/emacs/llvm-mode.el | 98 | ||||
-rw-r--r-- | utils/emacs/tablegen-mode.el | 20 |
3 files changed, 76 insertions, 63 deletions
diff --git a/utils/emacs/emacs.el b/utils/emacs/emacs.el index 969f538c81743..2ebc3c677cef7 100644 --- a/utils/emacs/emacs.el +++ b/utils/emacs/emacs.el @@ -1,25 +1,20 @@ ;; LLVM coding style guidelines in emacs ;; Maintainer: LLVM Team, http://llvm.org/ -;; Modified: 2009-07-28 -;; Max 80 cols per line, indent by two spaces, no tabs. -;; Apparently, this does not affect tabs in Makefiles. -(custom-set-variables - '(fill-column 80) - '(c++-indent-level 2) - '(c-basic-offset 2) - '(indent-tabs-mode nil)) - - -;; Alternative to setting the global style. Only files with "llvm" in -;; their names will automatically set to the llvm.org coding style. +;; Add a cc-mode style for editing LLVM C++ code (c-add-style "llvm.org" '((fill-column . 80) (c++-indent-level . 2) (c-basic-offset . 2) (indent-tabs-mode . nil) - (c-offsets-alist . ((innamespace 0))))) + (c-offsets-alist . ((arglist-intro . ++) + (innamespace . 0) + (member-init-intro . ++) + )) + )) +;; Files with "llvm" in their names will automatically be set to the +;; llvm.org coding style. (add-hook 'c-mode-hook (function (lambda nil diff --git a/utils/emacs/llvm-mode.el b/utils/emacs/llvm-mode.el index 99d3294272ace..6d8395cc111b8 100644 --- a/utils/emacs/llvm-mode.el +++ b/utils/emacs/llvm-mode.el @@ -1,8 +1,13 @@ +;;; llvm-mode.el --- Major mode for the LLVM assembler language. + ;; Maintainer: The LLVM team, http://llvm.org/ -;; Description: Major mode for the LLVM assembler language. -;; Updated: 2007-09-19 -;; Create mode-specific tables. +;;; Commentary: + +;; Major mode for editing LLVM IR files. + +;;; Code: + (defvar llvm-mode-syntax-table nil "Syntax table used while in LLVM mode.") (defvar llvm-font-lock-keywords @@ -48,9 +53,13 @@ `(,(regexp-opt '("extractelement" "insertelement" "shufflevector") 'words) . font-lock-keyword-face) ;; Aggregate ops `(,(regexp-opt '("extractvalue" "insertvalue") 'words) . font-lock-keyword-face) + ;; Metadata types + `(,(regexp-opt '("distinct") 'words) . font-lock-keyword-face) + ;; Use-list order directives + `(,(regexp-opt '("uselistorder" "uselistorder_bb") 'words) . font-lock-keyword-face) ) - "Syntax highlighting for LLVM" + "Syntax highlighting for LLVM." ) ;; ---------------------- Syntax table --------------------------- @@ -60,40 +69,40 @@ (if (not llvm-mode-syntax-table) (progn (setq llvm-mode-syntax-table (make-syntax-table)) - (mapcar (function (lambda (n) - (modify-syntax-entry (aref n 0) - (aref n 1) - llvm-mode-syntax-table))) - '( - ;; whitespace (` ') - [?\^m " "] - [?\f " "] - [?\n " "] - [?\t " "] - [?\ " "] - ;; word constituents (`w') - ;;[?< "w"] - ;;[?> "w"] - [?\% "w"] - ;;[?_ "w "] - ;; comments - [?\; "< "] - [?\n "> "] - ;;[?\r "> "] - ;;[?\^m "> "] - ;; symbol constituents (`_') - ;; punctuation (`.') - ;; open paren (`(') - [?\( "("] - [?\[ "("] - [?\{ "("] - ;; close paren (`)') - [?\) ")"] - [?\] ")"] - [?\} ")"] - ;; string quote ('"') - [?\" "\""] - )))) + (mapc (function (lambda (n) + (modify-syntax-entry (aref n 0) + (aref n 1) + llvm-mode-syntax-table))) + '( + ;; whitespace (` ') + [?\^m " "] + [?\f " "] + [?\n " "] + [?\t " "] + [?\ " "] + ;; word constituents (`w') + ;;[?< "w"] + ;;[?> "w"] + [?\% "w"] + ;;[?_ "w "] + ;; comments + [?\; "< "] + [?\n "> "] + ;;[?\r "> "] + ;;[?\^m "> "] + ;; symbol constituents (`_') + ;; punctuation (`.') + ;; open paren (`(') + [?\( "("] + [?\[ "("] + [?\{ "("] + ;; close paren (`)') + [?\) ")"] + [?\] ")"] + [?\} ")"] + ;; string quote ('"') + [?\" "\""] + )))) ;; --------------------- Abbrev table ----------------------------- @@ -111,11 +120,11 @@ (define-key llvm-mode-map "\es" 'center-line) (define-key llvm-mode-map "\eS" 'center-paragraph)) - +;;;###autoload (defun llvm-mode () "Major mode for editing LLVM source files. - \\{llvm-mode-map} - Runs llvm-mode-hook on startup." +\\{llvm-mode-map} + Runs `llvm-mode-hook' on startup." (interactive) (kill-all-local-variables) (use-local-map llvm-mode-map) ; Provides the local keymap. @@ -134,8 +143,9 @@ ; customize the mode with a hook. ;; Associate .ll files with llvm-mode -(setq auto-mode-alist - (append '(("\\.ll$" . llvm-mode)) auto-mode-alist)) +;;;###autoload +(add-to-list 'auto-mode-alist (cons (purecopy "\\.ll\\'") 'llvm-mode)) (provide 'llvm-mode) -;; end of llvm-mode.el + +;;; llvm-mode.el ends here diff --git a/utils/emacs/tablegen-mode.el b/utils/emacs/tablegen-mode.el index c0ae75100bfb8..035455d1b9005 100644 --- a/utils/emacs/tablegen-mode.el +++ b/utils/emacs/tablegen-mode.el @@ -1,12 +1,17 @@ +;;; tablegen-mode.el --- Major mode for TableGen description files (part of LLVM project) + ;; Maintainer: The LLVM team, http://llvm.org/ -;; Description: Major mode for TableGen description files (part of LLVM project) -;; Updated: 2007-12-18 + +;;; Commentary: +;; A major mode for TableGen description files in LLVM. (require 'comint) (require 'custom) (require 'ansi-color) ;; Create mode-specific tables. +;;; Code: + (defvar td-decorators-face 'td-decorators-face "Face method decorators.") (make-face 'td-decorators-face) @@ -93,10 +98,11 @@ (define-key tablegen-mode-map "\es" 'center-line) (define-key tablegen-mode-map "\eS" 'center-paragraph)) +;;;###autoload (defun tablegen-mode () "Major mode for editing TableGen description files. - \\{tablegen-mode-map} - Runs tablegen-mode-hook on startup." +\\{tablegen-mode-map} + Runs `tablegen-mode-hook' on startup." (interactive) (kill-all-local-variables) (use-local-map tablegen-mode-map) ; Provides the local keymap. @@ -117,7 +123,9 @@ ; customize the mode with a hook. ;; Associate .td files with tablegen-mode -(setq auto-mode-alist (append '(("\\.td$" . tablegen-mode)) auto-mode-alist)) +;;;###autoload +(add-to-list 'auto-mode-alist (cons (purecopy "\\.td\\'") 'tablegen-mode)) (provide 'tablegen-mode) -;; end of tablegen-mode.el + +;;; tablegen-mode.el ends here |