annotate contrib/gimple.vim @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 " Syntax highlighting rules for GIMPLE dump files (for Vim).
kono
parents:
diff changeset
2 "
kono
parents:
diff changeset
3 " Copyright (C) 2015 Free Software Foundation, Inc.
kono
parents:
diff changeset
4 "
kono
parents:
diff changeset
5 " This script is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
6 " it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
7 " the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
8 " any later version
kono
parents:
diff changeset
9 "
kono
parents:
diff changeset
10 " This Vim script highlights syntax in debug dumps containing GIMPLE
kono
parents:
diff changeset
11 " intermediate representation. Such dumps are produced by GCC when
kono
parents:
diff changeset
12 " it is invoked with -fdump-tree-* and/or -fdump-ipa-* switches. Tested
kono
parents:
diff changeset
13 " in Vim 7.4 (but should also work with earlier versions).
kono
parents:
diff changeset
14 "
kono
parents:
diff changeset
15 " INSTALLATION:
kono
parents:
diff changeset
16 " 1. Copy the script into $HOME/.vim/syntax directory
kono
parents:
diff changeset
17 " 2. Create a file gimple.vim in $HOME/.vim/ftdetect directory with the
kono
parents:
diff changeset
18 " following command in it:
kono
parents:
diff changeset
19 "
kono
parents:
diff changeset
20 " au BufRead,BufNewFile *.[0-2][0-9][0-9][ti].* set filetype=gimple
kono
parents:
diff changeset
21 "
kono
parents:
diff changeset
22 " The pattern in this autocommand corresponds to default file names
kono
parents:
diff changeset
23 " of debug dumps, e.g.:
kono
parents:
diff changeset
24 " filename.cc.123t.pass-name
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 " Do not continue, if syntax is already enabled in current buffer.
kono
parents:
diff changeset
28 if exists("b:current_syntax")
kono
parents:
diff changeset
29 finish
kono
parents:
diff changeset
30 endif
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 " If this variable is set to true, "Unknown tree" in -fdump-tree-original will
kono
parents:
diff changeset
33 " be highlighted as an error.
kono
parents:
diff changeset
34 let s:unknown_tree_is_error=0
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 " Comments for Phi nodes, value ranges, use/def-chains, etc.
kono
parents:
diff changeset
37 syn match gimpleAnnotation "\v#.*$"
kono
parents:
diff changeset
38 \ contains=gimpleAnnotationOp, gimpleAnnotationMark,
kono
parents:
diff changeset
39 \ gimpleNumber, gimpleLineNo
kono
parents:
diff changeset
40 syn match gimpleAnnotationMark "#" contained
kono
parents:
diff changeset
41 syn keyword gimpleAnnotationOp PHI VUSE VDEF RANGE PT USE CLB
kono
parents:
diff changeset
42 \ ALIGN MISALIGN NONZERO contained
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 " General-purpose comments.
kono
parents:
diff changeset
45 syn match gimpleComment ";;.*$"
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 " Types - mostly borrowed from original Vim syntax file for C
kono
parents:
diff changeset
48 syn keyword gimpleType int long short char void
kono
parents:
diff changeset
49 \ signed unsigned float double
kono
parents:
diff changeset
50 \ size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t
kono
parents:
diff changeset
51 \ clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
kono
parents:
diff changeset
52 \ mbstate_t wctrans_t wint_t wctype_t
kono
parents:
diff changeset
53 \ _Bool bool _Complex complex _Imaginary imaginary
kono
parents:
diff changeset
54 \ int8_t int16_t int32_t int64_t
kono
parents:
diff changeset
55 \ uint8_t uint16_t uint32_t uint64_t
kono
parents:
diff changeset
56 \ int_least8_t int_least16_t int_least32_t int_least64_t
kono
parents:
diff changeset
57 \ uint_least8_t uint_least16_t uint_least32_t uint_least64_t
kono
parents:
diff changeset
58 \ int_fast8_t int_fast16_t int_fast32_t int_fast64_t
kono
parents:
diff changeset
59 \ uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
kono
parents:
diff changeset
60 \ intptr_t uintptr_t
kono
parents:
diff changeset
61 \ intmax_t uintmax_t
kono
parents:
diff changeset
62 \ __label__ __complex__ __volatile__
kono
parents:
diff changeset
63 \ char16_t char32_t sizetype __vtbl_ptr_type
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 " C/C++-like control structures
kono
parents:
diff changeset
66 syn keyword gimpleStatement goto return
kono
parents:
diff changeset
67 syn keyword gimpleConditional if else
kono
parents:
diff changeset
68 syn keyword gimpleLoop while
kono
parents:
diff changeset
69 syn keyword gimpleException try catch finally
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 " Special 'values'
kono
parents:
diff changeset
72 syn match gimpleConstant "{CLOBBER}"
kono
parents:
diff changeset
73 syn match gimpleConstant "{ref-all}"
kono
parents:
diff changeset
74 syn match gimpleConstant "{v}"
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 " Blocks
kono
parents:
diff changeset
77 syn region gimpleBlock start="{" end="}" transparent fold
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 " String literals
kono
parents:
diff changeset
80 syn region gimpleString start=/\v"/ skip=/\v\\./ end=/\v"/
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 " GENERIC AST nodes
kono
parents:
diff changeset
83 syn keyword gimpleASTNode BIT_FIELD_REF TARGET_EXPR expr_stmt
kono
parents:
diff changeset
84 \ NON_LVALUE_EXPR
kono
parents:
diff changeset
85 \ must_not_throw_expr eh_spec_block eh_filter
kono
parents:
diff changeset
86 \ eh_must_not_throw aggr_init_expr cleanup_point
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 if s:unknown_tree_is_error
kono
parents:
diff changeset
89 syn match gimpleUnknownTree "\vUnknown tree: \w+"
kono
parents:
diff changeset
90 end
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 " Numbers
kono
parents:
diff changeset
93 syn match gimpleNumber "\v([^.a-zA-Z0-9_])\zs-?\d+B?"
kono
parents:
diff changeset
94 syn match gimpleFloat "\v\W\zs-?\d*\.\d+(e\+\d+)?"
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 " Basic block label
kono
parents:
diff changeset
97 " <bb 123>:
kono
parents:
diff changeset
98 syn match gimpleLabel "\v^\s*\zs\<bb \d+\>"
kono
parents:
diff changeset
99 " <D.1234>:
kono
parents:
diff changeset
100 " <L1>:
kono
parents:
diff changeset
101 syn match gimpleLabel "\v^\s*\zs\<[DL]\.?\d+\>"
kono
parents:
diff changeset
102 " label: - user-defined label
kono
parents:
diff changeset
103 " bb1L.1:
kono
parents:
diff changeset
104 syn match gimpleLabel "\v^\s*[a-zA-Z0-9._]+\ze:\s*$"
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 " Match label after goto to suppress highlighting of numbers inside
kono
parents:
diff changeset
107 syn match gimpleGotoLabel "\v<bb \d+\>[^:]"
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 " Line numbers, generated with -fdump-tree-*-lineno
kono
parents:
diff changeset
110 syn match gimpleLineNo "\v\[[^\]]+:\d+:\d+\]"
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 " Misc C/C++-like keywords
kono
parents:
diff changeset
113 syn keyword gimpleStructure struct union enum typedef class
kono
parents:
diff changeset
114 syn keyword gimpleStorageClass static register auto volatile extern const
kono
parents:
diff changeset
115 \ template inline __attribute__ _Alignas alignas _Atomic
kono
parents:
diff changeset
116 \ _Thread_local thread_local _Alignof alignof sizeof
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 hi def link gimpleType Type
kono
parents:
diff changeset
119 hi def link gimpleNumber Number
kono
parents:
diff changeset
120 hi def link gimpleFloat Float
kono
parents:
diff changeset
121 hi def link gimpleConstant Constant
kono
parents:
diff changeset
122 hi def link gimpleStructure Structure
kono
parents:
diff changeset
123 hi def link gimpleStorageClass StorageClass
kono
parents:
diff changeset
124 hi def link gimpleOperator Operator
kono
parents:
diff changeset
125 hi def link gimpleASTNode Operator
kono
parents:
diff changeset
126 hi def link gimpleStatement Statement
kono
parents:
diff changeset
127 hi def link gimpleConditional Conditional
kono
parents:
diff changeset
128 hi def link gimpleLoop Repeat
kono
parents:
diff changeset
129 hi def link gimpleException Exception
kono
parents:
diff changeset
130 hi def link gimpleComment Comment
kono
parents:
diff changeset
131 hi def link gimpleLineNo Comment
kono
parents:
diff changeset
132 hi def link gimpleLabel Label
kono
parents:
diff changeset
133 hi def link gimpleAnnotationOp Debug
kono
parents:
diff changeset
134 hi def link gimpleAnnotationMark Debug
kono
parents:
diff changeset
135 hi def link gimpleString String
kono
parents:
diff changeset
136 hi def link gimpleUnknownTree Error
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 let b:current_syntax = "gimple"
kono
parents:
diff changeset
139