neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

ia64.vim (10473B)


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