Add a 'getDialectNamespace' utility to a few dialects.
authorRiver Riddle <riverriddle@google.com>
Sun, 26 May 2019 15:28:28 +0000 (08:28 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:03:43 +0000 (20:03 -0700)
--

PiperOrigin-RevId: 250049416

mlir/examples/Linalg/Linalg1/include/linalg1/Dialect.h
mlir/examples/Linalg/Linalg1/lib/DialectConstruction.cpp
mlir/include/mlir/AffineOps/AffineOps.h
mlir/include/mlir/StandardOps/Ops.h
mlir/lib/AffineOps/AffineOps.cpp
mlir/lib/StandardOps/Ops.cpp

index 70023e1..b14e626 100644 (file)
@@ -29,6 +29,7 @@ public:
   /// Create a new Dialect that is registered on construction and adds the
   /// relevant types and operations.
   explicit LinalgDialect(mlir::MLIRContext *context);
+  static llvm::StringRef getDialectNamespace() { return "linalg"; }
 
   /// Parse a type registered to this dialect.
   mlir::Type parseType(llvm::StringRef spec, mlir::Location loc) const override;
index 0eaab6a..bd74676 100644 (file)
@@ -29,7 +29,7 @@ using namespace mlir;
 using namespace linalg;
 
 LinalgDialect::LinalgDialect(MLIRContext *context)
-    : Dialect("linalg", context) {
+    : Dialect(getDialectNamespace(), context) {
   addTypes<RangeType, ViewType>();
   addOperations<RangeOp, SliceOp, ViewOp>();
 }
index d4dd214..a3749a3 100644 (file)
@@ -41,6 +41,7 @@ bool isTopLevelSymbol(Value *value);
 class AffineOpsDialect : public Dialect {
 public:
   AffineOpsDialect(MLIRContext *context);
+  static StringRef getDialectNamespace() { return "affine"; }
 };
 
 /// The "affine.apply" operation applies an affine map to a list of operands,
index b399fbe..1668d84 100644 (file)
@@ -35,6 +35,7 @@ class Builder;
 class StandardOpsDialect : public Dialect {
 public:
   StandardOpsDialect(MLIRContext *context);
+  static StringRef getDialectNamespace() { return "std"; }
 };
 
 /// The predicate indicates the type of the comparison to perform:
index 1a34c71..ffb1dd2 100644 (file)
@@ -36,7 +36,7 @@ using llvm::dbgs;
 //===----------------------------------------------------------------------===//
 
 AffineOpsDialect::AffineOpsDialect(MLIRContext *context)
-    : Dialect(/*name=*/"affine", context) {
+    : Dialect(getDialectNamespace(), context) {
   addOperations<AffineApplyOp, AffineForOp, AffineIfOp, AffineTerminatorOp>();
 }
 
index dd67546..316d36d 100644 (file)
@@ -80,7 +80,7 @@ template <typename T> static LogicalResult verifyCastOp(T op) {
 }
 
 StandardOpsDialect::StandardOpsDialect(MLIRContext *context)
-    : Dialect(/*name=*/"std", context) {
+    : Dialect(getDialectNamespace(), context) {
   addOperations<CondBranchOp, DmaStartOp, DmaWaitOp,
 #define GET_OP_LIST
 #include "mlir/StandardOps/Ops.cpp.inc"