Skip to content

Commit 68a3d41

Browse files
committed
Use tablegen based asm fmt
1 parent 96aabcf commit 68a3d41

File tree

2 files changed

+3
-49
lines changed

2 files changed

+3
-49
lines changed

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
239239
}]>
240240
];
241241

242-
// Printing and parsing available in CIRAttrs.cpp
243-
let hasCustomAssemblyFormat = 1;
242+
let assemblyFormat = [{
243+
`<` $elts `>`
244+
}];
244245

245246
// Enable verifier.
246247
let genVerifyDecl = 1;

clang/lib/CIR/Dialect/IR/CIRAttrs.cpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -340,53 +340,6 @@ LogicalResult cir::ConstVectorAttr::verify(
340340
return elementTypeCheck;
341341
}
342342

343-
Attribute cir::ConstVectorAttr::parse(AsmParser &parser, Type type) {
344-
FailureOr<Type> resultType;
345-
FailureOr<ArrayAttr> resultValue;
346-
347-
const SMLoc loc = parser.getCurrentLocation();
348-
349-
// Parse literal '<'
350-
if (parser.parseLess()) {
351-
return {};
352-
}
353-
354-
// Parse variable 'value'
355-
resultValue = FieldParser<ArrayAttr>::parse(parser);
356-
if (failed(resultValue)) {
357-
parser.emitError(parser.getCurrentLocation(),
358-
"failed to parse ConstVectorAttr parameter 'value' as "
359-
"an attribute");
360-
return {};
361-
}
362-
363-
if (parser.parseOptionalColon().failed()) {
364-
resultType = type;
365-
} else {
366-
resultType = ::mlir::FieldParser<Type>::parse(parser);
367-
if (failed(resultType)) {
368-
parser.emitError(parser.getCurrentLocation(),
369-
"failed to parse ConstVectorAttr parameter 'type' as "
370-
"an MLIR type");
371-
return {};
372-
}
373-
}
374-
375-
// Parse literal '>'
376-
if (parser.parseGreater()) {
377-
return {};
378-
}
379-
380-
return parser.getChecked<ConstVectorAttr>(
381-
loc, parser.getContext(), resultType.value(), resultValue.value());
382-
}
383-
384-
void cir::ConstVectorAttr::print(AsmPrinter &printer) const {
385-
printer << "<";
386-
printer.printStrippedAttrOrType(getElts());
387-
printer << ">";
388-
}
389-
390343
//===----------------------------------------------------------------------===//
391344
// CIR Dialect
392345
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)