My Project
Type.h
Go to the documentation of this file.
1 //===- Type.h - Type class --------------------------------------*- C++ -*-===//
2 //
3 // Part of the MLIR 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 // Type wrapper to simplify using TableGen Record defining a MLIR Type.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_TABLEGEN_TYPE_H_
14 #define MLIR_TABLEGEN_TYPE_H_
15 
16 #include "mlir/Support/LLVM.h"
18 #include "mlir/TableGen/Dialect.h"
19 
20 namespace llvm {
21 class DefInit;
22 class Record;
23 } // end namespace llvm
24 
25 namespace mlir {
26 namespace tblgen {
27 
28 // Wrapper class with helper methods for accessing Type constraints defined in
29 // TableGen.
30 class TypeConstraint : public Constraint {
31 public:
32  explicit TypeConstraint(const llvm::Record *record);
33  explicit TypeConstraint(const llvm::DefInit *init);
34 
35  static bool classof(const Constraint *c) { return c->getKind() == CK_Type; }
36 
37  // Returns true if this is a variadic type constraint.
38  bool isVariadic() const;
39 };
40 
41 // Wrapper class with helper methods for accessing Types defined in TableGen.
42 class Type : public TypeConstraint {
43 public:
44  explicit Type(const llvm::Record *record);
45 
46  // Returns the description of the type.
47  StringRef getTypeDescription() const;
48 
49  // Returns the dialect for the type if defined.
50  Dialect getDialect() const;
51 };
52 
53 } // end namespace tblgen
54 } // end namespace mlir
55 
56 #endif // MLIR_TABLEGEN_TYPE_H_
Definition: InferTypeOpInterface.cpp:20
Definition: PassRegistry.cpp:413
Definition: Attributes.h:139
Definition: Dialect.h:25
Definition: Constraint.h:30
static bool classof(const Constraint *c)
Definition: Type.h:35
Definition: Type.h:42
Definition: Type.h:30
Kind getKind() const
Definition: Constraint.h:53