From 3f6cbf6bde1cd5ab60e6c577ed0d1ed39b28b826 Mon Sep 17 00:00:00 2001 From: yassinz Date: Wed, 20 Nov 2024 00:50:23 +0100 Subject: [PATCH] [CAPI][Python][Arc, HW] Register Arc and HW passes (#7790) Expose Arc and HW passes to CAPI and Python bindings. --- include/circt-c/Dialect/HW.h | 1 + lib/Bindings/Python/CIRCTModule.cpp | 3 +++ lib/Bindings/Python/CMakeLists.txt | 1 + lib/CAPI/Dialect/CMakeLists.txt | 1 + lib/CAPI/Dialect/HW.cpp | 2 ++ 5 files changed, 8 insertions(+) diff --git a/include/circt-c/Dialect/HW.h b/include/circt-c/Dialect/HW.h index 4310190d03a9..0824cc6cd610 100644 --- a/include/circt-c/Dialect/HW.h +++ b/include/circt-c/Dialect/HW.h @@ -47,6 +47,7 @@ typedef struct HWModulePort HWModulePort; //===----------------------------------------------------------------------===// MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(HW, hw); +MLIR_CAPI_EXPORTED void registerHWPasses(void); //===----------------------------------------------------------------------===// // Type API. diff --git a/lib/Bindings/Python/CIRCTModule.cpp b/lib/Bindings/Python/CIRCTModule.cpp index 8510a04cf69c..3a2aa7cb3576 100644 --- a/lib/Bindings/Python/CIRCTModule.cpp +++ b/lib/Bindings/Python/CIRCTModule.cpp @@ -9,6 +9,7 @@ #include "CIRCTModules.h" #include "circt-c/Conversion.h" +#include "circt-c/Dialect/Arc.h" #include "circt-c/Dialect/Comb.h" #include "circt-c/Dialect/Debug.h" #include "circt-c/Dialect/ESI.h" @@ -37,11 +38,13 @@ namespace py = pybind11; static void registerPasses() { + registerArcPasses(); registerCombPasses(); registerSeqPasses(); registerSVPasses(); registerFSMPasses(); registerHWArithPasses(); + registerHWPasses(); registerHandshakePasses(); mlirRegisterConversionPasses(); mlirRegisterTransformsPasses(); diff --git a/lib/Bindings/Python/CMakeLists.txt b/lib/Bindings/Python/CMakeLists.txt index 8f2d07d85cc0..8259f5fe7b43 100644 --- a/lib/Bindings/Python/CMakeLists.txt +++ b/lib/Bindings/Python/CMakeLists.txt @@ -23,6 +23,7 @@ declare_mlir_python_extension(CIRCTBindingsPythonExtension SupportModule.cpp SVModule.cpp EMBED_CAPI_LINK_LIBS + CIRCTCAPIArc CIRCTCAPIComb CIRCTCAPIDebug CIRCTCAPIEmit diff --git a/lib/CAPI/Dialect/CMakeLists.txt b/lib/CAPI/Dialect/CMakeLists.txt index a6496af388ce..365e74c7c63d 100644 --- a/lib/CAPI/Dialect/CMakeLists.txt +++ b/lib/CAPI/Dialect/CMakeLists.txt @@ -91,6 +91,7 @@ add_circt_public_c_api_library(CIRCTCAPIHW LINK_LIBS PUBLIC MLIRCAPIIR CIRCTHW + CIRCTHWTransforms ) add_circt_public_c_api_library(CIRCTCAPILLHD diff --git a/lib/CAPI/Dialect/HW.cpp b/lib/CAPI/Dialect/HW.cpp index 732c322101a7..543ab0efed39 100644 --- a/lib/CAPI/Dialect/HW.cpp +++ b/lib/CAPI/Dialect/HW.cpp @@ -10,6 +10,7 @@ #include "circt/Dialect/HW/HWAttributes.h" #include "circt/Dialect/HW/HWInstanceGraph.h" #include "circt/Dialect/HW/HWOps.h" +#include "circt/Dialect/HW/HWPasses.h" #include "circt/Dialect/HW/HWTypes.h" #include "circt/Support/LLVM.h" #include "mlir/CAPI/IR.h" @@ -28,6 +29,7 @@ DEFINE_C_API_PTR_METHODS(HWInstanceGraphNode, igraph::InstanceGraphNode) //===----------------------------------------------------------------------===// MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(HW, hw, HWDialect) +void registerHWPasses() { registerPasses(); } //===----------------------------------------------------------------------===// // Type API.