diff options
| author | fab4100 <fab4100@posteo.ch> | 2023-05-20 21:52:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-20 21:52:54 -0400 |
| commit | 8e817bebf9184cab6c59205e1aed3fdce11c8c51 (patch) | |
| tree | c0084b7572c587dcfff2d63cee94bbe18c634e75 /queries/ispc | |
| parent | fear(cpp): highlight brackets in template_parameter_list (diff) | |
| download | nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.tar nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.tar.gz nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.tar.bz2 nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.tar.lz nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.tar.xz nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.tar.zst nvim-treesitter-8e817bebf9184cab6c59205e1aed3fdce11c8c51.zip | |
feat: add Intel Implicit SPMD Program Compiler (ISPC)
* Add ISPC parser config
* Add ISPC queries
* Update queries/ispc/injections.scm
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
---------
Co-authored-by: Fabian Wermelinger <fab4100@posteo.net>
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
Diffstat (limited to 'queries/ispc')
| -rw-r--r-- | queries/ispc/folds.scm | 8 | ||||
| -rw-r--r-- | queries/ispc/highlights.scm | 225 | ||||
| -rw-r--r-- | queries/ispc/indents.scm | 7 | ||||
| -rw-r--r-- | queries/ispc/injections.scm | 1 | ||||
| -rw-r--r-- | queries/ispc/locals.scm | 17 |
5 files changed, 258 insertions, 0 deletions
diff --git a/queries/ispc/folds.scm b/queries/ispc/folds.scm new file mode 100644 index 000000000..45d0ba131 --- /dev/null +++ b/queries/ispc/folds.scm @@ -0,0 +1,8 @@ +; inherits: c + +[ + (foreach_statement) + (foreach_instance_statement) + (unmasked_statement) + (template_declaration) +] @fold diff --git a/queries/ispc/highlights.scm b/queries/ispc/highlights.scm new file mode 100644 index 000000000..6770d6bb9 --- /dev/null +++ b/queries/ispc/highlights.scm @@ -0,0 +1,225 @@ +; inherits: c + +[ + "soa" + "task" + "launch" + "unmasked" + "template" + "typename" + (sync_expression) +] @keyword + +[ + "in" + "new" + "delete" +] @keyword.operator + +[ + "cdo" + "cfor" + "cwhile" + "foreach" + "foreach_tiled" + "foreach_active" + "foreach_unique" +] @repeat + +[ + "cif" +] @conditional + +[ + "varying" + "uniform" +] @type.qualifier + +"__regcall" @attribute + +(overload_declarator name: _ @function) +(foreach_statement range_operator: _ @operator) + +(short_vector ["<" ">"] @punctuation.bracket) +(soa_qualifier ["<" ">"] @punctuation.bracket) +(template_argument_list ["<" ">"] @punctuation.bracket) +(template_parameter_list ["<" ">"] @punctuation.bracket) + +(llvm_identifier) @function.builtin + +; built-in variables +((identifier) @variable.builtin + (#any-of? @variable.builtin + "programCount" + "programIndex" + "taskCount" + "taskCount0" + "taskCount1" + "taskCount2" + "taskIndex" + "taskIndex0" + "taskIndex1" + "taskIndex2" + "threadCount" + "threadIndex" + )) + +; preprocessor constants +((identifier) @constant.builtin + (#any-of? @constant.builtin + "ISPC" + "ISPC_FP16_SUPPORTED" + "ISPC_FP64_SUPPORTED" + "ISPC_LLVM_INTRINSICS_ENABLED" + "ISPC_MAJOR_VERSION" + "ISPC_MINOR_VERSION" + "ISPC_POINTER_SIZE" + "ISPC_TARGET_AVX" + "ISPC_TARGET_AVX2" + "ISPC_TARGET_AVX512KNL" + "ISPC_TARGET_AVX512SKX" + "ISPC_TARGET_AVX512SPR" + "ISPC_TARGET_NEON" + "ISPC_TARGET_SSE2" + "ISPC_TARGET_SSE4" + "ISPC_UINT_IS_DEFINED" + "PI" + "TARGET_ELEMENT_WIDTH" + "TARGET_WIDTH" + )) + +; standard library built-in +((type_identifier) @type.builtin + (#lua-match? @type.builtin "^RNGState")) + +(call_expression + function: (identifier) @function.builtin + (#any-of? @function.builtin + "abs" + "acos" + "all" + "alloca" + "and" + "any" + "aos_to_soa2" + "aos_to_soa3" + "aos_to_soa4" + "asin" + "assert" + "assume" + "atan" + "atan2" + "atomic_add_global" + "atomic_add_local" + "atomic_and_global" + "atomic_and_local" + "atomic_compare_exchange_global" + "atomic_compare_exchange_local" + "atomic_max_global" + "atomic_max_local" + "atomic_min_global" + "atomic_min_local" + "atomic_or_global" + "atomic_or_local" + "atomic_subtract_global" + "atomic_subtract_local" + "atomic_swap_global" + "atomic_swap_local" + "atomic_xor_global" + "atomic_xor_local" + "avg_down" + "avg_up" + "broadcast" + "ceil" + "clamp" + "clock" + "cos" + "count_leading_zeros" + "count_trailing_zeros" + "doublebits" + "exclusive_scan_add" + "exclusive_scan_and" + "exclusive_scan_or" + "exp" + "extract" + "fastmath" + "float16bits" + "floatbits" + "float_to_half" + "float_to_half_fast" + "float_to_srgb8" + "floor" + "frandom" + "frexp" + "half_to_float" + "half_to_float_fast" + "insert" + "intbits" + "invoke_sycl" + "isnan" + "ISPCAlloc" + "ISPCLaunch" + "ISPCSync" + "lanemask" + "ldexp" + "log" + "max" + "memcpy" + "memcpy64" + "memmove" + "memmove64" + "memory_barrier" + "memset" + "memset64" + "min" + "none" + "num_cores" + "or" + "packed_load_active" + "packed_store_active" + "packed_store_active2" + "packmask" + "popcnt" + "pow" + "prefetch_l1" + "prefetch_l2" + "prefetch_l3" + "prefetch_nt" + "prefetchw_l1" + "prefetchw_l2" + "prefetchw_l3" + "print" + "random" + "rcp" + "rcp_fast" + "rdrand" + "reduce_add" + "reduce_equal" + "reduce_max" + "reduce_min" + "rotate" + "round" + "rsqrt" + "rsqrt_fast" + "saturating_add" + "saturating_div" + "saturating_mul" + "saturating_sub" + "seed_rng" + "select" + "shift" + "shuffle" + "signbits" + "sign_extend" + "sin" + "sincos" + "soa_to_aos2" + "soa_to_aos3" + "soa_to_aos4" + "sqrt" + "streaming_load" + "streaming_load_uniform" + "streaming_store" + "tan" + "trunc" + )) diff --git a/queries/ispc/indents.scm b/queries/ispc/indents.scm new file mode 100644 index 000000000..cc0829d5c --- /dev/null +++ b/queries/ispc/indents.scm @@ -0,0 +1,7 @@ +; inherits: c + +((foreach_statement body: (_) @_body) @indent.begin + (#not-has-type? @_body compound_statement)) + +((foreach_instance_statement body: (_) @_body) @indent.begin + (#not-has-type? @_body compound_statement)) diff --git a/queries/ispc/injections.scm b/queries/ispc/injections.scm new file mode 100644 index 000000000..a5a5208ca --- /dev/null +++ b/queries/ispc/injections.scm @@ -0,0 +1 @@ +; inherits: c diff --git a/queries/ispc/locals.scm b/queries/ispc/locals.scm new file mode 100644 index 000000000..8eca18c67 --- /dev/null +++ b/queries/ispc/locals.scm @@ -0,0 +1,17 @@ +; inherits: c + +(reference_declarator + (identifier) @definition.var) + +(type_parameter_declaration + (type_identifier) @definition.type) +(template_declaration) @scope + +(template_function + name: (identifier) @definition.function) @scope + +[ + (foreach_statement) + (foreach_instance_statement) + (unmasked_statement) +] @scope |
