[PATCH] D75953: [mlir] Add derived attribute op interface

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 15:20:09 PDT 2020


jpienaar updated this revision to Diff 249774.
jpienaar marked 2 inline comments as done.
jpienaar added a comment.

Moved to interfaces directory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75953/new/

https://reviews.llvm.org/D75953

Files:
  mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.h
  mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.td


Index: mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.td
===================================================================
--- /dev/null
+++ mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.td
@@ -0,0 +1,37 @@
+//===- DerivedAttributeOpInterface.td ----------------------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains a set of interfaces for derived attribute op interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DERIVEDATTRIBUTEOPINTERFACE
+#define MLIR_DERIVEDATTRIBUTEOPINTERFACE
+
+include "mlir/IR/OpBase.td"
+
+def DerivedAttributeOpInterface : OpInterface<"DerivedAttributeOpInterface"> {
+  let description = [{
+    Interface to query derived attribute characteristics.
+
+    Derived attributes are not stotred in the operation but are instead derived
+    from information of the operation. ODS generates convenience accessors for
+    derived attributes and can be used to simplify translations.
+  }];
+
+  let methods = [
+    StaticInterfaceMethod<
+      /*desc=*/"Returns whether string corresponds to derived attribute.",
+      /*retTy=*/"bool",
+      /*methodName=*/"isDerivedAttribute",
+      /*args=*/(ins "StringRef":$name)
+    >,
+  ];
+}
+
+#endif // MLIR_DERIVEDATTRIBUTEOPINTERFACE
Index: mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.h
===================================================================
--- /dev/null
+++ mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.h
@@ -0,0 +1,24 @@
+//===- DerivedAttributeOpInterface.h ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains a set of interfaces for derived attribute op interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_INTERFACES_DERIVEDATTRIBUTEOPINTERFACE_H_
+#define MLIR_INTERFACES_DERIVEDATTRIBUTEOPINTERFACE_H_
+
+#include "mlir/IR/OpDefinition.h"
+
+namespace mlir {
+
+#include "mlir/Analysis/DerivedAttributeOpInterface.h.inc"
+
+} // namespace mlir
+
+#endif // MLIR_INTERFACES_DERIVEDATTRIBUTEOPINTERFACE_H_


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75953.249774.patch
Type: text/x-patch
Size: 2679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200311/38b4aad7/attachment-0001.bin>


More information about the llvm-commits mailing list