20 struct AddIOpInterface
21 :
public ValueBoundsOpInterface::ExternalModel<AddIOpInterface, AddIOp> {
24 auto addIOp = cast<AddIOp>(op);
25 assert(value == addIOp.getResult() &&
"invalid value");
32 struct ConstantOpInterface
33 :
public ValueBoundsOpInterface::ExternalModel<ConstantOpInterface,
37 auto constantOp = cast<ConstantOp>(op);
38 assert(value == constantOp.getResult() &&
"invalid value");
40 if (
auto attr = llvm::dyn_cast<IntegerAttr>(constantOp.getValue()))
41 cstr.
bound(value) == attr.getInt();
45 struct SubIOpInterface
46 :
public ValueBoundsOpInterface::ExternalModel<SubIOpInterface, SubIOp> {
49 auto subIOp = cast<SubIOp>(op);
50 assert(value == subIOp.getResult() &&
"invalid value");
57 struct MulIOpInterface
58 :
public ValueBoundsOpInterface::ExternalModel<MulIOpInterface, MulIOp> {
61 auto mulIOp = cast<MulIOp>(op);
62 assert(value == mulIOp.getResult() &&
"invalid value");
76 arith::AddIOp::attachInterface<arith::AddIOpInterface>(*ctx);
77 arith::ConstantOp::attachInterface<arith::ConstantOpInterface>(*ctx);
78 arith::SubIOp::attachInterface<arith::SubIOpInterface>(*ctx);
79 arith::MulIOp::attachInterface<arith::MulIOpInterface>(*ctx);
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
void addExtension(std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
MLIRContext is the top-level object for a collection of MLIR operations.
Operation is the basic unit of execution within MLIR.
A helper class to be used with ValueBoundsOpInterface.
AffineExpr getExpr(Value value, std::optional< int64_t > dim=std::nullopt)
Return an expression that represents the given index-typed value or shaped value dimension.
BoundBuilder bound(Value value)
Add a bound for the given index-typed value or shaped value.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
void registerValueBoundsOpInterfaceExternalModels(DialectRegistry ®istry)
Include the generated interface declarations.