MLIR  20.0.0git
Syntax.h
Go to the documentation of this file.
1 //===- Syntax.h - Custom syntax for Linalg transform ops --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef MLIR_DIALECT_LINALG_TRANSFORMOPS_SYNTAX_H
10 #define MLIR_DIALECT_LINALG_TRANSFORMOPS_SYNTAX_H
11 
12 #include "mlir/Support/LLVM.h"
13 
14 namespace mlir {
15 class OpAsmParser;
16 class OpAsmPrinter;
17 class Type;
18 class TypeRange;
19 class Operation;
20 
21 /// Parses a single non-function type or a function type with at least one
22 /// argument. This allows for the following syntax:
23 ///
24 /// - type: just the argument type;
25 /// - `(` type `)` `->` type: one argument and one result type;
26 /// - `(` type `)` `->` `(` comma-separated-type-list `)`: one argument and
27 /// multiple result types.
28 ///
29 /// Unlike FunctionType, this allows and requires one to omit the parens around
30 /// the argument type in absence of result types, and does not accept the
31 /// trailing `-> ()` construct, which makes the syntax nicer for operations.
32 ParseResult parseSemiFunctionType(OpAsmParser &parser, Type &argumentType,
33  Type &resultType);
34 ParseResult parseSemiFunctionType(OpAsmParser &parser, Type &argumentType,
35  SmallVectorImpl<Type> &resultTypes);
36 
37 /// Prints argument and result types in a syntax similar to that of FunctionType
38 /// but allowing and requiring one to omit the parens around the argument type
39 /// in absence of result types, and without the trailing `-> ()`.
40 void printSemiFunctionType(OpAsmPrinter &printer, Operation *op,
41  Type argumentType, TypeRange resultType);
42 void printSemiFunctionType(OpAsmPrinter &printer, Operation *op,
43  Type argumentType, Type resultType);
44 } // namespace mlir
45 
46 #endif // MLIR_DIALECT_LINALG_TRANSFORMOPS_SYNTAX_H
@ Type
An inlay hint that for a type annotation.
Include the generated interface declarations.
ParseResult parseSemiFunctionType(OpAsmParser &parser, Type &argumentType, Type &resultType)
Parses a single non-function type or a function type with at least one argument.
Definition: Syntax.cpp:14
void printSemiFunctionType(OpAsmPrinter &printer, Operation *op, Type argumentType, TypeRange resultType)
Prints argument and result types in a syntax similar to that of FunctionType but allowing and requiri...
Definition: Syntax.cpp:55