diff mlir/utils/vim/syntax/mlir.vim @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 5f17cb93ff66
children
line wrap: on
line diff
--- a/mlir/utils/vim/syntax/mlir.vim	Wed Jul 21 10:27:27 2021 +0900
+++ b/mlir/utils/vim/syntax/mlir.vim	Wed Nov 09 17:45:10 2022 +0900
@@ -14,7 +14,7 @@
 
 " Types.
 "
-syn keyword mlirType index f16 f32 f64
+syn keyword mlirType index f16 f32 f64 bf16
 " Signless integer types.
 syn match mlirType /\<i\d\+\>/
 " Unsigned integer types.
@@ -23,7 +23,7 @@
 syn match mlirType /\<si\d\+\>/
 
 " Elemental types inside memref, tensor, or vector types.
-syn match mlirType /x\s*\zs\(f16\|f32\|f64\|i\d\+\|ui\d\+\|si\d\+\)/
+syn match mlirType /x\s*\zs\(bf16|f16\|f32\|f64\|i\d\+\|ui\d\+\|si\d\+\)/
 
 " Shaped types.
 syn match mlirType /\<memref\ze\s*<.*>/
@@ -34,7 +34,6 @@
 syn match mlirType /x\s*\zsvector/
 
 " Operations.
-" Standard dialect ops.
 " TODO: this list is not exhaustive.
 syn keyword mlirOps alloc alloca addf addi and call call_indirect cmpf cmpi
 syn keyword mlirOps constant dealloc divf dma_start dma_wait dim exp
@@ -43,6 +42,9 @@
 syn keyword mlirOps splat store select sqrt subf subi subview tanh
 syn keyword mlirOps view
 
+" Math ops.
+syn match mlirOps /\<math\.erf\>/
+
 " Affine ops.
 syn match mlirOps /\<affine\.apply\>/
 syn match mlirOps /\<affine\.dma_start\>/
@@ -82,12 +84,22 @@
 syn match   mlirFloat  /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/
 syn match   mlirFloat  /\<0x\x\+\>/
 syn keyword mlirBoolean true false
-syn match   mlirComment /\/\/.*$/
+" Spell checking is enabled only in comments by default.
+syn match   mlirComment /\/\/.*$/ contains=@Spell
 syn region  mlirString start=/"/ skip=/\\"/ end=/"/
 syn match   mlirLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/
+" Prefixed identifiers usually used for ssa values and symbols.
 syn match   mlirIdentifier /[%@][a-zA-Z$._-][a-zA-Z0-9$._-]*/
-syn match   mlirIdentifier /[%@!]\d\+\>/
-syn match mlirMapSetOutline "#.*$"
+syn match   mlirIdentifier /[%@]\d\+\>/
+" Prefixed identifiers usually used for blocks.
+syn match   mlirBlockIdentifier /\^[a-zA-Z$._-][a-zA-Z0-9$._-]*/
+syn match   mlirBlockIdentifier /\^\d\+\>/
+" Prefixed identifiers usually used for types.
+syn match   mlirTypeIdentifier /![a-zA-Z$._-][a-zA-Z0-9$._-]*/
+syn match   mlirTypeIdentifier /!\d\+\>/
+" Prefixed identifiers usually used for attribute aliases and result numbers.
+syn match   mlirAttrIdentifier /#[a-zA-Z$._-][a-zA-Z0-9$._-]*/
+syn match   mlirAttrIdentifier /#\d\+\>/
 
 " Syntax-highlight lit test commands and bug numbers.
 syn match  mlirSpecialComment /\/\/\s*RUN:.*$/
@@ -109,7 +121,6 @@
 
   HiLink mlirType Type
   HiLink mlirOps Statement
-  HiLink mlirMapSetOutline PreProc
   HiLink mlirNumber Number
   HiLink mlirComment Comment
   HiLink mlirString String
@@ -120,6 +131,9 @@
   HiLink mlirConstant Constant
   HiLink mlirSpecialComment SpecialComment
   HiLink mlirIdentifier Identifier
+  HiLink mlirBlockIdentifier Label
+  HiLink mlirTypeIdentifier Type
+  HiLink mlirAttrIdentifier PreProc
 
   delcommand HiLink
 endif