From: River Riddle Date: Sat, 11 May 2019 19:45:35 +0000 (-0700) Subject: Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard... X-Git-Tag: llvmorg-11-init~1466^2~1747 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=360f8a209e21b058cc20949fc8600817b0a1044c;p=platform%2Fupstream%2Fllvm.git Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard naming scheme. -- PiperOrigin-RevId: 247771192 --- diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h index c42050c..b80e8ac 100644 --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -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(); } diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h index 8c6064b..54e49b7 100644 --- a/mlir/include/mlir/IR/Operation.h +++ b/mlir/include/mlir/IR/Operation.h @@ -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 bool isa() { return OpClass::isClassFor(this); } + template bool isa() { return OpClass::classof(this); } //===--------------------------------------------------------------------===// // Operation Walkers diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h index 24f6b88..169012a 100644 --- a/mlir/include/mlir/IR/OperationSupport.h +++ b/mlir/include/mlir/IR/OperationSupport.h @@ -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 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 &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), diff --git a/mlir/include/mlir/StandardOps/Ops.h b/mlir/include/mlir/StandardOps/Ops.h index 838cd03..a373c23 100644 --- a/mlir/include/mlir/StandardOps/Ops.h +++ b/mlir/include/mlir/StandardOps/Ops.h @@ -309,7 +309,7 @@ public: APFloat getValue() { return getAttrOfType("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("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("value").getInt(); } - static bool isClassFor(Operation *op); + static bool classof(Operation *op); }; // DmaStartOp starts a non-blocking DMA operation that transfers data from a diff --git a/mlir/lib/StandardOps/Ops.cpp b/mlir/lib/StandardOps/Ops.cpp index 9a3d9c8..05e3b13 100644 --- a/mlir/lib/StandardOps/Ops.cpp +++ b/mlir/lib/StandardOps/Ops.cpp @@ -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(); } /// 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(); } @@ -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,