14 #ifndef MLIR_DIALECT_AFFINE_TRANSFORMS_TRANSFORMS_H
15 #define MLIR_DIALECT_AFFINE_TRANSFORMS_TRANSFORMS_H
25 class RewritePatternSet;
29 namespace presburger {
35 class AffineDelinearizeIndexOp;
36 class AffineLinearizeIndexOp;
41 AffineDelinearizeIndexOp op);
48 AffineLinearizeIndexOp op);
71 FailureOr<AffineApplyOp>
decompose(RewriterBase &rewriter, AffineApplyOp op);
78 FailureOr<OpFoldResult>
80 const ValueBoundsConstraintSet::Variable &var,
82 bool closedUB =
false);
104 bool closedUB =
false);
116 bool closedUB =
false);
127 OpBuilder &b, Location loc, AffineMap boundMap,
128 ArrayRef<std::pair<Value, std::optional<int64_t>>> mapOperands);
std::function< bool(Value, std::optional< int64_t >, ValueBoundsConstraintSet &cstr)> StopConditionFn
The stop condition when traversing the backward slice of a shaped value/ index-type value.
FailureOr< OpFoldResult > reifyValueBound(OpBuilder &b, Location loc, presburger::BoundType type, const ValueBoundsConstraintSet::Variable &var, ValueBoundsConstraintSet::StopConditionFn stopCondition, bool closedUB=false)
Reify a bound for the given variable in terms of SSA values for which stopCondition is met.
LogicalResult lowerAffineDelinearizeIndexOp(RewriterBase &rewriter, AffineDelinearizeIndexOp op)
Lowers affine.delinearize_index into a sequence of division and remainder operations.
FailureOr< OpFoldResult > reifyIndexValueBound(OpBuilder &b, Location loc, presburger::BoundType type, Value value, ValueBoundsConstraintSet::StopConditionFn stopCondition=nullptr, bool closedUB=false)
Reify a bound for the given index-typed value in terms of SSA values for which stopCondition is met.
FailureOr< AffineApplyOp > decompose(RewriterBase &rewriter, AffineApplyOp op)
Split an "affine.apply" operation into smaller ops.
LogicalResult lowerAffineLinearizeIndexOp(RewriterBase &rewriter, AffineLinearizeIndexOp op)
Lowers affine.linearize_index into a sequence of multiplications and additions.
void populateAffineExpandIndexOpsPatterns(RewritePatternSet &patterns)
Populate patterns that expand affine index operations into more fundamental operations (not necessari...
OpFoldResult materializeComputedBound(OpBuilder &b, Location loc, AffineMap boundMap, ArrayRef< std::pair< Value, std::optional< int64_t >>> mapOperands)
Materialize an already computed bound with Affine dialect ops.
FailureOr< OpFoldResult > reifyShapedValueDimBound(OpBuilder &b, Location loc, presburger::BoundType type, Value value, int64_t dim, ValueBoundsConstraintSet::StopConditionFn stopCondition=nullptr, bool closedUB=false)
Reify a bound for the specified dimension of the given shaped value in terms of SSA values for which ...
void reorderOperandsByHoistability(RewriterBase &rewriter, AffineApplyOp op)
Helper function to rewrite op's affine map and reorder its operands such that they are in increasing ...
void populateAffineExpandIndexOpsAsAffinePatterns(RewritePatternSet &patterns)
Populate patterns that expand affine index operations into their equivalent affine....
BoundType
The type of bound: equal, lower bound or upper bound.
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns