[Mlir-commits] [mlir] 333c758 - [NFC][MLIR][TableGen] Drop namespace around static Op constraint functions (#162120)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 15 17:18:14 PDT 2025
Author: Rahul Joshi
Date: 2025-10-15T17:18:11-07:00
New Revision: 333c75846d34b0b486385136f22d1d4d4f108b62
URL: https://github.com/llvm/llvm-project/commit/333c75846d34b0b486385136f22d1d4d4f108b62
DIFF: https://github.com/llvm/llvm-project/commit/333c75846d34b0b486385136f22d1d4d4f108b62.diff
LOG: [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.
Added:
Modified:
mlir/include/mlir/TableGen/CodeGenHelpers.h
mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
mlir/lib/TableGen/CodeGenHelpers.cpp
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/TableGen/CodeGenHelpers.h b/mlir/include/mlir/TableGen/CodeGenHelpers.h
index 252da21419b6e..997aef26bdc01 100644
--- a/mlir/include/mlir/TableGen/CodeGenHelpers.h
+++ b/mlir/include/mlir/TableGen/CodeGenHelpers.h
@@ -88,7 +88,7 @@ class StaticVerifierFunctionEmitter {
///
/// Constraints that do not meet the restriction that they can only reference
/// `$_self` and `$_op` are not uniqued.
- void emitOpConstraints(ArrayRef<const llvm::Record *> opDefs);
+ void emitOpConstraints();
/// Unique all compatible type and attribute constraints from a pattern file
/// and emit them at the top of the generated file.
diff --git a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
index 464a9e2d2a806..abd12e2e69ac0 100644
--- a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
+++ b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
@@ -20,8 +20,8 @@
#define DEBUG_TYPE "xegpu"
-namespace mlir {
-namespace xegpu {
+using namespace mlir;
+using namespace mlir::xegpu;
static bool isSharedMemory(const MemRefType &memrefTy) {
Attribute attr = memrefTy.getMemorySpace();
@@ -1132,9 +1132,6 @@ LogicalResult StoreMatrixOp::verify() {
[&]() { return emitError(); });
}
-} // namespace xegpu
-} // namespace mlir
-
namespace mlir {
#include <mlir/Dialect/XeGPU/IR/XeGPUAttrInterface.cpp.inc>
} // namespace mlir
diff --git a/mlir/lib/TableGen/CodeGenHelpers.cpp b/mlir/lib/TableGen/CodeGenHelpers.cpp
index cb90ef82c1c39..d52d5e769ee6d 100644
--- a/mlir/lib/TableGen/CodeGenHelpers.cpp
+++ b/mlir/lib/TableGen/CodeGenHelpers.cpp
@@ -49,9 +49,7 @@ StaticVerifierFunctionEmitter::StaticVerifierFunctionEmitter(
raw_ostream &os, const RecordKeeper &records, StringRef tag)
: os(os), uniqueOutputLabel(getUniqueOutputLabel(records, tag)) {}
-void StaticVerifierFunctionEmitter::emitOpConstraints(
- ArrayRef<const Record *> opDefs) {
- NamespaceEmitter namespaceEmitter(os, Operator(*opDefs[0]).getCppNamespace());
+void StaticVerifierFunctionEmitter::emitOpConstraints() {
emitTypeConstraints();
emitAttrConstraints();
emitPropConstraints();
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index daae3c79ffd43..371864830a3c1 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -4896,7 +4896,7 @@ static void emitOpClassDefs(const RecordKeeper &records,
constraintPrefix);
os << formatv(opCommentHeader, "Local Utility Method", "Definitions");
staticVerifierEmitter.collectOpConstraints(defs);
- staticVerifierEmitter.emitOpConstraints(defs);
+ staticVerifierEmitter.emitOpConstraints();
// Emit the classes.
emitOpClasses(records, defs, os, staticVerifierEmitter,
More information about the Mlir-commits
mailing list