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 float double x86_fp80 fp128 ppc_fp128 18 syn keyword llvmType label metadata x86_mmx 19 syn keyword llvmType type label opaque 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 call cmpxchg eq exact extractelement 27 syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext 28 syn keyword llvmStatement fptosi fptoui fptrunc free frem fsub getelementptr 29 syn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue 30 syn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min 31 syn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole 32 syn keyword llvmStatement olt one or ord phi ptrtoint resume ret sdiv select 33 syn keyword llvmStatement sext sge sgt shl shufflevector sitofp sle slt srem 34 syn keyword llvmStatement store sub switch trunc udiv ueq uge ugt uitofp ule ult 35 syn keyword llvmStatement umax umin une uno unreachable unwind urem va_arg 36 syn keyword llvmStatement xchg xor zext 37 38 " Keywords. 39 syn keyword llvmKeyword acq_rel acquire sanitize_address addrspace alias align 40 syn keyword llvmKeyword alignstack alwaysinline appending arm_aapcs_vfpcc 41 syn keyword llvmKeyword arm_aapcscc arm_apcscc asm atomic available_externally 42 syn keyword llvmKeyword blockaddress byval c catch cc ccc cleanup coldcc common 43 syn keyword llvmKeyword constant datalayout declare default define deplibs 44 syn keyword llvmKeyword distinct dllexport dllimport except extern_weak external 45 syn keyword llvmKeyword externally_initialized fastcc filter gc global hhvmcc 46 syn keyword llvmKeyword hhvm_ccc hidden initialexec inlinehint inreg 47 syn keyword llvmKeyword intel_ocl_bicc inteldialect internal linkonce 48 syn keyword llvmKeyword linkonce_odr localdynamic localexec minsize module 49 syn keyword llvmKeyword monotonic msp430_intrcc musttail naked nest 50 syn keyword llvmKeyword noalias nocapture noimplicitfloat noinline nonlazybind 51 syn keyword llvmKeyword noredzone noreturn nounwind optnone optsize personality 52 syn keyword llvmKeyword private protected ptx_device ptx_kernel readnone 53 syn keyword llvmKeyword readonly release returns_twice sanitize_thread 54 syn keyword llvmKeyword sanitize_memory section seq_cst sideeffect signext 55 syn keyword llvmKeyword singlethread spir_func spir_kernel sret ssp sspreq 56 syn keyword llvmKeyword sspstrong tail target thread_local to triple 57 syn keyword llvmKeyword unnamed_addr unordered uwtable volatile weak weak_odr 58 syn keyword llvmKeyword x86_fastcallcc x86_stdcallcc x86_thiscallcc 59 syn keyword llvmKeyword x86_64_sysvcc x86_64_win64cc zeroext uselistorder 60 syn keyword llvmKeyword uselistorder_bb musttail 61 62 " Obsolete keywords. 63 syn keyword llvmError getresult begin end 64 65 " Misc syntax. 66 syn match llvmNoName /[%@!]\d\+\>/ 67 syn match llvmNumber /-\?\<\d\+\>/ 68 syn match llvmFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/ 69 syn match llvmFloat /\<0x\x\+\>/ 70 syn keyword llvmBoolean true false 71 syn keyword llvmConstant zeroinitializer undef null 72 syn match llvmComment /;.*$/ 73 syn region llvmString start=/"/ skip=/\\"/ end=/"/ 74 syn match llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/ 75 syn match llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/ 76 77 " Named metadata and specialized metadata keywords. 78 syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*$/ 79 syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*[=!]/ 80 syn match llvmType /!\zs\a\+\ze\s*(/ 81 syn match llvmConstant /\<DW_TAG_[a-z_]\+\>/ 82 syn match llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/ 83 syn match llvmConstant /\<DW_OP_[a-zA-Z0-9_]\+\>/ 84 syn match llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/ 85 syn match llvmConstant /\<DW_VIRTUALITY_[a-z_]\+\>/ 86 syn match llvmConstant /\<DIFlag[A-Za-z]\+\>/ 87 88 " Syntax-highlight lit test commands and bug numbers. 89 syn match llvmSpecialComment /;\s*PR\d*\s*$/ 90 syn match llvmSpecialComment /;\s*REQUIRES:.*$/ 91 syn match llvmSpecialComment /;\s*RUN:.*$/ 92 syn match llvmSpecialComment /;\s*XFAIL:.*$/ 93 94 if 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 118 endif 119 120 let b:current_syntax = "llvm" 121