Skip to content

Commit 9006bf4

Browse files
committed
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
1 parent 308d8b8 commit 9006bf4

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

mlir/include/mlir/IR/OpImplementation.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,10 +1350,6 @@ class OpAsmDialectInterface
13501350
return AliasResult::NoAlias;
13511351
}
13521352

1353-
/// Get a special name to use when printing the given operation. See
1354-
/// OpAsmInterface.td#getAsmResultNames for usage details and documentation.
1355-
virtual void getAsmResultNames(Operation *op,
1356-
OpAsmSetValueNameFn setNameFn) const {}
13571353
};
13581354
} // namespace mlir
13591355

mlir/lib/IR/AsmPrinter.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,7 @@ class SSANameState {
797797
/// A sentinel value used for values with names set.
798798
enum : unsigned { NameSentinel = ~0U };
799799

800-
SSANameState(Operation *op, const OpPrintingFlags &printerFlags,
801-
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces);
800+
SSANameState(Operation *op, const OpPrintingFlags &printerFlags);
802801

803802
/// Print the SSA identifier for the given value to 'stream'. If
804803
/// 'printResultNo' is true, it also presents the result number ('#' number)
@@ -866,15 +865,12 @@ class SSANameState {
866865
/// These are the printing flags. They control, eg., whether to print in
867866
/// generic form.
868867
OpPrintingFlags printerFlags;
869-
870-
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces;
871868
};
872869
} // namespace
873870

874871
SSANameState::SSANameState(
875-
Operation *op, const OpPrintingFlags &printerFlags,
876-
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces)
877-
: printerFlags(printerFlags), interfaces(interfaces) {
872+
Operation *op, const OpPrintingFlags &printerFlags)
873+
: printerFlags(printerFlags) {
878874
llvm::SaveAndRestore<unsigned> valueIDSaver(nextValueID);
879875
llvm::SaveAndRestore<unsigned> argumentIDSaver(nextArgumentID);
880876
llvm::SaveAndRestore<unsigned> conflictIDSaver(nextConflictID);
@@ -1071,8 +1067,6 @@ void SSANameState::numberValuesInOp(Operation &op) {
10711067
if (!printerFlags.shouldPrintGenericOpForm()) {
10721068
if (OpAsmOpInterface asmInterface = dyn_cast<OpAsmOpInterface>(&op))
10731069
asmInterface.getAsmResultNames(setResultNameFn);
1074-
else if (auto *asmInterface = interfaces.getInterfaceFor(op.getDialect()))
1075-
asmInterface->getAsmResultNames(&op, setResultNameFn);
10761070
}
10771071

10781072
// If the first result wasn't numbered, give it a default number.
@@ -1172,7 +1166,7 @@ class AsmStateImpl {
11721166
public:
11731167
explicit AsmStateImpl(Operation *op, const OpPrintingFlags &printerFlags,
11741168
AsmState::LocationMap *locationMap)
1175-
: interfaces(op->getContext()), nameState(op, printerFlags, interfaces),
1169+
: interfaces(op->getContext()), nameState(op, printerFlags),
11761170
printerFlags(printerFlags), locationMap(locationMap) {}
11771171

11781172
/// Initialize the alias state to enable the printing of aliases.

mlir/test/IR/parser.mlir

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,18 +1209,15 @@ func private @string_attr_name() attributes {"0 . 0", nested = {"0 . 0"}}
12091209
func private @nested_reference() attributes {test.ref = @some_symbol::@some_nested_symbol }
12101210

12111211
// CHECK-LABEL: func @custom_asm_names
1212-
func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32, i32) {
1212+
func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32) {
12131213
// CHECK: %[[FIRST:first.*]], %[[MIDDLE:middle_results.*]]:2, %[[LAST:[0-9]+]]
12141214
%0, %1:2, %2 = "test.asm_interface_op"() : () -> (i32, i32, i32, i32)
12151215

12161216
// CHECK: %[[FIRST_2:first.*]], %[[LAST_2:[0-9]+]]
12171217
%3, %4 = "test.asm_interface_op"() : () -> (i32, i32)
12181218

1219-
// CHECK: %[[RESULT:result.*]]
1220-
%5 = "test.asm_dialect_interface_op"() : () -> (i32)
1221-
12221219
// CHECK: return %[[FIRST]], %[[MIDDLE]]#0, %[[MIDDLE]]#1, %[[LAST]], %[[FIRST_2]], %[[LAST_2]]
1223-
return %0, %1#0, %1#1, %2, %3, %4, %5 : i32, i32, i32, i32, i32, i32, i32
1220+
return %0, %1#0, %1#1, %2, %3, %4 : i32, i32, i32, i32, i32, i32
12241221
}
12251222

12261223

mlir/test/lib/Dialect/Test/TestDialect.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ struct TestOpAsmInterface : public OpAsmDialectInterface {
9999
}
100100
return AliasResult::NoAlias;
101101
}
102-
103-
void getAsmResultNames(Operation *op,
104-
OpAsmSetValueNameFn setNameFn) const final {
105-
if (auto asmOp = dyn_cast<AsmDialectInterfaceOp>(op))
106-
setNameFn(asmOp, "result");
107-
}
108102
};
109103

110104
struct TestDialectFoldInterface : public DialectFoldInterface {

0 commit comments

Comments
 (0)