diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2018-06-29 16:14:46 +0300 |
---|---|---|
committer | Alexander Monakov <amonakov@gcc.gnu.org> | 2018-06-29 16:14:46 +0300 |
commit | b33aa7209ed570864189dba4c070565ea4a1554b (patch) | |
tree | 052a406156c840221fbe3195518162676c678667 /contrib/vim-gcc-dev/syntax | |
parent | 8864590b7cad2b491407069d94068b65359e78c0 (diff) | |
download | gcc-b33aa7209ed570864189dba4c070565ea4a1554b.zip gcc-b33aa7209ed570864189dba4c070565ea4a1554b.tar.gz gcc-b33aa7209ed570864189dba4c070565ea4a1554b.tar.bz2 |
contrib: introduce Vim addon directory, add match.pd syntax plugin
* 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
Diffstat (limited to 'contrib/vim-gcc-dev/syntax')
-rw-r--r-- | contrib/vim-gcc-dev/syntax/gcc-match.vim | 71 | ||||
-rw-r--r-- | contrib/vim-gcc-dev/syntax/gcc-rtl.vim | 77 | ||||
-rw-r--r-- | contrib/vim-gcc-dev/syntax/gimple.vim | 146 |
3 files changed, 294 insertions, 0 deletions
diff --git a/contrib/vim-gcc-dev/syntax/gcc-match.vim b/contrib/vim-gcc-dev/syntax/gcc-match.vim new file mode 100644 index 0000000..356b07a --- /dev/null +++ b/contrib/vim-gcc-dev/syntax/gcc-match.vim @@ -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" diff --git a/contrib/vim-gcc-dev/syntax/gcc-rtl.vim b/contrib/vim-gcc-dev/syntax/gcc-rtl.vim new file mode 100644 index 0000000..6b674e0 --- /dev/null +++ b/contrib/vim-gcc-dev/syntax/gcc-rtl.vim @@ -0,0 +1,77 @@ +" Syntax highlighting rules for RTL dump files (for Vim). +" +" 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 + + +" Do not continue, if syntax is already enabled in current buffer. +if exists("b:current_syntax") + finish +endif + +" General-purpose comments. +syn match rtlComment ";;.*$" + +syn keyword rtlInstruction debug_expr insn_list int_list sequence + \ address debug_insn insn expr_list + \ jump_table_data barrier code_label + \ cond_exec parallel asm_input asm_operands + \ unspec unspec_volatile addr_vec + \ addr_diff_vec prefetch set use clobber + \ call return simple_return eh_return + \ trap_if scratch strict_low_part concat concatn + \ mem label_ref symbol_ref cc0 compare plus minus + \ neg mult ss_mult us_mult div ss_div us_div mod + \ udiv umod and ior xor not ashift rotate ashiftrt + \ lshiftrt rotatert smin smax umin umax pre_dec + \ pre_inc post_dec post_inc pre_modify post_modify + \ unordered ordered uneq unge ungt unle unlt ltgt sign_extend + \ zero_extend truncate float_extend float_truncate + \ float fix unsigned_float unsigned_fix fract_convert + \ unsigned_fract_convert sat_fract unsigned_sat_fract + \ abs sqrt bswap ffs clrsb clz ctz popcount parity + \ sign_extract zero_extract high lo_sum vec_merge + \ vec_select vec_concat vec_duplicate vec_series ss_plus + \ us_plus ss_minus ss_neg us_neg ss_abs ss_ashift + \ us_ashift us_minus ss_truncate us_truncate fma + \ entry_value exclusion_set presence_set final_presence_set + \ absence_set final_absence_set automata_option attr set_attr + \ set_attr_alternative eq_attr eq_attr_alt attr_flag cond +syn keyword rtlConditional call_insn jump_insn if_then_else + \ eq ne gt gtu lt ltu ge geu le leu +syn keyword rtlNote note barrier code_label +syn keyword rtlVariableLoation var_location +syn keyword rtlPcRegister pc + +syn keyword rtlModes VOID BLK BI QI HI SI DI TI SF DF CC QQ HQ SQ + \ DQ TQ UQQ UHQ USQ UDQ UTQ HA SA DA TA UHA + \ USA UDA UTA SD DD TD + +" String literals +syn region rtlString start=/\v"/ skip=/\v\\./ end=/\v"/ + +syn match rtlNoteInsn "NOTE_INSN_[A-Z_]*" +syn match rtlIntegerConstant "\vconst_int -?\d+" +syn match rtlFloatConstant "\vconst_double:[A-Z]+ -?\d*\.\d+(e\+\d+)?" +syn match rtlRegister "\vreg(\/[a-z])?:[A-Z0-9]+ \d+ [a-z0-9]+" +syn match rtlLocation /\v"[^"]*":\d+/ + +hi def link rtlInstruction Statement +hi def link rtlConditional Conditional +hi def link rtlNote Debug +hi def link rtlNoteInsn Debug +hi def link rtlIntegerConstant Number +hi def link rtlFloatConstant Number +hi def link rtlRegister Type +hi def link rtlPcRegister Type +hi def link rtlModes Type +hi def link rtlVariableLoation Debug +hi def link rtlComment Comment +hi def link rtlLocation Debug +hi def link rtlString String + +let b:current_syntax = "gcc-rtl" diff --git a/contrib/vim-gcc-dev/syntax/gimple.vim b/contrib/vim-gcc-dev/syntax/gimple.vim new file mode 100644 index 0000000..6a0150d --- /dev/null +++ b/contrib/vim-gcc-dev/syntax/gimple.vim @@ -0,0 +1,146 @@ +" Syntax highlighting rules for GIMPLE dump files (for Vim). +" +" Copyright (C) 2015 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 +" +" This Vim script highlights syntax in debug dumps containing GIMPLE +" 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). + + +" Do not continue, if syntax is already enabled in current buffer. +if exists("b:current_syntax") + finish +endif + +" If this variable is set to true, "Unknown tree" in -fdump-tree-original will +" be highlighted as an error. +let s:unknown_tree_is_error=0 + +" Comments for Phi nodes, value ranges, use/def-chains, etc. +syn match gimpleAnnotation "\v#.*$" + \ contains=gimpleAnnotationOp, gimpleAnnotationMark, + \ gimpleNumber, gimpleLineNo +syn match gimpleAnnotationMark "#" contained +syn keyword gimpleAnnotationOp PHI VUSE VDEF RANGE PT USE CLB + \ ALIGN MISALIGN NONZERO contained + +" General-purpose comments. +syn match gimpleComment ";;.*$" + +" Types - mostly borrowed from original Vim syntax file for C +syn keyword gimpleType int long short char void + \ signed unsigned float double + \ size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t + \ clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t + \ mbstate_t wctrans_t wint_t wctype_t + \ _Bool bool _Complex complex _Imaginary imaginary + \ int8_t int16_t int32_t int64_t + \ uint8_t uint16_t uint32_t uint64_t + \ int_least8_t int_least16_t int_least32_t int_least64_t + \ uint_least8_t uint_least16_t uint_least32_t uint_least64_t + \ int_fast8_t int_fast16_t int_fast32_t int_fast64_t + \ uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t + \ intptr_t uintptr_t + \ intmax_t uintmax_t + \ __label__ __complex__ __volatile__ + \ char16_t char32_t sizetype __vtbl_ptr_type + +" C/C++-like control structures +syn keyword gimpleStatement goto return +syn keyword gimpleConditional if else +syn keyword gimpleLoop while +syn keyword gimpleException try catch finally + +" Special 'values' +syn match gimpleConstant "{CLOBBER}" +syn match gimpleConstant "{ref-all}" +syn match gimpleConstant "{v}" + +" Blocks +syn region gimpleBlock start="{" end="}" transparent fold + +" String literals +syn region gimpleString start=/\v"/ skip=/\v\\./ end=/\v"/ + +" GENERIC AST nodes +syn keyword gimpleASTNode BIT_FIELD_REF TARGET_EXPR expr_stmt + \ NON_LVALUE_EXPR + \ must_not_throw_expr eh_spec_block eh_filter + \ eh_must_not_throw aggr_init_expr cleanup_point + +if s:unknown_tree_is_error + syn match gimpleUnknownTree "\vUnknown tree: \w+" +end + +" Ignore probability of edges and basic blocks +" <bb 2> [70.00%]: +syn match gimpleFrequency " \[\d*\.\d*%\]" + +" Ignore basic block with a count +" <bb 10> [local count: 118111601]: +syn match gimpleBBCount "\v\[(local )?count: \d+\]" + +" Numbers +syn match gimpleNumber "\v([^.a-zA-Z0-9_])\zs-?\d+B?" +syn match gimpleFloat "\v\W\zs-?\d*\.\d+(e\+\d+)?" + +" Basic block label +" <bb 123>: +syn match gimpleLabel "\v^\s*\zs\<bb \d+\>" +" <D.1234>: +" <L1>: +syn match gimpleLabel "\v^\s*\zs\<[DL]\.?\d+\>" +" label: - user-defined label +" bb1L.1: +syn match gimpleLabel "\v^\s*[a-zA-Z0-9._]+\ze:\s*$" + +" Match label after goto to suppress highlighting of numbers inside +syn match gimpleGotoLabel "\v<bb \d+\>[^:]" + +" Line numbers, generated with -fdump-tree-*-lineno +syn match gimpleLineNo "\v\[[^\]]+:\d+:\d+\]" + +" DEBUG statements +syn match gimpleDebug "\v# DEBUG.*" + +" GIMPLE predict statement +syn match gimplePrediction "\v\/\/ predicted.*" + + +" Misc C/C++-like keywords +syn keyword gimpleStructure struct union enum typedef class +syn keyword gimpleStorageClass static register auto volatile extern const + \ template inline __attribute__ _Alignas alignas _Atomic + \ _Thread_local thread_local _Alignof alignof sizeof + +hi def link gimpleType Type +hi def link gimpleNumber Number +hi def link gimpleFloat Float +hi def link gimpleConstant Constant +hi def link gimpleStructure Structure +hi def link gimpleStorageClass StorageClass +hi def link gimpleOperator Operator +hi def link gimpleASTNode Operator +hi def link gimpleStatement Statement +hi def link gimpleConditional Conditional +hi def link gimpleLoop Repeat +hi def link gimpleException Exception +hi def link gimpleComment Comment +hi def link gimpleLineNo Comment +hi def link gimpleLabel Label +hi def link gimpleAnnotationOp Debug +hi def link gimpleAnnotationMark Debug +hi def link gimpleString String +hi def link gimpleUnknownTree Error +hi def link gimpleDebug Debug +hi def link gimplePrediction Debug +hi def link gimpleFrequency Debug +hi def link gimpleBBCount Debug + +let b:current_syntax = "gimple" |