xref: /aosp_15_r20/external/llvm/utils/vim/syntax/llvm.vim (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker" Vim syntax file
2*9880d681SAndroid Build Coastguard Worker" Language:   llvm
3*9880d681SAndroid Build Coastguard Worker" Maintainer: The LLVM team, http://llvm.org/
4*9880d681SAndroid Build Coastguard Worker" Version:      $Revision$
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerif version < 600
7*9880d681SAndroid Build Coastguard Worker  syntax clear
8*9880d681SAndroid Build Coastguard Workerelseif exists("b:current_syntax")
9*9880d681SAndroid Build Coastguard Worker  finish
10*9880d681SAndroid Build Coastguard Workerendif
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workersyn case match
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker" Types.
15*9880d681SAndroid Build Coastguard Worker" Types also include struct, array, vector, etc. but these don't
16*9880d681SAndroid Build Coastguard Worker" benefit as much from having dedicated highlighting rules.
17*9880d681SAndroid Build Coastguard Workersyn keyword llvmType void half float double x86_fp80 fp128 ppc_fp128
18*9880d681SAndroid Build Coastguard Workersyn keyword llvmType label metadata x86_mmx
19*9880d681SAndroid Build Coastguard Workersyn keyword llvmType type label opaque token
20*9880d681SAndroid Build Coastguard Workersyn match   llvmType /\<i\d\+\>/
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker" Instructions.
23*9880d681SAndroid Build Coastguard Worker" The true and false tokens can be used for comparison opcodes, but it's
24*9880d681SAndroid Build Coastguard Worker" much more common for these tokens to be used for boolean constants.
25*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw
26*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement bitcast br call cmpxchg eq exact extractelement
27*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext
28*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement fptosi fptoui fptrunc free frem fsub getelementptr
29*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue
30*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min
31*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole
32*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement olt one or ord phi ptrtoint resume ret sdiv select
33*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement sext sge sgt shl shufflevector sitofp sle slt srem
34*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement store sub switch trunc udiv ueq uge ugt uitofp ule ult
35*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement umax umin une uno unreachable unwind urem va_arg
36*9880d681SAndroid Build Coastguard Workersyn keyword llvmStatement xchg xor zext
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker" Keywords.
39*9880d681SAndroid Build Coastguard Workersyn keyword llvmKeyword
40*9880d681SAndroid Build Coastguard Worker      \ acq_rel
41*9880d681SAndroid Build Coastguard Worker      \ acquire
42*9880d681SAndroid Build Coastguard Worker      \ addrspace
43*9880d681SAndroid Build Coastguard Worker      \ alias
44*9880d681SAndroid Build Coastguard Worker      \ align
45*9880d681SAndroid Build Coastguard Worker      \ alignstack
46*9880d681SAndroid Build Coastguard Worker      \ alwaysinline
47*9880d681SAndroid Build Coastguard Worker      \ appending
48*9880d681SAndroid Build Coastguard Worker      \ arm_aapcscc
49*9880d681SAndroid Build Coastguard Worker      \ arm_aapcs_vfpcc
50*9880d681SAndroid Build Coastguard Worker      \ arm_apcscc
51*9880d681SAndroid Build Coastguard Worker      \ asm
52*9880d681SAndroid Build Coastguard Worker      \ atomic
53*9880d681SAndroid Build Coastguard Worker      \ available_externally
54*9880d681SAndroid Build Coastguard Worker      \ blockaddress
55*9880d681SAndroid Build Coastguard Worker      \ byval
56*9880d681SAndroid Build Coastguard Worker      \ c
57*9880d681SAndroid Build Coastguard Worker      \ catch
58*9880d681SAndroid Build Coastguard Worker      \ cc
59*9880d681SAndroid Build Coastguard Worker      \ ccc
60*9880d681SAndroid Build Coastguard Worker      \ cleanup
61*9880d681SAndroid Build Coastguard Worker      \ coldcc
62*9880d681SAndroid Build Coastguard Worker      \ common
63*9880d681SAndroid Build Coastguard Worker      \ constant
64*9880d681SAndroid Build Coastguard Worker      \ datalayout
65*9880d681SAndroid Build Coastguard Worker      \ declare
66*9880d681SAndroid Build Coastguard Worker      \ default
67*9880d681SAndroid Build Coastguard Worker      \ define
68*9880d681SAndroid Build Coastguard Worker      \ deplibs
69*9880d681SAndroid Build Coastguard Worker      \ distinct
70*9880d681SAndroid Build Coastguard Worker      \ dllexport
71*9880d681SAndroid Build Coastguard Worker      \ dllimport
72*9880d681SAndroid Build Coastguard Worker      \ except
73*9880d681SAndroid Build Coastguard Worker      \ external
74*9880d681SAndroid Build Coastguard Worker      \ externally_initialized
75*9880d681SAndroid Build Coastguard Worker      \ extern_weak
76*9880d681SAndroid Build Coastguard Worker      \ fastcc
77*9880d681SAndroid Build Coastguard Worker      \ filter
78*9880d681SAndroid Build Coastguard Worker      \ gc
79*9880d681SAndroid Build Coastguard Worker      \ global
80*9880d681SAndroid Build Coastguard Worker      \ hhvmcc
81*9880d681SAndroid Build Coastguard Worker      \ hhvm_ccc
82*9880d681SAndroid Build Coastguard Worker      \ hidden
83*9880d681SAndroid Build Coastguard Worker      \ initialexec
84*9880d681SAndroid Build Coastguard Worker      \ inlinehint
85*9880d681SAndroid Build Coastguard Worker      \ inreg
86*9880d681SAndroid Build Coastguard Worker      \ inteldialect
87*9880d681SAndroid Build Coastguard Worker      \ intel_ocl_bicc
88*9880d681SAndroid Build Coastguard Worker      \ internal
89*9880d681SAndroid Build Coastguard Worker      \ linkonce
90*9880d681SAndroid Build Coastguard Worker      \ linkonce_odr
91*9880d681SAndroid Build Coastguard Worker      \ localdynamic
92*9880d681SAndroid Build Coastguard Worker      \ localexec
93*9880d681SAndroid Build Coastguard Worker      \ local_unnamed_addr
94*9880d681SAndroid Build Coastguard Worker      \ minsize
95*9880d681SAndroid Build Coastguard Worker      \ module
96*9880d681SAndroid Build Coastguard Worker      \ monotonic
97*9880d681SAndroid Build Coastguard Worker      \ msp430_intrcc
98*9880d681SAndroid Build Coastguard Worker      \ musttail
99*9880d681SAndroid Build Coastguard Worker      \ naked
100*9880d681SAndroid Build Coastguard Worker      \ nest
101*9880d681SAndroid Build Coastguard Worker      \ noalias
102*9880d681SAndroid Build Coastguard Worker      \ nocapture
103*9880d681SAndroid Build Coastguard Worker      \ noimplicitfloat
104*9880d681SAndroid Build Coastguard Worker      \ noinline
105*9880d681SAndroid Build Coastguard Worker      \ nonlazybind
106*9880d681SAndroid Build Coastguard Worker      \ noredzone
107*9880d681SAndroid Build Coastguard Worker      \ noreturn
108*9880d681SAndroid Build Coastguard Worker      \ nounwind
109*9880d681SAndroid Build Coastguard Worker      \ optnone
110*9880d681SAndroid Build Coastguard Worker      \ optsize
111*9880d681SAndroid Build Coastguard Worker      \ personality
112*9880d681SAndroid Build Coastguard Worker      \ private
113*9880d681SAndroid Build Coastguard Worker      \ protected
114*9880d681SAndroid Build Coastguard Worker      \ ptx_device
115*9880d681SAndroid Build Coastguard Worker      \ ptx_kernel
116*9880d681SAndroid Build Coastguard Worker      \ readnone
117*9880d681SAndroid Build Coastguard Worker      \ readonly
118*9880d681SAndroid Build Coastguard Worker      \ release
119*9880d681SAndroid Build Coastguard Worker      \ returns_twice
120*9880d681SAndroid Build Coastguard Worker      \ sanitize_address
121*9880d681SAndroid Build Coastguard Worker      \ sanitize_memory
122*9880d681SAndroid Build Coastguard Worker      \ sanitize_thread
123*9880d681SAndroid Build Coastguard Worker      \ section
124*9880d681SAndroid Build Coastguard Worker      \ seq_cst
125*9880d681SAndroid Build Coastguard Worker      \ sideeffect
126*9880d681SAndroid Build Coastguard Worker      \ signext
127*9880d681SAndroid Build Coastguard Worker      \ singlethread
128*9880d681SAndroid Build Coastguard Worker      \ source_filename
129*9880d681SAndroid Build Coastguard Worker      \ spir_func
130*9880d681SAndroid Build Coastguard Worker      \ spir_kernel
131*9880d681SAndroid Build Coastguard Worker      \ sret
132*9880d681SAndroid Build Coastguard Worker      \ ssp
133*9880d681SAndroid Build Coastguard Worker      \ sspreq
134*9880d681SAndroid Build Coastguard Worker      \ sspstrong
135*9880d681SAndroid Build Coastguard Worker      \ swiftcc
136*9880d681SAndroid Build Coastguard Worker      \ tail
137*9880d681SAndroid Build Coastguard Worker      \ target
138*9880d681SAndroid Build Coastguard Worker      \ thread_local
139*9880d681SAndroid Build Coastguard Worker      \ to
140*9880d681SAndroid Build Coastguard Worker      \ triple
141*9880d681SAndroid Build Coastguard Worker      \ unnamed_addr
142*9880d681SAndroid Build Coastguard Worker      \ unordered
143*9880d681SAndroid Build Coastguard Worker      \ uselistorder
144*9880d681SAndroid Build Coastguard Worker      \ uselistorder_bb
145*9880d681SAndroid Build Coastguard Worker      \ uwtable
146*9880d681SAndroid Build Coastguard Worker      \ volatile
147*9880d681SAndroid Build Coastguard Worker      \ weak
148*9880d681SAndroid Build Coastguard Worker      \ weak_odr
149*9880d681SAndroid Build Coastguard Worker      \ x86_64_sysvcc
150*9880d681SAndroid Build Coastguard Worker      \ x86_64_win64cc
151*9880d681SAndroid Build Coastguard Worker      \ x86_fastcallcc
152*9880d681SAndroid Build Coastguard Worker      \ x86_stdcallcc
153*9880d681SAndroid Build Coastguard Worker      \ x86_thiscallcc
154*9880d681SAndroid Build Coastguard Worker      \ zeroext
155*9880d681SAndroid Build Coastguard Worker
156*9880d681SAndroid Build Coastguard Worker" Obsolete keywords.
157*9880d681SAndroid Build Coastguard Workersyn keyword llvmError  getresult begin end
158*9880d681SAndroid Build Coastguard Worker
159*9880d681SAndroid Build Coastguard Worker" Misc syntax.
160*9880d681SAndroid Build Coastguard Workersyn match   llvmNoName /[%@!]\d\+\>/
161*9880d681SAndroid Build Coastguard Workersyn match   llvmNumber /-\?\<\d\+\>/
162*9880d681SAndroid Build Coastguard Workersyn match   llvmFloat  /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/
163*9880d681SAndroid Build Coastguard Workersyn match   llvmFloat  /\<0x\x\+\>/
164*9880d681SAndroid Build Coastguard Workersyn keyword llvmBoolean true false
165*9880d681SAndroid Build Coastguard Workersyn keyword llvmConstant zeroinitializer undef null
166*9880d681SAndroid Build Coastguard Workersyn match   llvmComment /;.*$/
167*9880d681SAndroid Build Coastguard Workersyn region  llvmString start=/"/ skip=/\\"/ end=/"/
168*9880d681SAndroid Build Coastguard Workersyn match   llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/
169*9880d681SAndroid Build Coastguard Workersyn match   llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/
170*9880d681SAndroid Build Coastguard Worker
171*9880d681SAndroid Build Coastguard Worker" Named metadata and specialized metadata keywords.
172*9880d681SAndroid Build Coastguard Workersyn match   llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*$/
173*9880d681SAndroid Build Coastguard Workersyn match   llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*[=!]/
174*9880d681SAndroid Build Coastguard Workersyn match   llvmType /!\zs\a\+\ze\s*(/
175*9880d681SAndroid Build Coastguard Workersyn match   llvmConstant /\<DW_TAG_[a-z_]\+\>/
176*9880d681SAndroid Build Coastguard Workersyn match   llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/
177*9880d681SAndroid Build Coastguard Workersyn match   llvmConstant /\<DW_OP_[a-zA-Z0-9_]\+\>/
178*9880d681SAndroid Build Coastguard Workersyn match   llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/
179*9880d681SAndroid Build Coastguard Workersyn match   llvmConstant /\<DW_VIRTUALITY_[a-z_]\+\>/
180*9880d681SAndroid Build Coastguard Workersyn match   llvmConstant /\<DIFlag[A-Za-z]\+\>/
181*9880d681SAndroid Build Coastguard Worker
182*9880d681SAndroid Build Coastguard Worker" Syntax-highlight lit test commands and bug numbers.
183*9880d681SAndroid Build Coastguard Workersyn match  llvmSpecialComment /;\s*PR\d*\s*$/
184*9880d681SAndroid Build Coastguard Workersyn match  llvmSpecialComment /;\s*REQUIRES:.*$/
185*9880d681SAndroid Build Coastguard Workersyn match  llvmSpecialComment /;\s*RUN:.*$/
186*9880d681SAndroid Build Coastguard Workersyn match  llvmSpecialComment /;\s*XFAIL:.*$/
187*9880d681SAndroid Build Coastguard Worker
188*9880d681SAndroid Build Coastguard Workerif version >= 508 || !exists("did_c_syn_inits")
189*9880d681SAndroid Build Coastguard Worker  if version < 508
190*9880d681SAndroid Build Coastguard Worker    let did_c_syn_inits = 1
191*9880d681SAndroid Build Coastguard Worker    command -nargs=+ HiLink hi link <args>
192*9880d681SAndroid Build Coastguard Worker  else
193*9880d681SAndroid Build Coastguard Worker    command -nargs=+ HiLink hi def link <args>
194*9880d681SAndroid Build Coastguard Worker  endif
195*9880d681SAndroid Build Coastguard Worker
196*9880d681SAndroid Build Coastguard Worker  HiLink llvmType Type
197*9880d681SAndroid Build Coastguard Worker  HiLink llvmStatement Statement
198*9880d681SAndroid Build Coastguard Worker  HiLink llvmNumber Number
199*9880d681SAndroid Build Coastguard Worker  HiLink llvmComment Comment
200*9880d681SAndroid Build Coastguard Worker  HiLink llvmString String
201*9880d681SAndroid Build Coastguard Worker  HiLink llvmLabel Label
202*9880d681SAndroid Build Coastguard Worker  HiLink llvmKeyword Keyword
203*9880d681SAndroid Build Coastguard Worker  HiLink llvmBoolean Boolean
204*9880d681SAndroid Build Coastguard Worker  HiLink llvmFloat Float
205*9880d681SAndroid Build Coastguard Worker  HiLink llvmNoName Identifier
206*9880d681SAndroid Build Coastguard Worker  HiLink llvmConstant Constant
207*9880d681SAndroid Build Coastguard Worker  HiLink llvmSpecialComment SpecialComment
208*9880d681SAndroid Build Coastguard Worker  HiLink llvmError Error
209*9880d681SAndroid Build Coastguard Worker  HiLink llvmIdentifier Identifier
210*9880d681SAndroid Build Coastguard Worker
211*9880d681SAndroid Build Coastguard Worker  delcommand HiLink
212*9880d681SAndroid Build Coastguard Workerendif
213*9880d681SAndroid Build Coastguard Worker
214*9880d681SAndroid Build Coastguard Workerlet b:current_syntax = "llvm"
215