MLIR
20.0.0git
include
mlir
TableGen
Argument.h
Go to the documentation of this file.
1
//===- Argument.h - Argument definitions ------------------------*- 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
// This header file contains definitions for TableGen operation's arguments.
10
// Operation arguments fall into two categories:
11
//
12
// 1. Operands: SSA values operated on by the operation
13
// 2. Attributes: compile-time known properties that have influence over
14
// the operation's behavior
15
//
16
// These two categories are modelled with the unified argument concept in
17
// TableGen because we need similar pattern matching mechanisms for them.
18
//
19
//===----------------------------------------------------------------------===//
20
21
#ifndef MLIR_TABLEGEN_ARGUMENT_H_
22
#define MLIR_TABLEGEN_ARGUMENT_H_
23
24
#include "
mlir/TableGen/Attribute.h
"
25
#include "
mlir/TableGen/Property.h
"
26
#include "
mlir/TableGen/Type.h
"
27
#include "llvm/ADT/PointerUnion.h"
28
#include <string>
29
30
namespace
llvm
{
31
class
StringRef;
32
}
// namespace llvm
33
34
namespace
mlir
{
35
namespace
tblgen {
36
37
// A struct wrapping an op attribute and its name together
38
struct
NamedAttribute
{
39
llvm::StringRef
name
;
40
Attribute
attr
;
41
};
42
43
// A struct wrapping an op operand/result's constraint and its name together
44
struct
NamedTypeConstraint
{
45
// Returns true if this operand/result has constraint to be satisfied.
46
bool
hasPredicate
()
const
;
47
// Returns true if this is an optional type constraint. This is a special case
48
// of variadic for 0 or 1 type.
49
bool
isOptional
()
const
;
50
// Returns true if this operand/result is variadic.
51
bool
isVariadic
()
const
;
52
// Returns true if this operand/result is a variadic of a variadic constraint.
53
bool
isVariadicOfVariadic
()
const
;
54
// Returns true if this is a variable length type constraint. This is either
55
// variadic or optional.
56
bool
isVariableLength
()
const
{
return
isOptional
() ||
isVariadic
(); }
57
58
llvm::StringRef
name
;
59
TypeConstraint
constraint
;
60
};
61
62
// Operation argument: either attribute, property, or operand
63
using
Argument
=
llvm::PointerUnion
<
NamedAttribute
*,
NamedProperty
*,
64
NamedTypeConstraint
*>;
65
66
}
// namespace tblgen
67
}
// namespace mlir
68
69
#endif
// MLIR_TABLEGEN_ARGUMENT_H_
Attribute.h
Property.h
Type.h
llvm::PointerUnion
Definition:
LLVM.h:64
mlir::tblgen::Attribute
Definition:
Attribute.h:47
mlir::tblgen::TypeConstraint
Definition:
Type.h:30
llvm
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition:
CallGraph.h:229
mlir
Include the generated interface declarations.
Definition:
LocalAliasAnalysis.h:20
mlir::tblgen::NamedAttribute
Definition:
Argument.h:38
mlir::tblgen::NamedAttribute::attr
Attribute attr
Definition:
Argument.h:40
mlir::tblgen::NamedAttribute::name
llvm::StringRef name
Definition:
Argument.h:39
mlir::tblgen::NamedProperty
Definition:
Property.h:161
mlir::tblgen::NamedTypeConstraint
Definition:
Argument.h:44
mlir::tblgen::NamedTypeConstraint::isVariadicOfVariadic
bool isVariadicOfVariadic() const
Definition:
Argument.cpp:27
mlir::tblgen::NamedTypeConstraint::hasPredicate
bool hasPredicate() const
Definition:
Argument.cpp:19
mlir::tblgen::NamedTypeConstraint::isVariadic
bool isVariadic() const
Definition:
Argument.cpp:25
mlir::tblgen::NamedTypeConstraint::isVariableLength
bool isVariableLength() const
Definition:
Argument.h:56
mlir::tblgen::NamedTypeConstraint::name
llvm::StringRef name
Definition:
Argument.h:58
mlir::tblgen::NamedTypeConstraint::isOptional
bool isOptional() const
Definition:
Argument.cpp:23
mlir::tblgen::NamedTypeConstraint::constraint
TypeConstraint constraint
Definition:
Argument.h:59
Generated on Sat Dec 21 2024 12:33:50 for MLIR by
1.9.1