Remove obsolete `getAsmResultNames` from OpAsmDialectInterface

This is superseded by the same method on OpAsmOpInterface, which is
available on the Dialect through the Fallback mechanism,

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D117750
This commit is contained in:
Mehdi Amini 2022-01-21 05:45:48 +00:00
parent 308d8b8c66
commit 9006bf4248
4 changed files with 6 additions and 25 deletions

View File

@ -1350,10 +1350,6 @@ public:
return AliasResult::NoAlias;
}
/// Get a special name to use when printing the given operation. See
/// OpAsmInterface.td#getAsmResultNames for usage details and documentation.
virtual void getAsmResultNames(Operation *op,
OpAsmSetValueNameFn setNameFn) const {}
};
} // namespace mlir

View File

@ -797,8 +797,7 @@ public:
/// A sentinel value used for values with names set.
enum : unsigned { NameSentinel = ~0U };
SSANameState(Operation *op, const OpPrintingFlags &printerFlags,
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces);
SSANameState(Operation *op, const OpPrintingFlags &printerFlags);
/// Print the SSA identifier for the given value to 'stream'. If
/// 'printResultNo' is true, it also presents the result number ('#' number)
@ -866,15 +865,12 @@ private:
/// These are the printing flags. They control, eg., whether to print in
/// generic form.
OpPrintingFlags printerFlags;
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces;
};
} // namespace
SSANameState::SSANameState(
Operation *op, const OpPrintingFlags &printerFlags,
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces)
: printerFlags(printerFlags), interfaces(interfaces) {
Operation *op, const OpPrintingFlags &printerFlags)
: printerFlags(printerFlags) {
llvm::SaveAndRestore<unsigned> valueIDSaver(nextValueID);
llvm::SaveAndRestore<unsigned> argumentIDSaver(nextArgumentID);
llvm::SaveAndRestore<unsigned> conflictIDSaver(nextConflictID);
@ -1071,8 +1067,6 @@ void SSANameState::numberValuesInOp(Operation &op) {
if (!printerFlags.shouldPrintGenericOpForm()) {
if (OpAsmOpInterface asmInterface = dyn_cast<OpAsmOpInterface>(&op))
asmInterface.getAsmResultNames(setResultNameFn);
else if (auto *asmInterface = interfaces.getInterfaceFor(op.getDialect()))
asmInterface->getAsmResultNames(&op, setResultNameFn);
}
// If the first result wasn't numbered, give it a default number.
@ -1172,7 +1166,7 @@ class AsmStateImpl {
public:
explicit AsmStateImpl(Operation *op, const OpPrintingFlags &printerFlags,
AsmState::LocationMap *locationMap)
: interfaces(op->getContext()), nameState(op, printerFlags, interfaces),
: interfaces(op->getContext()), nameState(op, printerFlags),
printerFlags(printerFlags), locationMap(locationMap) {}
/// Initialize the alias state to enable the printing of aliases.

View File

@ -1209,18 +1209,15 @@ func private @string_attr_name() attributes {"0 . 0", nested = {"0 . 0"}}
func private @nested_reference() attributes {test.ref = @some_symbol::@some_nested_symbol }
// CHECK-LABEL: func @custom_asm_names
func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32, i32) {
func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32) {
// CHECK: %[[FIRST:first.*]], %[[MIDDLE:middle_results.*]]:2, %[[LAST:[0-9]+]]
%0, %1:2, %2 = "test.asm_interface_op"() : () -> (i32, i32, i32, i32)
// CHECK: %[[FIRST_2:first.*]], %[[LAST_2:[0-9]+]]
%3, %4 = "test.asm_interface_op"() : () -> (i32, i32)
// CHECK: %[[RESULT:result.*]]
%5 = "test.asm_dialect_interface_op"() : () -> (i32)
// CHECK: return %[[FIRST]], %[[MIDDLE]]#0, %[[MIDDLE]]#1, %[[LAST]], %[[FIRST_2]], %[[LAST_2]]
return %0, %1#0, %1#1, %2, %3, %4, %5 : i32, i32, i32, i32, i32, i32, i32
return %0, %1#0, %1#1, %2, %3, %4 : i32, i32, i32, i32, i32, i32
}

View File

@ -99,12 +99,6 @@ struct TestOpAsmInterface : public OpAsmDialectInterface {
}
return AliasResult::NoAlias;
}
void getAsmResultNames(Operation *op,
OpAsmSetValueNameFn setNameFn) const final {
if (auto asmOp = dyn_cast<AsmDialectInterfaceOp>(op))
setNameFn(asmOp, "result");
}
};
struct TestDialectFoldInterface : public DialectFoldInterface {