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 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 acq_rel acquire sanitize_address addrspace alias align 40syn keyword llvmKeyword alignstack alwaysinline appending arm_aapcs_vfpcc 41syn keyword llvmKeyword arm_aapcscc arm_apcscc asm atomic available_externally 42syn keyword llvmKeyword blockaddress byval c catch cc ccc cleanup coldcc common 43syn keyword llvmKeyword constant datalayout declare default define deplibs 44syn keyword llvmKeyword distinct dllexport dllimport except extern_weak external 45syn keyword llvmKeyword externally_initialized fastcc filter gc global hhvmcc 46syn keyword llvmKeyword hhvm_ccc hidden initialexec inlinehint inreg 47syn keyword llvmKeyword intel_ocl_bicc inteldialect internal linkonce 48syn keyword llvmKeyword linkonce_odr localdynamic localexec minsize module 49syn keyword llvmKeyword monotonic msp430_intrcc musttail naked nest 50syn keyword llvmKeyword noalias nocapture noimplicitfloat noinline nonlazybind 51syn keyword llvmKeyword noredzone noreturn nounwind optnone optsize personality 52syn keyword llvmKeyword private protected ptx_device ptx_kernel readnone 53syn keyword llvmKeyword readonly release returns_twice sanitize_thread 54syn keyword llvmKeyword sanitize_memory section seq_cst sideeffect signext 55syn keyword llvmKeyword singlethread spir_func spir_kernel sret ssp sspreq 56syn keyword llvmKeyword sspstrong tail target thread_local to triple 57syn keyword llvmKeyword unnamed_addr unordered uwtable volatile weak weak_odr 58syn keyword llvmKeyword x86_fastcallcc x86_stdcallcc x86_thiscallcc 59syn keyword llvmKeyword x86_64_sysvcc x86_64_win64cc zeroext uselistorder 60syn keyword llvmKeyword uselistorder_bb musttail 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" Named metadata and specialized metadata keywords. 78syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*$/ 79syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*[=!]/ 80syn match llvmType /!\zs\a\+\ze\s*(/ 81syn match llvmConstant /\<DW_TAG_[a-z_]\+\>/ 82syn match llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/ 83syn match llvmConstant /\<DW_OP_[a-zA-Z0-9_]\+\>/ 84syn match llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/ 85syn match llvmConstant /\<DW_VIRTUALITY_[a-z_]\+\>/ 86syn match llvmConstant /\<DIFlag[A-Za-z]\+\>/ 87 88" Syntax-highlight lit test commands and bug numbers. 89syn match llvmSpecialComment /;\s*PR\d*\s*$/ 90syn match llvmSpecialComment /;\s*REQUIRES:.*$/ 91syn match llvmSpecialComment /;\s*RUN:.*$/ 92syn match llvmSpecialComment /;\s*XFAIL:.*$/ 93 94if version >= 508 || !exists("did_c_syn_inits") 95 if version < 508 96 let did_c_syn_inits = 1 97 command -nargs=+ HiLink hi link <args> 98 else 99 command -nargs=+ HiLink hi def link <args> 100 endif 101 102 HiLink llvmType Type 103 HiLink llvmStatement Statement 104 HiLink llvmNumber Number 105 HiLink llvmComment Comment 106 HiLink llvmString String 107 HiLink llvmLabel Label 108 HiLink llvmKeyword Keyword 109 HiLink llvmBoolean Boolean 110 HiLink llvmFloat Float 111 HiLink llvmNoName Identifier 112 HiLink llvmConstant Constant 113 HiLink llvmSpecialComment SpecialComment 114 HiLink llvmError Error 115 HiLink llvmIdentifier Identifier 116 117 delcommand HiLink 118endif 119 120let b:current_syntax = "llvm" 121