File indexing completed on 2026-05-10 08:43:35
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CODEGEN_SELECTIONDAGADDRESSANALYSIS_H
0010 #define LLVM_CODEGEN_SELECTIONDAGADDRESSANALYSIS_H
0011
0012 #include "llvm/Analysis/MemoryLocation.h"
0013 #include "llvm/CodeGen/SelectionDAGNodes.h"
0014 #include <cstdint>
0015
0016 namespace llvm {
0017
0018 class SelectionDAG;
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 class BaseIndexOffset {
0034 private:
0035 SDValue Base;
0036 SDValue Index;
0037 std::optional<int64_t> Offset;
0038 bool IsIndexSignExt = false;
0039
0040 public:
0041 BaseIndexOffset() = default;
0042 BaseIndexOffset(SDValue Base, SDValue Index, bool IsIndexSignExt)
0043 : Base(Base), Index(Index), IsIndexSignExt(IsIndexSignExt) {}
0044 BaseIndexOffset(SDValue Base, SDValue Index, int64_t Offset,
0045 bool IsIndexSignExt)
0046 : Base(Base), Index(Index), Offset(Offset),
0047 IsIndexSignExt(IsIndexSignExt) {}
0048
0049 SDValue getBase() { return Base; }
0050 SDValue getBase() const { return Base; }
0051 SDValue getIndex() { return Index; }
0052 SDValue getIndex() const { return Index; }
0053 void addToOffset(int64_t VectorOff) {
0054 Offset = Offset.value_or(0) + VectorOff;
0055 }
0056 bool hasValidOffset() const { return Offset.has_value(); }
0057 int64_t getOffset() const { return *Offset; }
0058
0059
0060
0061
0062 bool equalBaseIndex(const BaseIndexOffset &Other, const SelectionDAG &DAG,
0063 int64_t &Off) const;
0064
0065 bool equalBaseIndex(const BaseIndexOffset &Other,
0066 const SelectionDAG &DAG) const {
0067 int64_t Off;
0068 return equalBaseIndex(Other, DAG, Off);
0069 }
0070
0071
0072
0073 bool contains(const SelectionDAG &DAG, int64_t BitSize,
0074 const BaseIndexOffset &Other, int64_t OtherBitSize,
0075 int64_t &BitOffset) const;
0076
0077 bool contains(const SelectionDAG &DAG, int64_t BitSize,
0078 const BaseIndexOffset &Other, int64_t OtherBitSize) const {
0079 int64_t BitOffset;
0080 return contains(DAG, BitSize, Other, OtherBitSize, BitOffset);
0081 }
0082
0083
0084
0085 static bool computeAliasing(const SDNode *Op0, const LocationSize NumBytes0,
0086 const SDNode *Op1, const LocationSize NumBytes1,
0087 const SelectionDAG &DAG, bool &IsAlias);
0088
0089
0090 static BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG);
0091
0092 void print(raw_ostream& OS) const;
0093 void dump() const;
0094 };
0095
0096 }
0097
0098 #endif