xref: /llvm-project/mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td (revision d4bde6968e11a6b8ff9ecd5fbca1d98d8f6feeca)
1//===- IRDLInterfaces.td - IRDL Attributes -----------------*- 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 declares the interfaces used by IRDL.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DIALECT_IRDL_IR_IRDLINTERFACES
14#define MLIR_DIALECT_IRDL_IR_IRDLINTERFACES
15
16include "mlir/IR/OpBase.td"
17
18class VerifyInterface<string name, string return_type>
19      : OpInterface<"Verify" # name # "Interface"> {
20  let cppNamespace = "::mlir::irdl";
21
22  let description = "Interface to get an IRDL"
23                  # name # "verifier from an operation.";
24
25  let methods = [
26    InterfaceMethod<
27      [{
28        Get an instance of a constraint verifier for the associated operation."
29        Returns `nullptr` upon failure.
30      }],
31      "std::unique_ptr<::mlir::irdl::" # return_type # ">",
32      "getVerifier",
33      (ins "::mlir::ArrayRef<Value>":$valueToConstr,
34      [{::mlir::DenseMap<::mlir::irdl::TypeOp,
35        std::unique_ptr<::mlir::DynamicTypeDefinition>> const&}]:$types,
36      [{::mlir::DenseMap<::mlir::irdl::AttributeOp,
37        std::unique_ptr<::mlir::DynamicAttrDefinition>> const&}]:$attrs)
38    >
39  ];
40}
41
42def VerifyConstraintInterface : VerifyInterface<"Constraint", "Constraint"> {}
43
44def VerifyRegionInterface : VerifyInterface<"Region", "RegionConstraint"> {}
45
46#endif // MLIR_DIALECT_IRDL_IR_IRDLINTERFACES
47