diff options
Diffstat (limited to 'llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h')
-rw-r--r-- | llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h index deff6dd720e..4ee58333495 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h @@ -33,11 +33,13 @@ class BaseIndexOffset { private: SDValue Base; SDValue Index; - int64_t Offset = 0; + Optional<int64_t> Offset; bool IsIndexSignExt = false; public: BaseIndexOffset() = default; + BaseIndexOffset(SDValue Base, SDValue Index, bool IsIndexSignExt) + : Base(Base), Index(Index), Offset(), IsIndexSignExt(IsIndexSignExt) {} BaseIndexOffset(SDValue Base, SDValue Index, int64_t Offset, bool IsIndexSignExt) : Base(Base), Index(Index), Offset(Offset), @@ -47,6 +49,7 @@ public: SDValue getBase() const { return Base; } SDValue getIndex() { return Index; } SDValue getIndex() const { return Index; } + bool hasValidOffset() const { return Offset.hasValue(); } // Returns true if `Other` and `*this` are both some offset from the same base // pointer. In that case, `Off` is set to the offset between `*this` and @@ -72,16 +75,16 @@ public: return contains(DAG, BitSize, Other, OtherBitSize, BitOffset); } - // Returns true `BasePtr0` and `BasePtr1` can be proven to alias/not alias, in + // Returns true `Op0` and `Op1` can be proven to alias/not alias, in // which case `IsAlias` is set to true/false. - static bool computeAliasing(const BaseIndexOffset &BasePtr0, - const int64_t NumBytes0, - const BaseIndexOffset &BasePtr1, - const int64_t NumBytes1, const SelectionDAG &DAG, - bool &IsAlias); - - /// Parses tree in Ptr for base, index, offset addresses. - static BaseIndexOffset match(const LSBaseSDNode *N, const SelectionDAG &DAG); + static bool computeAliasing(const SDNode *Op0, + const Optional<int64_t> NumBytes0, + const SDNode *Op1, + const Optional<int64_t> NumBytes1, + const SelectionDAG &DAG, bool &IsAlias); + + /// Parses tree in N for base, index, offset addresses. + static BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG); void print(raw_ostream& OS) const; void dump() const; |