Skip to content

Commit

Permalink
[FIRRTL][CAPI] add layer for firrtlTypeGetRef
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jan 17, 2025
1 parent 375a8e0 commit ff1fc2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/circt-c/Dialect/FIRRTL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions lib/CAPI/Dialect/FIRRTL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,12 @@ unsigned firrtlTypeGetBundleFieldIndex(MlirType type, MlirStringRef fieldName) {

bool firrtlTypeIsARef(MlirType type) { return isa<RefType>(unwrap(type)); }

MlirType firrtlTypeGetRef(MlirType target, bool forceable) {
MlirType firrtlTypeGetRef(MlirType target, bool forceable, MlirAttribute layer) {
auto baseType = dyn_cast<FIRRTLBaseType>(unwrap(target));
assert(baseType && "target must be base type");
auto layerAttr = dyn_cast<SymbolRefAttr>(unwrap(layer));

return wrap(RefType::get(baseType, forceable));
return wrap(RefType::get(baseType, forceable, layerAttr));
}

bool firrtlTypeIsAAnyRef(MlirType type) {
Expand Down

0 comments on commit ff1fc2e

Please sign in to comment.