48 changes: 48 additions & 0 deletions mlir/lib/CAPI/Dialect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# TODO: Make the check source feature optional as an argument on *_add_library.
set(LLVM_OPTIONAL_SOURCES
Linalg.cpp
SCF.cpp
Shape.cpp
Standard.cpp
Tensor.cpp
)

add_mlir_public_c_api_library(MLIRCAPILinalg
Linalg.cpp

LINK_LIBS PUBLIC
MLIRCAPIIR
MLIRLinalg
)

add_mlir_public_c_api_library(MLIRCAPISCF
SCF.cpp

LINK_LIBS PUBLIC
MLIRCAPIIR
MLIRSCF
)

add_mlir_public_c_api_library(MLIRCAPIShape
Shape.cpp

LINK_LIBS PUBLIC
MLIRCAPIIR
MLIRShape
)

add_mlir_public_c_api_library(MLIRCAPIStandard
Standard.cpp

LINK_LIBS PUBLIC
MLIRCAPIIR
MLIRStandard
)

add_mlir_public_c_api_library(MLIRCAPITensor
Tensor.cpp

LINK_LIBS PUBLIC
MLIRCAPIIR
MLIRTensor
)
14 changes: 14 additions & 0 deletions mlir/lib/CAPI/Dialect/Linalg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===- Linalg.cpp - C Interface for Linalg 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/Linalg.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Linalg, linalg,
mlir::linalg::LinalgDialect);
13 changes: 13 additions & 0 deletions mlir/lib/CAPI/Dialect/SCF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===- SCF.cpp - C Interface for SCF 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/Dialect/SCF/SCF.h"
#include "mlir-c/Dialect/SCF.h"
#include "mlir/CAPI/Registration.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(SCF, scf, mlir::scf::SCFDialect);
13 changes: 13 additions & 0 deletions mlir/lib/CAPI/Dialect/Shape.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===- Shape.cpp - C Interface for Shape 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/Dialect/Shape/IR/Shape.h"
#include "mlir-c/Dialect/Shape.h"
#include "mlir/CAPI/Registration.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Shape, shape, mlir::shape::ShapeDialect);
13 changes: 13 additions & 0 deletions mlir/lib/CAPI/Dialect/Standard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===- Standard.cpp - C Interface for Standard 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/Standard.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Standard, std, mlir::StandardOpsDialect);
14 changes: 14 additions & 0 deletions mlir/lib/CAPI/Dialect/Tensor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===- Tensor.cpp - C Interface for Tensor 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/Dialect/Tensor/IR/Tensor.h"
#include "mlir-c/Dialect/Tensor.h"
#include "mlir/CAPI/Registration.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Tensor, tensor,
mlir::tensor::TensorDialect);
7 changes: 0 additions & 7 deletions mlir/lib/CAPI/Standard/CMakeLists.txt

This file was deleted.

25 changes: 0 additions & 25 deletions mlir/lib/CAPI/Standard/StandardDialect.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions mlir/test/Bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include(AddMLIRPythonExtension)
add_mlir_dialect_python_bindings(MLIRBindingsPythonTestOps
python_test_ops.td
python_test)
TD_FILE python_test_ops.td
DIALECT_NAME python_test)
2 changes: 1 addition & 1 deletion mlir/test/CAPI/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "mlir-c/BuiltinAttributes.h"
#include "mlir-c/BuiltinTypes.h"
#include "mlir-c/Diagnostics.h"
#include "mlir-c/Dialect/Standard.h"
#include "mlir-c/Registration.h"
#include "mlir-c/StandardDialect.h"

#include <assert.h>
#include <math.h>
Expand Down