[mlir] NFC - move declaration of `Range` to StaticValueUtils.h
authorChristopher Bate <cbate@nvidia.com>
Thu, 8 Sep 2022 20:33:57 +0000 (14:33 -0600)
committerChristopher Bate <cbate@nvidia.com>
Thu, 8 Sep 2022 22:29:56 +0000 (16:29 -0600)
`ViewLikeInterface.h` defines a struct `Range`, and it also depends on
`StaticValueUtils.h/cpp`. This change moves the definition of `Range` to
`StaticValueUtils.h`, which should not violate any existing dependency
requirement. This is done to support adding utilities using `Range`
under `Dialect/Utils` without creating a circular dependency on
`ViewLikeInterface`. It is possible that some targets depend on
`ViewLikeInterface` just for the `Range` struct. These can be later
updated to depend on the `MLIRDialectUtils` target.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133523

mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
mlir/include/mlir/Interfaces/ViewLikeInterface.h

index bde7f47..096ee94 100644 (file)
 
 namespace mlir {
 
+/// Represents a range (offset, size, and stride) where each element of the
+/// triple may be dynamic or static.
+struct Range {
+  OpFoldResult offset;
+  OpFoldResult size;
+  OpFoldResult stride;
+};
+
 /// Helper function to dispatch an OpFoldResult into `staticVec` if:
 ///   a) it is an IntegerAttr
 /// In other cases, the OpFoldResult is dispached to the `dynamicVec`.
index 4bb13ce..05b34a7 100644 (file)
 
 namespace mlir {
 
-/// Auxiliary range data structure to unpack the offset, size and stride
-/// operands into a list of triples. Such a list can be more convenient to
-/// manipulate.
-struct Range {
-  OpFoldResult offset;
-  OpFoldResult size;
-  OpFoldResult stride;
-};
-
 /// Return a vector of OpFoldResults given the special value
 /// that indicates whether of the value is dynamic or not.
 SmallVector<OpFoldResult, 4> getMixedValues(ArrayAttr staticValues,