Skip to content

Commit 9a63a2c

Browse files
authored
[mlir][index] Add CAPI (#127039)
1 parent 07405ca commit 9a63a2c

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

mlir/include/mlir-c/Dialect/Index.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===-- mlir-c/Dialect/Index.h - C API for Index dialect ----------*- C -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef MLIR_C_DIALECT_INDEX_H
10+
#define MLIR_C_DIALECT_INDEX_H
11+
12+
#include "mlir-c/IR.h"
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif
17+
18+
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Index, index);
19+
20+
#ifdef __cplusplus
21+
}
22+
#endif
23+
24+
#endif // MLIR_C_DIALECT_INDEX_H

mlir/lib/CAPI/Dialect/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ add_mlir_upstream_c_api_library(MLIRCAPIGPU
8181
MLIRPass
8282
)
8383

84+
add_mlir_upstream_c_api_library(MLIRCAPIIndex
85+
Index.cpp
86+
87+
PARTIAL_SOURCES_INTENDED
88+
LINK_LIBS PUBLIC
89+
MLIRCAPIIR
90+
MLIRIndexDialect
91+
)
92+
8493
add_mlir_upstream_c_api_library(MLIRCAPIIRDL
8594
IRDL.cpp
8695

mlir/lib/CAPI/Dialect/Index.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//===- Index.cpp - C Interface for Index dialect --------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "mlir-c/Dialect/Index.h"
10+
#include "mlir/CAPI/Registration.h"
11+
#include "mlir/Dialect/Index/IR/IndexDialect.h"
12+
13+
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Index, index, mlir::index::IndexDialect)

0 commit comments

Comments
 (0)