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);
/// 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),
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),
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
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
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
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>();
}
}
/// 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,