xref: /llvm-project/mlir/utils/tree-sitter-mlir/dialect/func.js (revision 10f8be19e7562624c0e63872e28cc963e03e56a5)
1'use strict';
2
3module.exports = {
4  func_dialect : $ => prec.right(choice(
5                   // operation ::= `func.call_indirect` $callee `(`
6                   // $callee_operands `)` attr-dict
7                   //               `:` type($callee)
8                   // operation ::= `func.call` $callee `(` $operands `)`
9                   // attr-dict
10                   //               `:` functional-type($operands, results)
11                   seq(choice('func.call', 'call', 'func.call_indirect',
12                              'call_indirect'),
13                       field('callee', $.symbol_ref_id),
14                       field('operands', $._value_use_list_parens),
15                       field('attributes', optional($.attribute)),
16                       field('return', $._function_type_annotation)),
17
18                   // operation ::= `func.constant` attr-dict $value `:`
19                   // type(results)
20                   seq(choice('func.constant', 'constant'),
21                       field('attributes', optional($.attribute)),
22                       field('value', $.symbol_ref_id),
23                       field('return', $._function_type_annotation)),
24
25                   seq('func.func', $._op_func),
26
27                   seq(choice('func.return', 'return'),
28                       field('attributes', optional($.attribute)),
29                       field('results', optional($._value_use_type_list)))))
30}
31