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
14namespace mlir {
15class OpAsmParser;
16class OpAsmPrinter;
17class Type;
18class TypeRange;
19class 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.
32ParseResult parseSemiFunctionType(OpAsmParser &parser, Type &argumentType,
33 Type &resultType, bool resultOptional = true);
34ParseResult 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 `-> ()`.
40void printSemiFunctionType(OpAsmPrinter &printer, Operation *op,
41 Type argumentType, TypeRange resultType);
42void printSemiFunctionType(OpAsmPrinter &printer, Operation *op,
43 Type argumentType, Type resultType,
44 bool resultOptional = true);
45} // namespace mlir
46
47#endif // MLIR_DIALECT_LINALG_TRANSFORMOPS_SYNTAX_H
48

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of mlir/include/mlir/Dialect/Linalg/TransformOps/Syntax.h