34 StringAttr::get(ctx, hw::HWModuleLike::getPortSymbolAttrName());
35 NamedAttrList pattr(attrs);
38 oldValue = pattr.erase(portSymAttr);
40 oldValue = pattr.set(portSymAttr, sym);
41 if (oldValue != sym) {
42 attrs = pattr.getDictionary(ctx);
53LogicalResult hw::verifyInnerSymAttr(InnerSymbolOpInterface op) {
54 auto innerSym = op.getInnerSymAttr();
60 return op->emitOpError(
"has empty list of inner symbols");
62 if (!op.supportsPerFieldSymbols()) {
64 if (innerSym.size() > 1 || !innerSym.getSymName()) {
65 op->emitOpError(
"does not support per-field inner symbols");
71 auto result = op.getTargetResult();
77 auto resultType = result.getType();
78 auto maxFields = FieldIdImpl::getMaxFieldID(resultType);
79 llvm::SmallBitVector indices(maxFields + 1);
80 llvm::SmallPtrSet<Attribute, 8> symNames;
82 auto uniqSyms = [&](InnerSymPropertiesAttr p) {
83 if (maxFields < p.getFieldID()) {
84 op->emitOpError(
"field id:'" + Twine(p.getFieldID()) +
85 "' is greater than the maximum field id:'" +
86 Twine(maxFields) +
"'");
89 if (indices.test(p.getFieldID())) {
90 op->emitOpError(
"cannot assign multiple symbol names to the field id:'" +
91 Twine(p.getFieldID()) +
"'");
94 indices.set(p.getFieldID());
95 auto it = symNames.insert(p.getName());
97 op->emitOpError(
"cannot reuse symbol name:'" + p.getName().getValue() +
104 if (!llvm::all_of(innerSym.getProps(), uniqSyms))