diff --git a/mlir/include/mlir/IR/DialectImplementation.h b/mlir/include/mlir/IR/DialectImplementation.h --- a/mlir/include/mlir/IR/DialectImplementation.h +++ b/mlir/include/mlir/IR/DialectImplementation.h @@ -39,6 +39,10 @@ /// Print the given attribute to the stream. virtual void printAttribute(Attribute attr) = 0; + /// Print the given attribute without its type. The corresponding parser must + /// provide a valid type for the attribute. + virtual void printAttributeWithoutType(Attribute attr) = 0; + /// Print the given floating point value in a stabilized form that can be /// roundtripped through the IR. This is the companion to the 'parseFloat' /// hook on the DialectAsmParser. diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -2055,6 +2055,12 @@ /// Print the given attribute to the stream. void printAttribute(Attribute attr) override { printer.printAttribute(attr); } + /// Print the given attribute without its type. The corresponding parser must + /// provide a valid type for the attribute. + void printAttributeWithoutType(Attribute attr) override { + printer.printAttribute(attr, ModulePrinter::AttrTypeElision::Must); + } + /// Print the given floating point value in a stablized form. void printFloat(const APFloat &value) override { printFloatValue(value, getStream());