[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:10 PDT 2020


jpienaar updated this revision to Diff 249777.
jpienaar added a comment.

forgot cmakefile ...


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/CMakeLists.txt
  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_
Index: mlir/include/mlir/Interfaces/CMakeLists.txt
===================================================================
--- mlir/include/mlir/Interfaces/CMakeLists.txt
+++ mlir/include/mlir/Interfaces/CMakeLists.txt
@@ -8,6 +8,11 @@
 mlir_tablegen(ControlFlowInterfaces.cpp.inc -gen-op-interface-defs)
 add_public_tablegen_target(MLIRControlFlowInterfacesIncGen)
 
+set(LLVM_TARGET_DEFINITIONS DerivedAttributeOpInterface.td)
+mlir_tablegen(DerivedAttributeOpInterface.h.inc -gen-op-interface-decls)
+mlir_tablegen(DerivedAttributeOpInterface.cpp.inc -gen-op-interface-defs)
+add_public_tablegen_target(MLIRDerivedAttributeOpInterfaceIncGen)
+
 set(LLVM_TARGET_DEFINITIONS InferTypeOpInterface.td)
 mlir_tablegen(InferTypeOpInterface.h.inc -gen-op-interface-decls)
 mlir_tablegen(InferTypeOpInterface.cpp.inc -gen-op-interface-defs)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75953.249777.patch
Type: text/x-patch
Size: 3511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200311/8e386cb8/attachment.bin>


More information about the llvm-commits mailing list