ia64.vim 10 KB

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