MLIR 22.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
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 `-> ()`.
41 Type argumentType, TypeRange resultType);
43 Type argumentType, Type resultType,
44 bool resultOptional = true);
45} // namespace mlir
46
47#endif // MLIR_DIALECT_LINALG_TRANSFORMOPS_SYNTAX_H
The OpAsmParser has methods for interacting with the asm parser: parsing things from it,...
This is a pure-virtual base class that exposes the asmprinter hooks necessary to implement a custom p...
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
This class provides an abstraction over the various different ranges of value types.
Definition TypeRange.h:37
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
Include the generated interface declarations.
ParseResult parseSemiFunctionType(OpAsmParser &parser, Type &argumentType, Type &resultType, bool resultOptional=true)
Parses a single non-function type or a function type with at least one argument.
Definition Syntax.cpp:15
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:60