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/LLVM.h" 13 #include <cstdint> 14 15 namespace mlir { 16 class DialectRegistry; 17 class Value; 18 19 namespace affine { 20 void registerValueBoundsOpInterfaceExternalModels(DialectRegistry ®istry); 21 22 /// Compute a constant delta of the given two values. Return "failure" if we 23 /// cannot determine a constant delta. `value1`/`value2` must be index-typed. 24 /// 25 /// This function is similar to 26 /// `ValueBoundsConstraintSet::computeConstantDistance`. To work around 27 /// limitations in `FlatLinearConstraints`, this function fully composes 28 /// `value1` and `value2` (if they are the result of affine.apply ops) before 29 /// populating the constraint set. The folding/composing logic can see 30 /// opportunities for simplifications that the constraint set implementation 31 /// cannot see. 32 FailureOr<int64_t> fullyComposeAndComputeConstantDelta(Value value1, 33 Value value2); 34 } // namespace affine 35 } // namespace mlir 36 37 #endif // MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H 38