diff --git a/include/circt-c/Dialect/FIRRTL.h b/include/circt-c/Dialect/FIRRTL.h index 7a02f84180b3..47edccc98be8 100644 --- a/include/circt-c/Dialect/FIRRTL.h +++ b/include/circt-c/Dialect/FIRRTL.h @@ -208,7 +208,8 @@ firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName); MLIR_CAPI_EXPORTED bool firrtlTypeIsARef(MlirType type); /// Creates a ref type. -MLIR_CAPI_EXPORTED MlirType firrtlTypeGetRef(MlirType target, bool forceable); +MLIR_CAPI_EXPORTED MlirType firrtlTypeGetRef(MlirType target, bool forceable, + MlirAttribute layer); /// Checks if this type is an anyref type. MLIR_CAPI_EXPORTED bool firrtlTypeIsAAnyRef(MlirType type); diff --git a/lib/CAPI/Dialect/FIRRTL.cpp b/lib/CAPI/Dialect/FIRRTL.cpp index 3827b07acf67..6db5cdb5957b 100644 --- a/lib/CAPI/Dialect/FIRRTL.cpp +++ b/lib/CAPI/Dialect/FIRRTL.cpp @@ -185,11 +185,12 @@ unsigned firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName) { bool firrtlTypeIsARef(MlirType type) { return isa(unwrap(type)); } -MlirType firrtlTypeGetRef(MlirType target, bool forceable) { +MlirType firrtlTypeGetRef(MlirType target, bool forceable, MlirAttribute layer) { auto baseType = dyn_cast(unwrap(target)); assert(baseType && "target must be base type"); + auto layerAttr = dyn_cast(unwrap(layer)); - return wrap(RefType::get(baseType, forceable)); + return wrap(RefType::get(baseType, forceable, layerAttr)); } bool firrtlTypeIsAAnyRef(MlirType type) {