Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: IA-64 (Itanium) assembly language |
| 3 | " Maintainer: Parth Malwankar <pmalwankar@yahoo.com> |
| 4 | " URL: http://www.geocities.com/pmalwankar (Home Page with link to my Vim page) |
| 5 | " http://www.geocities.com/pmalwankar/vim.htm (for VIM) |
| 6 | " File Version: 0.7 |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 7 | " Last Change: 2006 Sep 08 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | |
| 9 | " For version 5.x: Clear all syntax items |
| 10 | " For version 6.x: Quit when a syntax file was already loaded |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | |
| 17 | |
| 18 | "ignore case for assembly |
| 19 | syn case ignore |
| 20 | |
| 21 | " Identifier Keyword characters (defines \k) |
| 22 | if version >= 600 |
| 23 | setlocal iskeyword=@,48-57,#,$,.,:,?,@-@,_,~ |
| 24 | else |
| 25 | set iskeyword=@,48-57,#,$,.,:,?,@-@,_,~ |
| 26 | endif |
| 27 | |
| 28 | syn sync minlines=5 |
| 29 | |
| 30 | " Read the MASM syntax to start with |
| 31 | " This is needed as both IA-64 as well as IA-32 instructions are supported |
| 32 | source <sfile>:p:h/masm.vim |
| 33 | |
| 34 | syn region ia64Comment start="//" end="$" contains=ia64Todo |
| 35 | syn region ia64Comment start="/\*" end="\*/" contains=ia64Todo |
| 36 | |
| 37 | syn match ia64Identifier "[a-zA-Z_$][a-zA-Z0-9_$]*" |
| 38 | syn match ia64Directive "\.[a-zA-Z_$][a-zA-Z_$.]\+" |
| 39 | syn match ia64Label "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=:\>"he=e-1 |
| 40 | syn match ia64Label "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=::\>"he=e-2 |
| 41 | syn match ia64Label "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=#\>"he=e-1 |
| 42 | syn region ia64string start=+L\="+ skip=+\\\\\|\\"+ end=+"+ |
| 43 | syn match ia64Octal "0[0-7_]*\>" |
| 44 | syn match ia64Binary "0[bB][01_]*\>" |
| 45 | syn match ia64Hex "0[xX][0-9a-fA-F_]*\>" |
| 46 | syn match ia64Decimal "[1-9_][0-9_]*\>" |
| 47 | syn match ia64Float "[0-9_]*\.[0-9_]*\([eE][+-]\=[0-9_]*\)\=\>" |
| 48 | |
| 49 | "simple instructions |
| 50 | syn keyword ia64opcode add adds addl addp4 alloc and andcm cover epc |
| 51 | syn keyword ia64opcode fabs fand fandcm fc flushrs fneg fnegabs for |
| 52 | syn keyword ia64opcode fpabs fpack fpneg fpnegabs fselect fand fabdcm |
| 53 | syn keyword ia64opcode fc fwb fxor loadrs movl mux1 mux2 or padd4 |
| 54 | syn keyword ia64opcode pavgsub1 pavgsub2 popcnt psad1 pshl2 pshl4 pshladd2 |
| 55 | syn keyword ia64opcode pshradd2 psub4 rfi rsm rum shl shladd shladdp4 |
| 56 | syn keyword ia64opcode shrp ssm sub sum sync.i tak thash |
| 57 | syn keyword ia64opcode tpa ttag xor |
| 58 | |
| 59 | "put to override these being recognized as floats. They are orignally from masm.vim |
| 60 | "put here to avoid confusion with float |
| 61 | syn match ia64Directive "\.186" |
| 62 | syn match ia64Directive "\.286" |
| 63 | syn match ia64Directive "\.286c" |
| 64 | syn match ia64Directive "\.286p" |
| 65 | syn match ia64Directive "\.287" |
| 66 | syn match ia64Directive "\.386" |
| 67 | syn match ia64Directive "\.386c" |
| 68 | syn match ia64Directive "\.386p" |
| 69 | syn match ia64Directive "\.387" |
| 70 | syn match ia64Directive "\.486" |
| 71 | syn match ia64Directive "\.486c" |
| 72 | syn match ia64Directive "\.486p" |
| 73 | syn match ia64Directive "\.8086" |
| 74 | syn match ia64Directive "\.8087" |
| 75 | |
| 76 | |
| 77 | |
| 78 | "delimiters |
| 79 | syn match ia64delimiter ";;" |
| 80 | |
| 81 | "operators |
| 82 | syn match ia64operators "[\[\]()#,]" |
| 83 | syn match ia64operators "\(+\|-\|=\)" |
| 84 | |
| 85 | "TODO |
| 86 | syn match ia64Todo "\(TODO\|XXX\|FIXME\|NOTE\)" |
| 87 | |
| 88 | "What follows is a long list of regular expressions for parsing the |
| 89 | "ia64 instructions that use many completers |
| 90 | |
| 91 | "br |
| 92 | syn match ia64opcode "br\(\(\.\(cond\|call\|ret\|ia\|cloop\|ctop\|cexit\|wtop\|wexit\)\)\=\(\.\(spnt\|dpnt\|sptk\|dptk\)\)\=\(\.few\|\.many\)\=\(\.clr\)\=\)\=\>" |
| 93 | "break |
| 94 | syn match ia64opcode "break\(\.[ibmfx]\)\=\>" |
| 95 | "brp |
| 96 | syn match ia64opcode "brp\(\.\(sptk\|dptk\|loop\|exit\)\)\(\.imp\)\=\>" |
| 97 | syn match ia64opcode "brp\.ret\(\.\(sptk\|dptk\)\)\{1}\(\.imp\)\=\>" |
| 98 | "bsw |
| 99 | syn match ia64opcode "bsw\.[01]\>" |
| 100 | "chk |
| 101 | syn match ia64opcode "chk\.\(s\(\.[im]\)\=\)\>" |
| 102 | syn match ia64opcode "chk\.a\.\(clr\|nc\)\>" |
| 103 | "clrrrb |
| 104 | syn match ia64opcode "clrrrb\(\.pr\)\=\>" |
| 105 | "cmp/cmp4 |
| 106 | syn match ia64opcode "cmp4\=\.\(eq\|ne\|l[te]\|g[te]\|[lg]tu\|[lg]eu\)\(\.unc\)\=\>" |
| 107 | syn match ia64opcode "cmp4\=\.\(eq\|[lgn]e\|[lg]t\)\.\(\(or\(\.andcm\|cm\)\=\)\|\(and\(\(\.or\)\=cm\)\=\)\)\>" |
| 108 | "cmpxchg |
| 109 | syn match ia64opcode "cmpxchg[1248]\.\(acq\|rel\)\(\.nt1\|\.nta\)\=\>" |
| 110 | "czx |
| 111 | syn match ia64opcode "czx[12]\.[lr]\>" |
| 112 | "dep |
| 113 | syn match ia64opcode "dep\(\.z\)\=\>" |
| 114 | "extr |
| 115 | syn match ia64opcode "extr\(\.u\)\=\>" |
| 116 | "fadd |
| 117 | syn match ia64opcode "fadd\(\.[sd]\)\=\(\.s[0-3]\)\=\>" |
| 118 | "famax/famin |
| 119 | syn match ia64opcode "fa\(max\|min\)\(\.s[0-3]\)\=\>" |
| 120 | "fchkf/fmax/fmin |
| 121 | syn match ia64opcode "f\(chkf\|max\|min\)\(\.s[0-3]\)\=\>" |
| 122 | "fclass |
| 123 | syn match ia64opcode "fclass\(\.n\=m\)\(\.unc\)\=\>" |
| 124 | "fclrf/fpamax |
| 125 | syn match ia64opcode "f\(clrf\|pamax\|pamin\)\(\.s[0-3]\)\=\>" |
| 126 | "fcmp |
| 127 | syn match ia64opcode "fcmp\.\(n\=[lg][te]\|n\=eq\|\(un\)\=ord\)\(\.unc\)\=\(\.s[0-3]\)\=\>" |
| 128 | "fcvt/fcvt.xf/fcvt.xuf.pc.sf |
| 129 | syn match ia64opcode "fcvt\.\(\(fxu\=\(\.trunc\)\=\(\.s[0-3]\)\=\)\|\(xf\|xuf\(\.[sd]\)\=\(\.s[0-3]\)\=\)\)\>" |
| 130 | "fetchadd |
| 131 | syn match ia64opcode "fetchadd[48]\.\(acq\|rel\)\(\.nt1\|\.nta\)\=\>" |
| 132 | "fma/fmpy/fms |
| 133 | syn match ia64opcode "fm\([as]\|py\)\(\.[sd]\)\=\(\.s[0-3]\)\=\>" |
| 134 | "fmerge/fpmerge |
| 135 | syn match ia64opcode "fp\=merge\.\(ns\|se\=\)\>" |
| 136 | "fmix |
| 137 | syn match ia64opcode "fmix\.\(lr\|[lr]\)\>" |
| 138 | "fnma/fnorm/fnmpy |
| 139 | syn match ia64opcode "fn\(ma\|mpy\|orm\)\(\.[sd]\)\=\(\.s[0-3]\)\=\>" |
| 140 | "fpcmp |
| 141 | syn match ia64opcode "fpcmp\.\(n\=[lg][te]\|n\=eq\|\(un\)\=ord\)\(\.s[0-3]\)\=\>" |
| 142 | "fpcvt |
| 143 | syn match ia64opcode "fpcvt\.fxu\=\(\(\.trunc\)\=\(\.s[0-3]\)\=\)\>" |
| 144 | "fpma/fpmax/fpmin/fpmpy/fpms/fpnma/fpnmpy/fprcpa/fpsqrta |
| 145 | syn match ia64opcode "fp\(max\=\|min\|n\=mpy\|ms\|nma\|rcpa\|sqrta\)\(\.s[0-3]\)\=\>" |
| 146 | "frcpa/frsqrta |
| 147 | syn match ia64opcode "fr\(cpa\|sqrta\)\(\.s[0-3]\)\=\>" |
| 148 | "fsetc/famin/fchkf |
| 149 | syn match ia64opcode "f\(setc\|amin\|chkf\)\(\.s[0-3]\)\=\>" |
| 150 | "fsub |
| 151 | syn match ia64opcode "fsub\(\.[sd]\)\=\(\.s[0-3]\)\=\>" |
| 152 | "fswap |
| 153 | syn match ia64opcode "fswap\(\.n[lr]\=\)\=\>" |
| 154 | "fsxt |
| 155 | syn match ia64opcode "fsxt\.[lr]\>" |
| 156 | "getf |
| 157 | syn match ia64opcode "getf\.\([sd]\|exp\|sig\)\>" |
| 158 | "invala |
| 159 | syn match ia64opcode "invala\(\.[ae]\)\=\>" |
| 160 | "itc/itr |
| 161 | syn match ia64opcode "it[cr]\.[id]\>" |
| 162 | "ld |
| 163 | syn match ia64opcode "ld[1248]\>\|ld[1248]\(\.\(sa\=\|a\|c\.\(nc\|clr\(\.acq\)\=\)\|acq\|bias\)\)\=\(\.nt[1a]\)\=\>" |
| 164 | syn match ia64opcode "ld8\.fill\(\.nt[1a]\)\=\>" |
| 165 | "ldf |
| 166 | syn match ia64opcode "ldf[sde8]\(\(\.\(sa\=\|a\|c\.\(nc\|clr\)\)\)\=\(\.nt[1a]\)\=\)\=\>" |
| 167 | syn match ia64opcode "ldf\.fill\(\.nt[1a]\)\=\>" |
| 168 | "ldfp |
| 169 | syn match ia64opcode "ldfp[sd8]\(\(\.\(sa\=\|a\|c\.\(nc\|clr\)\)\)\=\(\.nt[1a]\)\=\)\=\>" |
| 170 | "lfetch |
| 171 | syn match ia64opcode "lfetch\(\.fault\(\.excl\)\=\|\.excl\)\=\(\.nt[12a]\)\=\>" |
| 172 | "mf |
| 173 | syn match ia64opcode "mf\(\.a\)\=\>" |
| 174 | "mix |
| 175 | syn match ia64opcode "mix[124]\.[lr]\>" |
| 176 | "mov |
| 177 | syn match ia64opcode "mov\(\.[im]\)\=\>" |
| 178 | syn match ia64opcode "mov\(\.ret\)\=\(\(\.sptk\|\.dptk\)\=\(\.imp\)\=\)\=\>" |
| 179 | "nop |
| 180 | syn match ia64opcode "nop\(\.[ibmfx]\)\=\>" |
| 181 | "pack |
| 182 | syn match ia64opcode "pack\(2\.[su]ss\|4\.sss\)\>" |
| 183 | "padd //padd4 added to keywords |
| 184 | syn match ia64opcode "padd[12]\(\.\(sss\|uus\|uuu\)\)\=\>" |
| 185 | "pavg |
| 186 | syn match ia64opcode "pavg[12]\(\.raz\)\=\>" |
| 187 | "pcmp |
| 188 | syn match ia64opcode "pcmp[124]\.\(eq\|gt\)\>" |
| 189 | "pmax/pmin |
| 190 | syn match ia64opcode "pm\(ax\|in\)\(\(1\.u\)\|2\)\>" |
| 191 | "pmpy |
| 192 | syn match ia64opcode "pmpy2\.[rl]\>" |
| 193 | "pmpyshr |
| 194 | syn match ia64opcode "pmpyshr2\(\.u\)\=\>" |
| 195 | "probe |
| 196 | syn match ia64opcode "probe\.[rw]\>" |
| 197 | syn match ia64opcode "probe\.\(\(r\|w\|rw\)\.fault\)\>" |
| 198 | "pshr |
| 199 | syn match ia64opcode "pshr[24]\(\.u\)\=\>" |
| 200 | "psub |
| 201 | syn match ia64opcode "psub[12]\(\.\(sss\|uu[su]\)\)\=\>" |
| 202 | "ptc |
| 203 | syn match ia64opcode "ptc\.\(l\|e\|ga\=\)\>" |
| 204 | "ptr |
| 205 | syn match ia64opcode "ptr\.\(d\|i\)\>" |
| 206 | "setf |
| 207 | syn match ia64opcode "setf\.\(s\|d\|exp\|sig\)\>" |
| 208 | "shr |
| 209 | syn match ia64opcode "shr\(\.u\)\=\>" |
| 210 | "srlz |
| 211 | syn match ia64opcode "srlz\(\.[id]\)\>" |
| 212 | "st |
| 213 | syn match ia64opcode "st[1248]\(\.rel\)\=\(\.nta\)\=\>" |
| 214 | syn match ia64opcode "st8\.spill\(\.nta\)\=\>" |
| 215 | "stf |
| 216 | syn match ia64opcode "stf[1248]\(\.nta\)\=\>" |
| 217 | syn match ia64opcode "stf\.spill\(\.nta\)\=\>" |
| 218 | "sxt |
| 219 | syn match ia64opcode "sxt[124]\>" |
| 220 | "tbit/tnat |
| 221 | syn match ia64opcode "t\(bit\|nat\)\(\.nz\|\.z\)\=\(\.\(unc\|or\(\.andcm\|cm\)\=\|and\(\.orcm\|cm\)\=\)\)\=\>" |
| 222 | "unpack |
| 223 | syn match ia64opcode "unpack[124]\.[lh]\>" |
| 224 | "xchq |
| 225 | syn match ia64opcode "xchg[1248]\(\.nt[1a]\)\=\>" |
| 226 | "xma/xmpy |
| 227 | syn match ia64opcode "xm\(a\|py\)\.[lh]u\=\>" |
| 228 | "zxt |
| 229 | syn match ia64opcode "zxt[124]\>" |
| 230 | |
| 231 | |
| 232 | "The regex for different ia64 registers are given below |
| 233 | |
| 234 | "limits the rXXX and fXXX and cr suffix in the range 0-127 |
| 235 | syn match ia64registers "\([fr]\|cr\)\([0-9]\|[1-9][0-9]\|1[0-1][0-9]\|12[0-7]\)\{1}\>" |
| 236 | "branch ia64registers |
| 237 | syn match ia64registers "b[0-7]\>" |
| 238 | "predicate ia64registers |
| 239 | syn match ia64registers "p\([0-9]\|[1-5][0-9]\|6[0-3]\)\>" |
| 240 | "application ia64registers |
| 241 | syn match ia64registers "ar\.\(fpsr\|mat\|unat\|rnat\|pfs\|bsp\|bspstore\|rsc\|lc\|ec\|ccv\|itc\|k[0-7]\)\>" |
| 242 | "ia32 AR's |
| 243 | syn match ia64registers "ar\.\(eflag\|fcr\|csd\|ssd\|cflg\|fsr\|fir\|fdr\)\>" |
| 244 | "sp/gp/pr/pr.rot/rp |
| 245 | syn keyword ia64registers sp gp pr pr.rot rp ip tp |
| 246 | "in/out/local |
| 247 | syn match ia64registers "\(in\|out\|loc\)\([0-9]\|[1-8][0-9]\|9[0-5]\)\>" |
| 248 | "argument ia64registers |
| 249 | syn match ia64registers "farg[0-7]\>" |
| 250 | "return value ia64registers |
| 251 | syn match ia64registers "fret[0-7]\>" |
| 252 | "psr |
| 253 | syn match ia64registers "psr\(\.\(l\|um\)\)\=\>" |
| 254 | "cr |
| 255 | syn match ia64registers "cr\.\(dcr\|itm\|iva\|pta\|ipsr\|isr\|ifa\|iip\|itir\|iipa\|ifs\|iim\|iha\|lid\|ivr\|tpr\|eoi\|irr[0-3]\|itv\|pmv\|lrr[01]\|cmcv\)\>" |
| 256 | "Indirect registers |
| 257 | syn match ia64registers "\(cpuid\|dbr\|ibr\|pkr\|pmc\|pmd\|rr\|itr\|dtr\)\>" |
| 258 | "MUX permutations for 8-bit elements |
| 259 | syn match ia64registers "\(@rev\|@mix\|@shuf\|@alt\|@brcst\)\>" |
| 260 | "floating point classes |
| 261 | syn match ia64registers "\(@nat\|@qnan\|@snan\|@pos\|@neg\|@zero\|@unorm\|@norm\|@inf\)\>" |
| 262 | "link relocation operators |
| 263 | syn match ia64registers "\(@\(\(\(gp\|sec\|seg\|image\)rel\)\|ltoff\|fptr\|ptloff\|ltv\|section\)\)\>" |
| 264 | |
| 265 | "Data allocation syntax |
| 266 | syn match ia64data "data[1248]\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>" |
| 267 | syn match ia64data "real\([48]\|1[06]\)\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>" |
| 268 | syn match ia64data "stringz\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>" |
| 269 | |
| 270 | " Define the default highlighting. |
| 271 | " For version 5.7 and earlier: only when not done already |
| 272 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 273 | if version >= 508 || !exists("did_ia64_syn_inits") |
| 274 | if version < 508 |
| 275 | let did_ia64_syn_inits = 1 |
| 276 | command -nargs=+ HiLink hi link <args> |
| 277 | else |
| 278 | command -nargs=+ HiLink hi def link <args> |
| 279 | endif |
| 280 | |
| 281 | "put masm groups with our groups |
| 282 | HiLink masmOperator ia64operator |
| 283 | HiLink masmDirective ia64Directive |
| 284 | HiLink masmOpcode ia64Opcode |
| 285 | HiLink masmIdentifier ia64Identifier |
| 286 | HiLink masmFloat ia64Float |
| 287 | |
| 288 | "ia64 specific stuff |
| 289 | HiLink ia64Label Define |
| 290 | HiLink ia64Comment Comment |
| 291 | HiLink ia64Directive Type |
| 292 | HiLink ia64opcode Statement |
| 293 | HiLink ia64registers Operator |
| 294 | HiLink ia64string String |
| 295 | HiLink ia64Hex Number |
| 296 | HiLink ia64Binary Number |
| 297 | HiLink ia64Octal Number |
| 298 | HiLink ia64Float Float |
| 299 | HiLink ia64Decimal Number |
| 300 | HiLink ia64Identifier Identifier |
| 301 | HiLink ia64data Type |
| 302 | HiLink ia64delimiter Delimiter |
| 303 | HiLink ia64operator Operator |
| 304 | HiLink ia64Todo Todo |
| 305 | |
| 306 | delcommand HiLink |
| 307 | endif |
| 308 | |
| 309 | let b:current_syntax = "ia64" |
| 310 | |
| 311 | " vim: ts=8 sw=2 |