Skip to content

Conversation

@maerhart
Copy link
Member

No description provided.

@maerhart maerhart requested a review from Mogball as a code owner February 13, 2025 10:18
@llvmbot llvmbot added the mlir label Feb 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 13, 2025

@llvm/pr-subscribers-mlir

Author: Martin Erhart (maerhart)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/127039.diff

3 Files Affected:

  • (added) mlir/include/mlir-c/Dialect/Index.h (+24)
  • (modified) mlir/lib/CAPI/Dialect/CMakeLists.txt (+9)
  • (added) mlir/lib/CAPI/Dialect/Index.cpp (+13)
diff --git a/mlir/include/mlir-c/Dialect/Index.h b/mlir/include/mlir-c/Dialect/Index.h
new file mode 100644
index 0000000000000..3f05694acf7a7
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Index.h
@@ -0,0 +1,24 @@
+//===-- mlir-c/Dialect/Index.h - C API for Index dialect ----------*- 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_INDEX_H
+#define MLIR_C_DIALECT_INDEX_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Index, index);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_INDEX_H
diff --git a/mlir/lib/CAPI/Dialect/CMakeLists.txt b/mlir/lib/CAPI/Dialect/CMakeLists.txt
index 5ad4bafedf6c4..ddd3d6629a532 100644
--- a/mlir/lib/CAPI/Dialect/CMakeLists.txt
+++ b/mlir/lib/CAPI/Dialect/CMakeLists.txt
@@ -81,6 +81,15 @@ add_mlir_upstream_c_api_library(MLIRCAPIGPU
   MLIRPass
 )
 
+add_mlir_upstream_c_api_library(MLIRCAPIIndex
+  Index.cpp
+
+  PARTIAL_SOURCES_INTENDED
+  LINK_LIBS PUBLIC
+  MLIRCAPIIR
+  MLIRIndexDialect
+)
+
 add_mlir_upstream_c_api_library(MLIRCAPIIRDL
   IRDL.cpp
 
diff --git a/mlir/lib/CAPI/Dialect/Index.cpp b/mlir/lib/CAPI/Dialect/Index.cpp
new file mode 100644
index 0000000000000..84579143605f9
--- /dev/null
+++ b/mlir/lib/CAPI/Dialect/Index.cpp
@@ -0,0 +1,13 @@
+//===- Index.cpp - C Interface for Index 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/Index.h"
+#include "mlir/CAPI/Registration.h"
+#include "mlir/Dialect/Index/IR/IndexDialect.h"
+
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Index, index, mlir::index::IndexDialect)

@maerhart maerhart merged commit 9a63a2c into main Feb 13, 2025
10 checks passed
@maerhart maerhart deleted the users/maerhart/index-capi branch February 13, 2025 17:37
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants