1 | //===- ValueBoundsOpInterfaceImpl.h - Impl. of ValueBoundsOpInterface -----===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H |
10 | #define MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H |
11 | |
12 | #include "mlir/Support/LogicalResult.h" |
13 | |
14 | namespace mlir { |
15 | class DialectRegistry; |
16 | class Value; |
17 | |
18 | namespace affine { |
19 | void registerValueBoundsOpInterfaceExternalModels(DialectRegistry ®istry); |
20 | |
21 | /// Compute a constant delta of the given two values. Return "failure" if we |
22 | /// cannot determine a constant delta. `value1`/`value2` must be index-typed. |
23 | /// |
24 | /// This function is similar to |
25 | /// `ValueBoundsConstraintSet::computeConstantDistance`. To work around |
26 | /// limitations in `FlatLinearConstraints`, this function fully composes |
27 | /// `value1` and `value2` (if they are the result of affine.apply ops) before |
28 | /// populating the constraint set. The folding/composing logic can see |
29 | /// opportunities for simplifications that the constraint set implementation |
30 | /// cannot see. |
31 | FailureOr<int64_t> fullyComposeAndComputeConstantDelta(Value value1, |
32 | Value value2); |
33 | } // namespace affine |
34 | } // namespace mlir |
35 | |
36 | #endif // MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H |
37 | |