| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CODEGEN_SELECTIONDAGADDRESSANALYSIS_H |
| 10 |
#define LLVM_CODEGEN_SELECTIONDAGADDRESSANALYSIS_H |
| 11 |
|
| 12 |
#include "llvm/CodeGen/SelectionDAGNodes.h" |
| 13 |
#include <cstdint> |
| 14 |
|
| 15 |
namespace llvm { |
| 16 |
|
| 17 |
class SelectionDAG; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
class BaseIndexOffset { |
| 33 |
private: |
| 34 |
SDValue Base; |
| 35 |
SDValue Index; |
| 36 |
Optional<int64_t> Offset; |
| 37 |
bool IsIndexSignExt = false; |
| 38 |
|
| 39 |
public: |
| 40 |
BaseIndexOffset() = default; |
| 41 |
BaseIndexOffset(SDValue Base, SDValue Index, bool IsIndexSignExt) |
| 42 |
: Base(Base), Index(Index), IsIndexSignExt(IsIndexSignExt) {} |
| 43 |
BaseIndexOffset(SDValue Base, SDValue Index, int64_t Offset, |
| 44 |
bool IsIndexSignExt) |
| 45 |
: Base(Base), Index(Index), Offset(Offset), |
| 46 |
IsIndexSignExt(IsIndexSignExt) {} |
| 47 |
|
| 48 |
SDValue getBase() { return Base; } |
| 49 |
SDValue getBase() const { return Base; } |
| 50 |
SDValue getIndex() { return Index; } |
| 51 |
SDValue getIndex() const { return Index; } |
| 52 |
bool hasValidOffset() const { return Offset.hasValue(); } |
| 53 |
int64_t getOffset() const { return *Offset; } |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
bool equalBaseIndex(const BaseIndexOffset &Other, const SelectionDAG &DAG, |
| 59 |
int64_t &Off) const; |
| 60 |
|
| 61 |
bool equalBaseIndex(const BaseIndexOffset &Other, |
| 62 |
const SelectionDAG &DAG) const { |
| 63 |
int64_t Off; |
| 64 |
return equalBaseIndex(Other, DAG, Off); |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
bool contains(const SelectionDAG &DAG, int64_t BitSize, |
| 70 |
const BaseIndexOffset &Other, int64_t OtherBitSize, |
| 71 |
int64_t &BitOffset) const; |
| 72 |
|
| 73 |
bool contains(const SelectionDAG &DAG, int64_t BitSize, |
| 74 |
const BaseIndexOffset &Other, int64_t OtherBitSize) const { |
| 75 |
int64_t BitOffset; |
| 76 |
return contains(DAG, BitSize, Other, OtherBitSize, BitOffset); |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
static bool computeAliasing(const SDNode *Op0, |
| 82 |
const Optional<int64_t> NumBytes0, |
| 83 |
const SDNode *Op1, |
| 84 |
const Optional<int64_t> NumBytes1, |
| 85 |
const SelectionDAG &DAG, bool &IsAlias); |
| 86 |
|
| 87 |
|
| 88 |
static BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG); |
| 89 |
|
| 90 |
void print(raw_ostream& OS) const; |
| 91 |
void dump() const; |
| 92 |
}; |
| 93 |
|
| 94 |
} |
| 95 |
|
| 96 |
#endif |