Skip to content

Commit ed233e1

Browse files
committed
[NFC][MLIR][TableGen] Drop namespace around op constraints functions
Op constraints are emitted as uniqued static standalone funtions and need not be surrounded by the Op's C++ namespace.
1 parent 08e9540 commit ed233e1

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();
@@ -1133,9 +1133,6 @@ LogicalResult MemDescSubviewOp::verify() {
11331133
return success();
11341134
}
11351135

1136-
} // namespace xegpu
1137-
} // namespace mlir
1138-
11391136
namespace mlir {
11401137
#include <mlir/Dialect/XeGPU/IR/XeGPUAttrInterface.cpp.inc>
11411138
} // 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
@@ -4871,7 +4871,7 @@ static void emitOpClassDefs(const RecordKeeper &records,
48714871
constraintPrefix);
48724872
os << formatv(opCommentHeader, "Local Utility Method", "Definitions");
48734873
staticVerifierEmitter.collectOpConstraints(defs);
4874-
staticVerifierEmitter.emitOpConstraints(defs);
4874+
staticVerifierEmitter.emitOpConstraints();
48754875

48764876
// Emit the classes.
48774877
emitOpClasses(records, defs, os, staticVerifierEmitter,

0 commit comments

Comments
 (0)