Skip to content

Commit d3aa0bf

Browse files
jurahulgithub-actions[bot]
authored andcommitted
Automerge: [NFC][MLIR][TableGen] Drop namespace around static Op constraint functions (#162120)
Op constraints are emitted as static standalone functions and need not be surrounded by the Dialect's C++ namespace. Currently they are, and this change stops emitting a namespace around these static functions.
2 parents 6fa6616 + 333c758 commit d3aa0bf

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

mlir/include/mlir/TableGen/CodeGenHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class StaticVerifierFunctionEmitter {
8888
///
8989
/// Constraints that do not meet the restriction that they can only reference
9090
/// `$_self` and `$_op` are not uniqued.
91-
void emitOpConstraints(ArrayRef<const llvm::Record *> opDefs);
91+
void emitOpConstraints();
9292

9393
/// Unique all compatible type and attribute constraints from a pattern file
9494
/// and emit them at the top of the generated file.

mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
#define DEBUG_TYPE "xegpu"
2222

23-
namespace mlir {
24-
namespace xegpu {
23+
using namespace mlir;
24+
using namespace mlir::xegpu;
2525

2626
static bool isSharedMemory(const MemRefType &memrefTy) {
2727
Attribute attr = memrefTy.getMemorySpace();
@@ -1132,9 +1132,6 @@ LogicalResult StoreMatrixOp::verify() {
11321132
[&]() { return emitError(); });
11331133
}
11341134

1135-
} // namespace xegpu
1136-
} // namespace mlir
1137-
11381135
namespace mlir {
11391136
#include <mlir/Dialect/XeGPU/IR/XeGPUAttrInterface.cpp.inc>
11401137
} // namespace mlir

mlir/lib/TableGen/CodeGenHelpers.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ StaticVerifierFunctionEmitter::StaticVerifierFunctionEmitter(
4949
raw_ostream &os, const RecordKeeper &records, StringRef tag)
5050
: os(os), uniqueOutputLabel(getUniqueOutputLabel(records, tag)) {}
5151

52-
void StaticVerifierFunctionEmitter::emitOpConstraints(
53-
ArrayRef<const Record *> opDefs) {
54-
NamespaceEmitter namespaceEmitter(os, Operator(*opDefs[0]).getCppNamespace());
52+
void StaticVerifierFunctionEmitter::emitOpConstraints() {
5553
emitTypeConstraints();
5654
emitAttrConstraints();
5755
emitPropConstraints();

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4896,7 +4896,7 @@ static void emitOpClassDefs(const RecordKeeper &records,
48964896
constraintPrefix);
48974897
os << formatv(opCommentHeader, "Local Utility Method", "Definitions");
48984898
staticVerifierEmitter.collectOpConstraints(defs);
4899-
staticVerifierEmitter.emitOpConstraints(defs);
4899+
staticVerifierEmitter.emitOpConstraints();
49004900

49014901
// Emit the classes.
49024902
emitOpClasses(records, defs, os, staticVerifierEmitter,

0 commit comments

Comments
 (0)