| 1 |
" Vim syntax file |
| 2 |
" Language: llvm |
| 3 |
" Maintainer: The LLVM team, http://llvm.org/ |
| 4 |
" Version: $Revision$ |
| 5 |
|
| 6 |
if version < 600 |
| 7 |
syntax clear |
| 8 |
elseif exists("b:current_syntax") |
| 9 |
finish |
| 10 |
endif |
| 11 |
|
| 12 |
syn case match |
| 13 |
|
| 14 |
" Types. |
| 15 |
" Types also include struct, array, vector, etc. but these don't |
| 16 |
" benefit as much from having dedicated highlighting rules. |
| 17 |
syn keyword llvmType void half bfloat float double x86_fp80 fp128 ppc_fp128 |
| 18 |
syn keyword llvmType label metadata x86_mmx x86_amx |
| 19 |
syn keyword llvmType type label opaque token ptr |
| 20 |
syn match llvmType /\<i\d\+\>/ |
| 21 |
|
| 22 |
" Instructions. |
| 23 |
" The true and false tokens can be used for comparison opcodes, but it's |
| 24 |
" much more common for these tokens to be used for boolean constants. |
| 25 |
syn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw |
| 26 |
syn keyword llvmStatement bitcast br catchpad catchswitch catchret call callbr |
| 27 |
syn keyword llvmStatement cleanuppad cleanupret cmpxchg disjoint eq exact |
| 28 |
syn keyword llvmStatement extractelement extractvalue fadd fast fcmp fdiv fence |
| 29 |
syn keyword llvmStatement fmul fneg fpext fptosi fptoui fptrunc free freeze |
| 30 |
syn keyword llvmStatement frem fsub getelementptr icmp inbounds indirectbr |
| 31 |
syn keyword llvmStatement insertelement insertvalue inttoptr invoke landingpad |
| 32 |
syn keyword llvmStatement load lshr malloc max min mul nand ne ninf nnan nsw |
| 33 |
syn keyword llvmStatement nsz nuw oeq oge ogt ole olt one or ord phi ptrtoint |
| 34 |
syn keyword llvmStatement resume ret sdiv select sext sge sgt shl shufflevector |
| 35 |
syn keyword llvmStatement sitofp sle slt srem store sub switch trunc udiv ueq |
| 36 |
syn keyword llvmStatement uge ugt uitofp ule ult umax umin une uno unreachable |
| 37 |
syn keyword llvmStatement unwind urem va_arg xchg xor zext |
| 38 |
|
| 39 |
" Debug records. |
| 40 |
syn match llvmStatement /\v#dbg_(assign|declare|label|value)/ |
| 41 |
|
| 42 |
" Keywords. |
| 43 |
syn keyword llvmKeyword |
| 44 |
\ acq_rel |
| 45 |
\ acquire |
| 46 |
\ addrspace |
| 47 |
\ alias |
| 48 |
\ align |
| 49 |
\ alignstack |
| 50 |
\ allocsize |
| 51 |
\ alwaysinline |
| 52 |
\ appending |
| 53 |
\ argmemonly |
| 54 |
\ arm_aapcs_vfpcc |
| 55 |
\ arm_aapcscc |
| 56 |
\ arm_apcscc |
| 57 |
\ asm |
| 58 |
\ atomic |
| 59 |
\ available_externally |
| 60 |
\ blockaddress |
| 61 |
\ builtin |
| 62 |
\ byref |
| 63 |
\ byval |
| 64 |
\ c |
| 65 |
\ caller |
| 66 |
\ catch |
| 67 |
\ cc |
| 68 |
\ ccc |
| 69 |
\ cleanup |
| 70 |
\ cold |
| 71 |
\ coldcc |
| 72 |
\ comdat |
| 73 |
\ common |
| 74 |
\ constant |
| 75 |
\ convergent |
| 76 |
\ datalayout |
| 77 |
\ declare |
| 78 |
\ default |
| 79 |
\ define |
| 80 |
\ deplibs |
| 81 |
\ dereferenceable |
| 82 |
\ dereferenceable_or_null |
| 83 |
\ distinct |
| 84 |
\ dllexport |
| 85 |
\ dllimport |
| 86 |
\ dso_local |
| 87 |
\ dso_preemptable |
| 88 |
\ except |
| 89 |
\ extern_weak |
| 90 |
\ external |
| 91 |
\ externally_initialized |
| 92 |
\ fastcc |
| 93 |
\ filter |
| 94 |
\ from |
| 95 |
\ gc |
| 96 |
\ global |
| 97 |
\ hhvm_ccc |
| 98 |
\ hhvmcc |
| 99 |
\ hidden |
| 100 |
\ hot |
| 101 |
\ immarg |
| 102 |
\ inaccessiblemem_or_argmemonly |
| 103 |
\ inaccessiblememonly |
| 104 |
\ inalloca |
| 105 |
\ initialexec |
| 106 |
\ inlinehint |
| 107 |
\ inreg |
| 108 |
\ intel_ocl_bicc |
| 109 |
\ inteldialect |
| 110 |
\ internal |
| 111 |
\ jumptable |
| 112 |
\ linkonce |
| 113 |
\ linkonce_odr |
| 114 |
\ local_unnamed_addr |
| 115 |
\ localdynamic |
| 116 |
\ localexec |
| 117 |
\ minsize |
| 118 |
\ module |
| 119 |
\ monotonic |
| 120 |
\ msp430_intrcc |
| 121 |
\ mustprogress |
| 122 |
\ musttail |
| 123 |
\ naked |
| 124 |
\ nest |
| 125 |
\ noalias |
| 126 |
\ nobuiltin |
| 127 |
\ nocallback |
| 128 |
\ nocapture |
| 129 |
\ nocf_check |
| 130 |
\ no_cfi |
| 131 |
\ noduplicate |
| 132 |
\ nofree |
| 133 |
\ noimplicitfloat |
| 134 |
\ noinline |
| 135 |
\ nomerge |
| 136 |
\ nonlazybind |
| 137 |
\ nonnull |
| 138 |
\ noprofile |
| 139 |
\ norecurse |
| 140 |
\ noredzone |
| 141 |
\ noreturn |
| 142 |
\ nosync |
| 143 |
\ noundef |
| 144 |
\ nounwind |
| 145 |
\ nosanitize_bounds |
| 146 |
\ nosanitize_coverage |
| 147 |
\ null_pointer_is_valid |
| 148 |
\ optdebug |
| 149 |
\ optforfuzzing |
| 150 |
\ optnone |
| 151 |
\ optsize |
| 152 |
\ personality |
| 153 |
\ preallocated |
| 154 |
\ private |
| 155 |
\ protected |
| 156 |
\ ptrauth |
| 157 |
\ ptx_device |
| 158 |
\ ptx_kernel |
| 159 |
\ readnone |
| 160 |
\ readonly |
| 161 |
\ release |
| 162 |
\ returned |
| 163 |
\ returns_twice |
| 164 |
\ safestack |
| 165 |
\ sanitize_address |
| 166 |
\ sanitize_alloc_token |
| 167 |
\ sanitize_hwaddress |
| 168 |
\ sanitize_memory |
| 169 |
\ sanitize_memtag |
| 170 |
\ sanitize_thread |
| 171 |
\ section |
| 172 |
\ seq_cst |
| 173 |
\ shadowcallstack |
| 174 |
\ sideeffect |
| 175 |
\ signext |
| 176 |
\ source_filename |
| 177 |
\ speculatable |
| 178 |
\ speculative_load_hardening |
| 179 |
\ spir_func |
| 180 |
\ spir_kernel |
| 181 |
\ splat |
| 182 |
\ sret |
| 183 |
\ ssp |
| 184 |
\ sspreq |
| 185 |
\ sspstrong |
| 186 |
\ strictfp |
| 187 |
\ swiftcc |
| 188 |
\ swifterror |
| 189 |
\ swifttailcc |
| 190 |
\ swiftself |
| 191 |
\ syncscope |
| 192 |
\ tail |
| 193 |
\ tailcc |
| 194 |
\ target |
| 195 |
\ thread_local |
| 196 |
\ to |
| 197 |
\ triple |
| 198 |
\ unnamed_addr |
| 199 |
\ unordered |
| 200 |
\ uselistorder |
| 201 |
\ uselistorder_bb |
| 202 |
\ uwtable |
| 203 |
\ volatile |
| 204 |
\ weak |
| 205 |
\ weak_odr |
| 206 |
\ willreturn |
| 207 |
\ win64cc |
| 208 |
\ within |
| 209 |
\ writeonly |
| 210 |
\ x86_64_sysvcc |
| 211 |
\ x86_fastcallcc |
| 212 |
\ x86_stdcallcc |
| 213 |
\ x86_thiscallcc |
| 214 |
\ zeroext |
| 215 |
|
| 216 |
" Obsolete keywords. |
| 217 |
syn keyword llvmError getresult begin end |
| 218 |
|
| 219 |
" Misc syntax. |
| 220 |
syn match llvmNoName /[%@!]\d\+\>/ |
| 221 |
syn match llvmNumber /-\?\<\d\+\>/ |
| 222 |
syn match llvmFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/ |
| 223 |
syn match llvmFloat /\<\(u\|s\)\?0x[KLMHR]\?\x\+\>/ |
| 224 |
syn keyword llvmBoolean true false |
| 225 |
syn keyword llvmConstant zeroinitializer undef null none poison vscale |
| 226 |
syn match llvmComment /;.*$/ |
| 227 |
syn region llvmString start=/"/ skip=/\\"/ end=/"/ |
| 228 |
syn match llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ |
| 229 |
syn match llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/ |
| 230 |
|
| 231 |
" Named metadata and specialized metadata keywords. |
| 232 |
syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*$/ |
| 233 |
syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*[=!]/ |
| 234 |
syn match llvmType /!\zs\a\+\ze\s*(/ |
| 235 |
syn match llvmConstant /\<DW_TAG_[a-z_]\+\>/ |
| 236 |
syn match llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/ |
| 237 |
syn match llvmConstant /\<DW_OP_[a-zA-Z0-9_]\+\>/ |
| 238 |
syn match llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/ |
| 239 |
syn match llvmConstant /\<DW_VIRTUALITY_[a-z_]\+\>/ |
| 240 |
syn match llvmConstant /\<DIFlag[A-Za-z]\+\>/ |
| 241 |
|
| 242 |
" Syntax-highlight lit test commands and bug numbers. |
| 243 |
syn match llvmSpecialComment /;\s*PR\d*\s*$/ |
| 244 |
syn match llvmSpecialComment /;\s*REQUIRES:.*$/ |
| 245 |
syn match llvmSpecialComment /;\s*RUN:.*$/ |
| 246 |
syn match llvmSpecialComment /;\s*ALLOW_RETRIES:.*$/ |
| 247 |
syn match llvmSpecialComment /;\s*CHECK:.*$/ |
| 248 |
syn match llvmSpecialComment /;\s*CHECK-EMPTY:\s*$/ |
| 249 |
syn match llvmSpecialComment /\v;\s*CHECK-(NEXT|NOT|DAG|SAME|LABEL|COUNT-\d+):.*$/ |
| 250 |
syn match llvmSpecialComment /;\s*XFAIL:.*$/ |
| 251 |
|
| 252 |
if version >= 508 || !exists("did_c_syn_inits") |
| 253 |
if version < 508 |
| 254 |
let did_c_syn_inits = 1 |
| 255 |
command -nargs=+ HiLink hi link <args> |
| 256 |
else |
| 257 |
command -nargs=+ HiLink hi def link <args> |
| 258 |
endif |
| 259 |
|
| 260 |
HiLink llvmType Type |
| 261 |
HiLink llvmStatement Statement |
| 262 |
HiLink llvmNumber Number |
| 263 |
HiLink llvmComment Comment |
| 264 |
HiLink llvmString String |
| 265 |
HiLink llvmLabel Label |
| 266 |
HiLink llvmKeyword Keyword |
| 267 |
HiLink llvmBoolean Boolean |
| 268 |
HiLink llvmFloat Float |
| 269 |
HiLink llvmNoName Identifier |
| 270 |
HiLink llvmConstant Constant |
| 271 |
HiLink llvmSpecialComment SpecialComment |
| 272 |
HiLink llvmError Error |
| 273 |
HiLink llvmIdentifier Identifier |
| 274 |
|
| 275 |
delcommand HiLink |
| 276 |
endif |
| 277 |
|
| 278 |
let b:current_syntax = "llvm" |