1//===- DerivedAttributeOpInterface.td ----------------------*- 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 a set of interfaces for derived attribute op interface.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DERIVEDATTRIBUTEOPINTERFACE
14#define MLIR_DERIVEDATTRIBUTEOPINTERFACE
15
16include "mlir/IR/OpBase.td"
17
18def DerivedAttributeOpInterface : OpInterface<"DerivedAttributeOpInterface"> {
19  let description = [{
20    Interface to query derived attribute characteristics.
21
22    Derived attributes are not stored in the operation but are instead derived
23    from information of the operation. ODS generates convenience accessors for
24    derived attributes and can be used to simplify translations.
25  }];
26  let cppNamespace = "::mlir";
27
28  let methods = [
29    StaticInterfaceMethod<
30      /*desc=*/"Returns whether name corresponds to a derived attribute.",
31      /*retTy=*/"bool",
32      /*methodName=*/"isDerivedAttribute",
33      /*args=*/(ins "StringRef":$name)
34    >,
35    InterfaceMethod<
36      /*desc=*/[{
37        Materializes the derived attributes. Returns null attribute where
38        unable to materialize a derived attribute as attribute.
39      }],
40      /*retTy=*/"DictionaryAttr",
41      /*methodName=*/"materializeDerivedAttributes"
42    >,
43  ];
44}
45
46#endif // MLIR_DERIVEDATTRIBUTEOPINTERFACE
47