aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-09-28 14:50:44 +0100
committerYann Herklotz <git@yannherklotz.com>2021-09-28 14:50:44 +0100
commita08f79d3e01c92859e6b33f602b2be2bb8c52e61 (patch)
treeaa6fe94ea8b3ad841dbda0e354a88f8291d6973d /include
downloadgsa-mlir-a08f79d3e01c92859e6b33f602b2be2bb8c52e61.tar.gz
gsa-mlir-a08f79d3e01c92859e6b33f602b2be2bb8c52e61.zip
Add initial files
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt1
-rw-r--r--include/Standalone/CMakeLists.txt3
-rw-r--r--include/Standalone/StandaloneDialect.h16
-rw-r--r--include/Standalone/StandaloneDialect.td36
-rw-r--r--include/Standalone/StandaloneOps.h20
-rw-r--r--include/Standalone/StandaloneOps.td42
6 files changed, 118 insertions, 0 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
index 0000000..da11071
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(Standalone)
diff --git a/include/Standalone/CMakeLists.txt b/include/Standalone/CMakeLists.txt
new file mode 100644
index 0000000..8acf640
--- /dev/null
+++ b/include/Standalone/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_mlir_dialect(StandaloneOps standalone)
+add_mlir_doc(StandaloneDialect StandaloneDialect Standalone/ -gen-dialect-doc)
+add_mlir_doc(StandaloneOps StandaloneOps Standalone/ -gen-op-doc)
diff --git a/include/Standalone/StandaloneDialect.h b/include/Standalone/StandaloneDialect.h
new file mode 100644
index 0000000..d3eb24c
--- /dev/null
+++ b/include/Standalone/StandaloneDialect.h
@@ -0,0 +1,16 @@
+//===- StandaloneDialect.h - Standalone dialect -----------------*- C++ -*-===//
+//
+// This file is licensed 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef STANDALONE_STANDALONEDIALECT_H
+#define STANDALONE_STANDALONEDIALECT_H
+
+#include "mlir/IR/Dialect.h"
+
+#include "Standalone/StandaloneOpsDialect.h.inc"
+
+#endif // STANDALONE_STANDALONEDIALECT_H
diff --git a/include/Standalone/StandaloneDialect.td b/include/Standalone/StandaloneDialect.td
new file mode 100644
index 0000000..a7fd789
--- /dev/null
+++ b/include/Standalone/StandaloneDialect.td
@@ -0,0 +1,36 @@
+//===- StandaloneDialect.td - Standalone dialect -----------*- tablegen -*-===//
+//
+// This file is licensed 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef STANDALONE_DIALECT
+#define STANDALONE_DIALECT
+
+include "mlir/IR/OpBase.td"
+
+//===----------------------------------------------------------------------===//
+// Standalone dialect definition.
+//===----------------------------------------------------------------------===//
+
+def Standalone_Dialect : Dialect {
+ let name = "standalone";
+ let summary = "A standalone out-of-tree MLIR dialect.";
+ let description = [{
+ This dialect is an example of an out-of-tree MLIR dialect designed to
+ illustrate the basic setup required to develop MLIR-based tools without
+ working inside of the LLVM source tree.
+ }];
+ let cppNamespace = "::mlir::standalone";
+}
+
+//===----------------------------------------------------------------------===//
+// Base standalone operation definition.
+//===----------------------------------------------------------------------===//
+
+class Standalone_Op<string mnemonic, list<OpTrait> traits = []> :
+ Op<Standalone_Dialect, mnemonic, traits>;
+
+#endif // STANDALONE_DIALECT
diff --git a/include/Standalone/StandaloneOps.h b/include/Standalone/StandaloneOps.h
new file mode 100644
index 0000000..a56c286
--- /dev/null
+++ b/include/Standalone/StandaloneOps.h
@@ -0,0 +1,20 @@
+//===- StandaloneOps.h - Standalone dialect ops -----------------*- C++ -*-===//
+//
+// This file is licensed 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef STANDALONE_STANDALONEOPS_H
+#define STANDALONE_STANDALONEOPS_H
+
+#include "mlir/IR/BuiltinTypes.h"
+#include "mlir/IR/Dialect.h"
+#include "mlir/IR/OpDefinition.h"
+#include "mlir/Interfaces/SideEffectInterfaces.h"
+
+#define GET_OP_CLASSES
+#include "Standalone/StandaloneOps.h.inc"
+
+#endif // STANDALONE_STANDALONEOPS_H
diff --git a/include/Standalone/StandaloneOps.td b/include/Standalone/StandaloneOps.td
new file mode 100644
index 0000000..f6ba7a6
--- /dev/null
+++ b/include/Standalone/StandaloneOps.td
@@ -0,0 +1,42 @@
+//===- StandaloneOps.td - Standalone dialect ops -----------*- tablegen -*-===//
+//
+// This file is licensed 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef STANDALONE_OPS
+#define STANDALONE_OPS
+
+include "StandaloneDialect.td"
+include "mlir/Interfaces/SideEffectInterfaces.td"
+
+def Standalone_FooOp : Standalone_Op<"foo", [NoSideEffect,
+ SameOperandsAndResultType]> {
+ let summary = "Illustrates how to define an operation.";
+ let description = [{
+ The `standalone.foo` operation illustrates how to define a new
+ operation in a dialect. It uses an operation trait to declare that it
+ has no side effects.
+
+ This operation takes an integer argument and returns an integer.
+
+ Example:
+
+ ```mlir
+ %0 = constant 2 : i32
+ // Apply the foo operation to %0
+ %1 = standalone.foo %0 : i32
+ ```
+ }];
+
+ let arguments = (ins I32:$input);
+ let results = (outs I32:$res);
+
+ let assemblyFormat = [{
+ $input attr-dict `:` type($input)
+ }];
+}
+
+#endif // STANDALONE_OPS