Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard...
authorRiver Riddle <riverriddle@google.com>
Sat, 11 May 2019 19:45:35 +0000 (12:45 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 20 May 2019 20:36:59 +0000 (13:36 -0700)
--

PiperOrigin-RevId: 247771192

mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/IR/Operation.h
mlir/include/mlir/IR/OperationSupport.h
mlir/include/mlir/StandardOps/Ops.h
mlir/lib/StandardOps/Ops.cpp

index c42050c..b80e8ac 100644 (file)
@@ -776,7 +776,7 @@ public:
   /// This hook can be overridden with a more specific implementation in
   /// the subclass of Base.
   ///
-  static bool isClassFor(Operation *op) {
+  static bool classof(Operation *op) {
     return op->getName().getStringRef() == ConcreteType::getOperationName();
   }
 
index 8c6064b..54e49b7 100644 (file)
@@ -407,7 +407,7 @@ public:
 
   /// The is methods return true if the operation is a typed op (like DimOp) of
   /// of the given class.
-  template <typename OpClass> bool isa() { return OpClass::isClassFor(this); }
+  template <typename OpClass> bool isa() { return OpClass::classof(this); }
 
   //===--------------------------------------------------------------------===//
   // Operation Walkers
index 24f6b88..169012a 100644 (file)
@@ -82,7 +82,7 @@ public:
   Dialect &dialect;
 
   /// Return true if this "op class" can match against the specified operation.
-  bool (&isClassFor)(Operation *op);
+  bool (&classof)(Operation *op);
 
   /// Use the specified object to parse this ops custom assembly format.
   ParseResult (&parseAssembly)(OpAsmParser *parser, OperationState *result);
@@ -141,15 +141,15 @@ public:
   /// operations they contain.
   template <typename T> static AbstractOperation get(Dialect &dialect) {
     return AbstractOperation(
-        T::getOperationName(), dialect, T::getOperationProperties(),
-        T::isClassFor, T::parseAssembly, T::printAssembly, T::verifyInvariants,
+        T::getOperationName(), dialect, T::getOperationProperties(), T::classof,
+        T::parseAssembly, T::printAssembly, T::verifyInvariants,
         T::constantFoldHook, T::foldHook, T::getCanonicalizationPatterns);
   }
 
 private:
   AbstractOperation(
       StringRef name, Dialect &dialect, OperationProperties opProperties,
-      bool (&isClassFor)(Operation *op),
+      bool (&classof)(Operation *op),
       ParseResult (&parseAssembly)(OpAsmParser *parser, OperationState *result),
       void (&printAssembly)(Operation *op, OpAsmPrinter *p),
       LogicalResult (&verifyInvariants)(Operation *op),
@@ -160,7 +160,7 @@ private:
                                 SmallVectorImpl<Value *> &results),
       void (&getCanonicalizationPatterns)(OwningRewritePatternList &results,
                                           MLIRContext *context))
-      : name(name), dialect(dialect), isClassFor(isClassFor),
+      : name(name), dialect(dialect), classof(classof),
         parseAssembly(parseAssembly), printAssembly(printAssembly),
         verifyInvariants(verifyInvariants), constantFoldHook(constantFoldHook),
         foldHook(foldHook),
index 838cd03..a373c23 100644 (file)
@@ -309,7 +309,7 @@ public:
 
   APFloat getValue() { return getAttrOfType<FloatAttr>("value").getValue(); }
 
-  static bool isClassFor(Operation *op);
+  static bool classof(Operation *op);
 };
 
 /// This is a refinement of the "constant" op for the case where it is
@@ -332,7 +332,7 @@ public:
 
   int64_t getValue() { return getAttrOfType<IntegerAttr>("value").getInt(); }
 
-  static bool isClassFor(Operation *op);
+  static bool classof(Operation *op);
 };
 
 /// This is a refinement of the "constant" op for the case where it is
@@ -350,7 +350,7 @@ public:
 
   int64_t getValue() { return getAttrOfType<IntegerAttr>("value").getInt(); }
 
-  static bool isClassFor(Operation *op);
+  static bool classof(Operation *op);
 };
 
 // DmaStartOp starts a non-blocking DMA operation that transfers data from a
index 9a3d9c8..05e3b13 100644 (file)
@@ -1171,14 +1171,14 @@ void ConstantFloatOp::build(Builder *builder, OperationState *result,
   ConstantOp::build(builder, result, type, builder->getFloatAttr(type, value));
 }
 
-bool ConstantFloatOp::isClassFor(Operation *op) {
-  return ConstantOp::isClassFor(op) &&
+bool ConstantFloatOp::classof(Operation *op) {
+  return ConstantOp::classof(op) &&
          op->getResult(0)->getType().isa<FloatType>();
 }
 
 /// ConstantIntOp only matches values whose result type is an IntegerType.
-bool ConstantIntOp::isClassFor(Operation *op) {
-  return ConstantOp::isClassFor(op) &&
+bool ConstantIntOp::classof(Operation *op) {
+  return ConstantOp::classof(op) &&
          op->getResult(0)->getType().isa<IntegerType>();
 }
 
@@ -1199,8 +1199,8 @@ void ConstantIntOp::build(Builder *builder, OperationState *result,
 }
 
 /// ConstantIndexOp only matches values whose result type is Index.
-bool ConstantIndexOp::isClassFor(Operation *op) {
-  return ConstantOp::isClassFor(op) && op->getResult(0)->getType().isIndex();
+bool ConstantIndexOp::classof(Operation *op) {
+  return ConstantOp::classof(op) && op->getResult(0)->getType().isIndex();
 }
 
 void ConstantIndexOp::build(Builder *builder, OperationState *result,