]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
contrib: introduce Vim addon directory, add match.pd syntax plugin
authorAlexander Monakov <amonakov@ispras.ru>
Fri, 29 Jun 2018 13:14:46 +0000 (16:14 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Fri, 29 Jun 2018 13:14:46 +0000 (16:14 +0300)
* vim-gcc-dev/README: New file.
* vim-gcc-dev/ftdetect/gcc-dev.vim: New file.
* vim-gcc-dev/syntax/gcc-match.vim: New file.
* gimple.vim: Move under vim-gcc-dev/syntax/.
* gcc-rtl.vim: Likewise.

From-SVN: r262249

contrib/ChangeLog
contrib/vim-gcc-dev/README [new file with mode: 0644]
contrib/vim-gcc-dev/ftdetect/gcc-dev.vim [new file with mode: 0644]
contrib/vim-gcc-dev/syntax/gcc-match.vim [new file with mode: 0644]
contrib/vim-gcc-dev/syntax/gcc-rtl.vim [moved from contrib/gcc-rtl.vim with 98% similarity]
contrib/vim-gcc-dev/syntax/gimple.vim [moved from contrib/gimple.vim with 93% similarity]

index 01dc237c65e6802b78af673d66a9aeace49f91f7..17e9fb2b59f24ec9b01f8e7cc337ac151a88a42e 100644 (file)
@@ -1,3 +1,11 @@
+2018-06-19  Alexander Monakov  <amonakov@ispras.ru>
+
+       * vim-gcc-dev/README: New file.
+       * vim-gcc-dev/ftdetect/gcc-dev.vim: New file.
+       * vim-gcc-dev/syntax/gcc-match.vim: New file.
+       * gimple.vim: Move under vim-gcc-dev/syntax/.
+       * gcc-rtl.vim: Likewise.
+
 2018-06-19  Martin Liska  <mliska@suse.cz>
 
        * gcc-rtl.vim: New file.
diff --git a/contrib/vim-gcc-dev/README b/contrib/vim-gcc-dev/README
new file mode 100644 (file)
index 0000000..29bbf48
--- /dev/null
@@ -0,0 +1,13 @@
+This directory serves as a simple Vim addon for GCC development.  It can be
+symlinked or copied into Vim plugin directory as any other plugin.  For
+example, if using vim-pathogen plugin manager:
+
+    ln -s /path/to/gcc/contrib/vim-gcc-dev ~/.vim/bundle/
+
+This adds syntax highlighting rules for the match.pd file and GIMPLE/RTL dumps.
+
+You can also use RTL syntax rules for GCC machine desciption files by adding
+
+    autocmd BufRead *.md  setf gcc-rtl
+
+to your ~/.vimrc file.
diff --git a/contrib/vim-gcc-dev/ftdetect/gcc-dev.vim b/contrib/vim-gcc-dev/ftdetect/gcc-dev.vim
new file mode 100644 (file)
index 0000000..ed6989a
--- /dev/null
@@ -0,0 +1,20 @@
+" Vim file type detection rules for GCC development
+"
+" Copyright (C) 2018 Free Software Foundation, Inc.
+"
+" This script is free software; you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation; either version 3, or (at your option)
+" any later version
+
+augroup filetypedetect
+
+  au BufRead match.pd                setf gcc-match
+
+  " Match RTL dump file names such as test.c.234r.pass-name
+  au BufRead *.[1-3][0-9][0-9]r.*    setf gcc-rtl
+
+  " Match GIMPLE and IPA dump file names
+  au BufRead *.[0-2][0-9][0-9][ti].* setf gimple
+
+augroup END
diff --git a/contrib/vim-gcc-dev/syntax/gcc-match.vim b/contrib/vim-gcc-dev/syntax/gcc-match.vim
new file mode 100644 (file)
index 0000000..356b07a
--- /dev/null
@@ -0,0 +1,71 @@
+" Vim syntax highlighting rules for GCC match-and-simplify language.
+"
+" Copyright (C) 2018 Free Software Foundation, Inc.
+"
+" This script is free software; you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation; either version 3, or (at your option)
+" any later version
+
+if exists("b:current_syntax")
+    finish
+endif
+
+" Some keywords have a question mark, e.g. 'convert?'
+setl isk=@,48-57,_,?
+
+syn keyword pdTodo contained TODO FIXME XXX
+
+syn keyword pdCtrl match simplify
+syn keyword pdCtrl define_predicates define_operator_list
+syn keyword pdCtrl if switch for with
+
+syn keyword pdType type
+
+syn keyword pdOp view_convert view_convert?
+               \ convert convert? convert1 convert2 convert1? convert2?
+               \ realpart imagpart
+               \ cond vec_cond vec_perm
+               \ pointer_plus pointer_diff
+               \ plus minus mult mult_highpart
+               \ trunc_div ceil_div floor_div round_div
+               \ trunc_mod ceil_mod floor_mod round_mod
+               \ rdiv exact_div
+               \ fix_trunc float negate min max abs absu
+               \ lshift rshift lrotate rrotate
+               \ bit_ior bit_xor bit_and bit_not
+               \ truth_andif truth_orif truth_and
+               \ truth_or truth_xor truth_not
+               \ lt le gt ge eq ne unordered ordered
+               \ unlt unle ungt unge uneq ltgt
+               \ addr_space_convert fixed_convert
+               \ bit_insert complex conj
+               \ reduc_max reduc_min reduc_plus
+               \ dot_prod widen_sum sad fma
+               \ widen_mult widen_mult_plus widen_mult_minus widen_lshift
+               \ vec_widen_mult_hi vec_widen_mult_lo
+               \ vec_widen_mult_even vec_widen_mult_odd
+               \ vec_unpack_hi vec_unpack_lo
+               \ vec_unpack_float_hi vec_unpack_float_lo
+               \ vec_pack_trunc vec_pack_sat vec_pack_fix_trunc
+               \ vec_widen_lshift_hi vec_widen_lshift_lo
+
+" Match commutative/single-use specifiers: :C, :c, :s, :cs, etc.
+syn match pdOpSpec  ":[CcSs]\+\>"
+
+syn match pdCapture "@@\?[a-zA-Z0-9_]\+"
+
+syn region pdComment start="/\*" end="\*/" contains=pdTodo
+
+syn region pdPreProc start="^\s*#" skip="\\$" end="$" keepend
+
+hi def link pdCtrl    Statement
+hi def link pdType    Identifier
+hi def link pdOp      Constant
+hi def link pdOpSpec  Operator
+hi def link pdCapture Special
+hi def link pdComment Comment
+hi def link pdTodo    Todo
+hi def link pdPreProc PreProc
+
+let b:current_syntax = "gcc-match"
similarity index 98%
rename from contrib/gcc-rtl.vim
rename to contrib/vim-gcc-dev/syntax/gcc-rtl.vim
index c9070a2493f6bf85a87ff9bbce0ee8953719d8ad..6b674e0285b5d5f873c76b2fda2019a14caaea7a 100644 (file)
@@ -6,8 +6,6 @@
 " it under the terms of the GNU General Public License as published by
 " the Free Software Foundation; either version 3, or (at your option)
 " any later version
-"
-" For more instructions please see gimple.vim file in the same folder.
 
 
 " Do not continue, if syntax is already enabled in current buffer.
similarity index 93%
rename from contrib/gimple.vim
rename to contrib/vim-gcc-dev/syntax/gimple.vim
index bee1319e57593196d64787a92308044c24d526dd..6a0150d6f4ea94a4559c21f1273d3ebcfaeec6bb 100644 (file)
 " intermediate representation.  Such dumps are produced by GCC when
 " it is invoked with -fdump-tree-* and/or -fdump-ipa-* switches.  Tested
 " in Vim 7.4 (but should also work with earlier versions).
-"
-" INSTALLATION:
-" 1. Copy the script into $HOME/.vim/syntax directory
-" 2. Create a file gimple.vim in $HOME/.vim/ftdetect directory with the
-"    following command in it:
-"
-" au BufRead,BufNewFile *.[0-2][0-9][0-9][ti].* set filetype=gimple
-"
-" The pattern in this autocommand corresponds to default file names
-" of debug dumps, e.g.:
-" filename.cc.123t.pass-name
 
 
 " Do not continue, if syntax is already enabled in current buffer.
@@ -155,4 +144,3 @@ hi def link gimpleFrequency     Debug
 hi def link gimpleBBCount       Debug
 
 let b:current_syntax = "gimple"
-