xref: /llvm-project/mlir/include/mlir/IR/DialectBase.td (revision 45c226d4521515ff1a38292331d82356b273fff7)
1//===-- DialectBase.td - Base Dialect definition file ------*- tablegen -*-===//
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 file contains the base set of constructs for defining Dialect classes.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef DIALECTBASE_TD
14#define DIALECTBASE_TD
15
16include "mlir/IR/Utils.td"
17
18//===----------------------------------------------------------------------===//
19// Dialect definitions
20//===----------------------------------------------------------------------===//
21
22class Dialect {
23  // The name of the dialect.
24  string name = ?;
25
26  // Short summary of the dialect.
27  string summary = ?;
28
29  // The description of the dialect.
30  string description = ?;
31
32  // A list of dialects this dialect will load on construction as dependencies.
33  // These are dialects that this dialect may involve in canonicalization
34  // pattern or interfaces.
35  list<string> dependentDialects = [];
36
37  // A list of key/value pair representing an attribute type and a name.
38  // This will generate helper classes on the dialect to be able to
39  // manage discardable attributes on operations in a type safe way.
40  dag discardableAttrs = (ins);
41
42  // The C++ namespace that ops of this dialect should be placed into.
43  //
44  // By default, uses the name of the dialect as the only namespace. To avoid
45  // placing in any namespace, use "". To specify nested namespaces, use "::"
46  // as the delimiter, e.g., given "A::B", ops will be placed in
47  // `namespace A { namespace B { <ops> } }`.
48  //
49  // Note that this works in conjunction with dialect C++ code. Depending on how
50  // the generated files are included into the dialect, you may want to specify
51  // a full namespace path or a partial one.
52  string cppNamespace = name;
53
54  // An optional code block containing extra declarations to place in the
55  // dialect declaration.
56  code extraClassDeclaration = "";
57
58  // If this dialect overrides the hook for materializing constants.
59  bit hasConstantMaterializer = 0;
60
61  /// If the dialect definition provides a non-default destructor.
62  /// If false, a default destructor implementation will be generated.
63  bit hasNonDefaultDestructor = 0;
64
65  // If this dialect overrides the hook for verifying operation attributes.
66  bit hasOperationAttrVerify = 0;
67
68  // If this dialect overrides the hook for verifying region argument
69  // attributes.
70  bit hasRegionArgAttrVerify = 0;
71
72  // If this dialect overrides the hook for verifying region result attributes.
73  bit hasRegionResultAttrVerify = 0;
74
75  // If this dialect overrides the hook for op interface fallback.
76  bit hasOperationInterfaceFallback = 0;
77
78  // If this dialect should use default generated attribute parser boilerplate.
79  // When set, ODS will generate declarations for the attribute parsing and
80  // printing hooks in the dialect and default implementations that dispatch to
81  // each individual attribute directly.
82  bit useDefaultAttributePrinterParser = 0;
83
84  // If this dialect should use default generated type parser boilerplate:
85  // When set, ODS will generate declarations for the type parsing and printing
86  // hooks in the dialect and default implementations that dispatch to each
87  // individual type directly.
88  bit useDefaultTypePrinterParser = 0;
89
90  // If this dialect overrides the hook for canonicalization patterns.
91  bit hasCanonicalizer = 0;
92
93  // If this dialect can be extended at runtime with new operations or types.
94  bit isExtensible = 0;
95
96  // Whether inherent Attributes defined in ODS will be stored as Properties.
97  bit usePropertiesForAttributes = 1;
98}
99
100#endif // DIALECTBASE_TD
101