[Mlir-commits] [mlir] f4548ed - [mlir] Add C API for ControlFlow dialect
Martin Erhart
llvmlistbot at llvm.org
Wed Mar 16 16:32:47 PDT 2022
Author: Martin Erhart
Date: 2022-03-17T00:29:00+01:00
New Revision: f4548ed7fc4fdaaf1761d736f65337d34da5a3af
URL: https://github.com/llvm/llvm-project/commit/f4548ed7fc4fdaaf1761d736f65337d34da5a3af
DIFF: https://github.com/llvm/llvm-project/commit/f4548ed7fc4fdaaf1761d736f65337d34da5a3af.diff
LOG: [mlir] Add C API for ControlFlow dialect
Add basic C API for the ControlFlow dialect. Follows the format of the other dialects.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D121867
Added:
mlir/include/mlir-c/Dialect/ControlFlow.h
mlir/lib/CAPI/Dialect/ControlFlow.cpp
Modified:
mlir/lib/CAPI/Dialect/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/include/mlir-c/Dialect/ControlFlow.h b/mlir/include/mlir-c/Dialect/ControlFlow.h
new file mode 100644
index 0000000000000..1ca7054d668e1
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/ControlFlow.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/ControlFlow.h - C API for ControlFlow ------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_C_DIALECT_CONTROLFLOW_H
+#define MLIR_C_DIALECT_CONTROLFLOW_H
+
+#include "mlir-c/Registration.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(ControlFlow, cf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_CONTROLFLOW_H
diff --git a/mlir/lib/CAPI/Dialect/CMakeLists.txt b/mlir/lib/CAPI/Dialect/CMakeLists.txt
index 9822f059e6cc6..37bc121f2c0dd 100644
--- a/mlir/lib/CAPI/Dialect/CMakeLists.txt
+++ b/mlir/lib/CAPI/Dialect/CMakeLists.txt
@@ -13,6 +13,15 @@ add_mlir_upstream_c_api_library(MLIRCAPIAsync
MLIRPass
)
+add_mlir_upstream_c_api_library(MLIRCAPIControlFlow
+ ControlFlow.cpp
+
+ PARTIAL_SOURCES_INTENDED
+ LINK_LIBS PUBLIC
+ MLIRCAPIIR
+ MLIRControlFlow
+)
+
add_mlir_upstream_c_api_library(MLIRCAPIGPU
GPU.cpp
GPUPasses.cpp
diff --git a/mlir/lib/CAPI/Dialect/ControlFlow.cpp b/mlir/lib/CAPI/Dialect/ControlFlow.cpp
new file mode 100644
index 0000000000000..1e5b2de1c2e58
--- /dev/null
+++ b/mlir/lib/CAPI/Dialect/ControlFlow.cpp
@@ -0,0 +1,14 @@
+//===- ControlFlow.cpp - C Interface for ControlFlow dialect --------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir-c/Dialect/ControlFlow.h"
+#include "mlir/CAPI/Registration.h"
+#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
+
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(ControlFlow, cf,
+ mlir::cf::ControlFlowDialect)
More information about the Mlir-commits
mailing list