|
17 | 17 | include "mlir/Dialect/Arith/IR/ArithBase.td" |
18 | 18 | include "mlir/Dialect/Arith/IR/ArithOpsInterfaces.td" |
19 | 19 | include "mlir/Dialect/LLVMIR/LLVMAttrDefs.td" |
| 20 | +include "mlir/Interfaces/ViewLikeInterface.td" |
20 | 21 | include "flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.td" |
21 | 22 | include "flang/Optimizer/Dialect/FIRDialect.td" |
22 | 23 | include "flang/Optimizer/Dialect/FIRTypes.td" |
@@ -1730,8 +1731,9 @@ def fir_ArrayMergeStoreOp : fir_Op<"array_merge_store", |
1730 | 1731 | // Record and array type operations |
1731 | 1732 | //===----------------------------------------------------------------------===// |
1732 | 1733 |
|
1733 | | -def fir_ArrayCoorOp : fir_Op<"array_coor", |
1734 | | - [NoMemoryEffect, AttrSizedOperandSegments]> { |
| 1734 | +def fir_ArrayCoorOp |
| 1735 | + : fir_Op<"array_coor", [NoMemoryEffect, AttrSizedOperandSegments, |
| 1736 | + ViewLikeOpInterface]> { |
1735 | 1737 |
|
1736 | 1738 | let summary = "Find the coordinate of an element of an array"; |
1737 | 1739 |
|
@@ -1774,9 +1776,13 @@ def fir_ArrayCoorOp : fir_Op<"array_coor", |
1774 | 1776 |
|
1775 | 1777 | let hasVerifier = 1; |
1776 | 1778 | let hasCanonicalizer = 1; |
| 1779 | + let extraClassDeclaration = [{ |
| 1780 | + mlir::Value getViewSource() { return getMemref(); } |
| 1781 | + }]; |
1777 | 1782 | } |
1778 | 1783 |
|
1779 | | -def fir_CoordinateOp : fir_Op<"coordinate_of", [NoMemoryEffect]> { |
| 1784 | +def fir_CoordinateOp |
| 1785 | + : fir_Op<"coordinate_of", [NoMemoryEffect, ViewLikeOpInterface]> { |
1780 | 1786 |
|
1781 | 1787 | let summary = "Finds the coordinate (location) of a value in memory"; |
1782 | 1788 |
|
@@ -1828,6 +1834,7 @@ def fir_CoordinateOp : fir_Op<"coordinate_of", [NoMemoryEffect]> { |
1828 | 1834 | let extraClassDeclaration = [{ |
1829 | 1835 | constexpr static int32_t kDynamicIndex = std::numeric_limits<int32_t>::min(); |
1830 | 1836 | CoordinateIndicesAdaptor getIndices(); |
| 1837 | + mlir::Value getViewSource() { return getRef(); } |
1831 | 1838 | }]; |
1832 | 1839 | } |
1833 | 1840 |
|
@@ -2792,7 +2799,8 @@ def fir_VolatileCastOp : fir_SimpleOneResultOp<"volatile_cast", [Pure]> { |
2792 | 2799 | let hasFolder = 1; |
2793 | 2800 | } |
2794 | 2801 |
|
2795 | | -def fir_ConvertOp : fir_SimpleOneResultOp<"convert", [NoMemoryEffect]> { |
| 2802 | +def fir_ConvertOp |
| 2803 | + : fir_SimpleOneResultOp<"convert", [NoMemoryEffect, ViewLikeOpInterface]> { |
2796 | 2804 | let summary = "encapsulates all Fortran entity type conversions"; |
2797 | 2805 |
|
2798 | 2806 | let description = [{ |
@@ -2830,6 +2838,8 @@ def fir_ConvertOp : fir_SimpleOneResultOp<"convert", [NoMemoryEffect]> { |
2830 | 2838 | static bool isPointerCompatible(mlir::Type ty); |
2831 | 2839 | static bool canBeConverted(mlir::Type inType, mlir::Type outType); |
2832 | 2840 | static bool areVectorsCompatible(mlir::Type inTy, mlir::Type outTy); |
| 2841 | + mlir::Value getViewSource() { return getValue(); } |
| 2842 | + bool isSameStart() { return true; } |
2833 | 2843 | }]; |
2834 | 2844 | let hasCanonicalizer = 1; |
2835 | 2845 | } |
|
0 commit comments