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 float double 18syn keyword llvmType x86_fp80 fp128 ppc_fp128 19syn keyword llvmType type label opaque 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 fadd sub fsub mul fmul 26syn keyword llvmStatement sdiv udiv fdiv srem urem frem 27syn keyword llvmStatement and or xor 28syn keyword llvmStatement icmp fcmp 29syn keyword llvmStatement eq ne ugt uge ult ule sgt sge slt sle 30syn keyword llvmStatement oeq ogt oge olt ole one ord ueq ugt uge 31syn keyword llvmStatement ult ule une uno 32syn keyword llvmStatement nuw nsw exact inbounds 33syn keyword llvmStatement phi call select shl lshr ashr va_arg 34syn keyword llvmStatement trunc zext sext 35syn keyword llvmStatement fptrunc fpext fptoui fptosi uitofp sitofp 36syn keyword llvmStatement ptrtoint inttoptr bitcast 37syn keyword llvmStatement ret br indirectbr switch invoke unwind unreachable 38syn keyword llvmStatement malloc alloca free load store getelementptr 39syn keyword llvmStatement extractelement insertelement shufflevector 40syn keyword llvmStatement extractvalue insertvalue 41 42" Keywords. 43syn keyword llvmKeyword define declare global constant 44syn keyword llvmKeyword internal external private 45syn keyword llvmKeyword linkonce linkonce_odr weak weak_odr appending 46syn keyword llvmKeyword common extern_weak 47syn keyword llvmKeyword thread_local dllimport dllexport 48syn keyword llvmKeyword hidden protected default 49syn keyword llvmKeyword except deplibs 50syn keyword llvmKeyword volatile fastcc coldcc cc ccc 51syn keyword llvmKeyword x86_stdcallcc x86_fastcallcc 52syn keyword llvmKeyword ptx_kernel ptx_device 53syn keyword llvmKeyword signext zeroext inreg sret nounwind noreturn 54syn keyword llvmKeyword nocapture byval nest readnone readonly noalias uwtable 55syn keyword llvmKeyword inlinehint noinline alwaysinline optsize ssp sspreq 56syn keyword llvmKeyword noredzone noimplicitfloat naked alignstack 57syn keyword llvmKeyword module asm align tail to 58syn keyword llvmKeyword addrspace section alias sideeffect c gc 59syn keyword llvmKeyword target datalayout triple 60syn keyword llvmKeyword blockaddress 61 62" Obsolete keywords. 63syn keyword llvmError getresult begin end 64 65" Misc syntax. 66syn match llvmNoName /[%@]\d\+\>/ 67syn match llvmNumber /-\?\<\d\+\>/ 68syn match llvmFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/ 69syn match llvmFloat /\<0x\x\+\>/ 70syn keyword llvmBoolean true false 71syn keyword llvmConstant zeroinitializer undef null 72syn match llvmComment /;.*$/ 73syn region llvmString start=/"/ skip=/\\"/ end=/"/ 74syn match llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ 75syn match llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/ 76 77" Syntax-highlight dejagnu test commands. 78syn match llvmSpecialComment /;\s*RUN:.*$/ 79syn match llvmSpecialComment /;\s*PR\d*\s*$/ 80syn match llvmSpecialComment /;\s*END\.\s*$/ 81syn match llvmSpecialComment /;\s*XFAIL:.*$/ 82syn match llvmSpecialComment /;\s*XTARGET:.*$/ 83 84if version >= 508 || !exists("did_c_syn_inits") 85 if version < 508 86 let did_c_syn_inits = 1 87 command -nargs=+ HiLink hi link <args> 88 else 89 command -nargs=+ HiLink hi def link <args> 90 endif 91 92 HiLink llvmType Type 93 HiLink llvmStatement Statement 94 HiLink llvmNumber Number 95 HiLink llvmComment Comment 96 HiLink llvmString String 97 HiLink llvmLabel Label 98 HiLink llvmKeyword Keyword 99 HiLink llvmBoolean Boolean 100 HiLink llvmFloat Float 101 HiLink llvmNoName Identifier 102 HiLink llvmConstant Constant 103 HiLink llvmSpecialComment SpecialComment 104 HiLink llvmError Error 105 HiLink llvmIdentifier Identifier 106 107 delcommand HiLink 108endif 109 110let b:current_syntax = "llvm" 111