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