diff options
| author | River Riddle <riverriddle@google.com> | 2019-05-11 12:45:35 -0700 |
|---|---|---|
| committer | Mehdi Amini <joker.eph@gmail.com> | 2019-05-20 13:36:59 -0700 |
| commit | 360f8a209e21b058cc20949fc8600817b0a1044c (patch) | |
| tree | 9f625898fd50551a4c4eb214e24ea29e23ac043a | |
| parent | e686a11523326b7161419f7c4e5723cbdd70e235 (diff) | |
| download | bcm5719-llvm-360f8a209e21b058cc20949fc8600817b0a1044c.tar.gz bcm5719-llvm-360f8a209e21b058cc20949fc8600817b0a1044c.zip | |
Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard naming scheme.
--
PiperOrigin-RevId: 247771192
| -rw-r--r-- | mlir/include/mlir/IR/OpDefinition.h | 2 | ||||
| -rw-r--r-- | mlir/include/mlir/IR/Operation.h | 2 | ||||
| -rw-r--r-- | mlir/include/mlir/IR/OperationSupport.h | 10 | ||||
| -rw-r--r-- | mlir/include/mlir/StandardOps/Ops.h | 6 | ||||
| -rw-r--r-- | mlir/lib/StandardOps/Ops.cpp | 12 |
5 files changed, 16 insertions, 16 deletions
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h index c42050c7774..b80e8aca9bc 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 8c6064b2fab..54e49b73e3b 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 <typename OpClass> bool isa() { return OpClass::isClassFor(this); } + template <typename OpClass> 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 24f6b885698..169012a51f7 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 <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), diff --git a/mlir/include/mlir/StandardOps/Ops.h b/mlir/include/mlir/StandardOps/Ops.h index 838cd03cf7c..a373c23457b 100644 --- a/mlir/include/mlir/StandardOps/Ops.h +++ b/mlir/include/mlir/StandardOps/Ops.h @@ -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 diff --git a/mlir/lib/StandardOps/Ops.cpp b/mlir/lib/StandardOps/Ops.cpp index 9a3d9c8c10b..05e3b13eb4c 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<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, |

