31 Off = *Other.Offset - *Offset;
33 if ((Other.Index == Index) && (Other.IsIndexSignExt == IsIndexSignExt)) {
35 if (Other.Base ==
Base)
39 if (
auto *A = dyn_cast<GlobalAddressSDNode>(
Base))
40 if (
auto *
B = dyn_cast<GlobalAddressSDNode>(Other.Base))
41 if (A->getGlobal() ==
B->getGlobal()) {
42 Off +=
B->getOffset() - A->getOffset();
47 if (
auto *A = dyn_cast<ConstantPoolSDNode>(
Base))
48 if (
auto *
B = dyn_cast<ConstantPoolSDNode>(Other.Base)) {
50 A->isMachineConstantPoolEntry() ==
B->isMachineConstantPoolEntry();
52 if (A->isMachineConstantPoolEntry())
53 IsMatch = A->getMachineCPVal() ==
B->getMachineCPVal();
55 IsMatch = A->getConstVal() ==
B->getConstVal();
58 Off +=
B->getOffset() - A->getOffset();
66 if (
auto *A = dyn_cast<FrameIndexSDNode>(
Base))
67 if (
auto *
B = dyn_cast<FrameIndexSDNode>(Other.Base)) {
69 if (A->getIndex() ==
B->getIndex())
105 (*NumBytes0 <= PtrDiff) ||
109 (PtrDiff + *NumBytes1 <= 0));
116 if (
auto *A = dyn_cast<FrameIndexSDNode>(BasePtr0.
getBase()))
117 if (
auto *
B = dyn_cast<FrameIndexSDNode>(BasePtr1.
getBase())) {
128 bool IsFI0 = isa<FrameIndexSDNode>(BasePtr0.
getBase());
129 bool IsFI1 = isa<FrameIndexSDNode>(BasePtr1.
getBase());
130 bool IsGV0 = isa<GlobalAddressSDNode>(BasePtr0.
getBase());
131 bool IsGV1 = isa<GlobalAddressSDNode>(BasePtr1.
getBase());
132 bool IsCV0 = isa<ConstantPoolSDNode>(BasePtr0.
getBase());
133 bool IsCV1 = isa<ConstantPoolSDNode>(BasePtr1.
getBase());
138 (IsGV0 != IsGV1) || (IsCV0 != IsCV1)) &&
139 (IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) {
148 int64_t OtherBitSize, int64_t &BitOffset)
const {
157 BitOffset = 8 * Offset;
158 return BitOffset + OtherBitSize <= BitSize;
175 bool IsIndexSignExt =
false;
179 if (
auto *
C = dyn_cast<ConstantSDNode>(N->
getOffset()))
180 Offset +=
C->getSExtValue();
184 if (
auto *
C = dyn_cast<ConstantSDNode>(N->
getOffset()))
185 Offset -=
C->getSExtValue();
195 if (
auto *
C = dyn_cast<ConstantSDNode>(Base->
getOperand(1)))
197 Offset +=
C->getSExtValue();
203 if (
auto *
C = dyn_cast<ConstantSDNode>(Base->
getOperand(1))) {
204 Offset +=
C->getSExtValue();
211 auto *LSBase = cast<LSBaseSDNode>(Base.
getNode());
213 if (LSBase->isIndexed() && Base.
getResNo() == IndexResNo)
214 if (
auto *
C = dyn_cast<ConstantSDNode>(LSBase->getOffset())) {
215 auto Off =
C->getSExtValue();
250 IsIndexSignExt =
true;
258 Offset += cast<ConstantSDNode>(Index->
getOperand(1))->getSExtValue();
262 IsIndexSignExt =
true;
264 IsIndexSignExt =
false;
265 Base = PotentialBase;
272 if (
const auto *LS0 = dyn_cast<LSBaseSDNode>(N))
274 if (
const auto *LN = dyn_cast<LifetimeSDNode>(N)) {
283 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 290 OS <<
"BaseIndexOffset base=[";
295 OS <<
"] offset=" << Offset;
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents lattice values for constants.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
SDNode * getNode() const
get the SDNode which holds the desired result
Base class for LoadSDNode and StoreSDNode.
bool equalBaseIndex(const BaseIndexOffset &Other, const SelectionDAG &DAG, int64_t &Off) const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
MachineFunction & getMachineFunction() const
Simple integer binary arithmetic operators.
BaseIndexOffset()=default
bool contains(const SelectionDAG &DAG, int64_t BitSize, const BaseIndexOffset &Other, int64_t OtherBitSize, int64_t &BitOffset) const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const SDValue & getOperand(unsigned Num) const
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
virtual SDValue unwrapAddress(SDValue N) const
static BaseIndexOffset matchLSNode(const LSBaseSDNode *N, const SelectionDAG &DAG)
Parses tree in Ptr for base, index, offset addresses.
static bool computeAliasing(const SDNode *Op0, const Optional< int64_t > NumBytes0, const SDNode *Op1, const Optional< int64_t > NumBytes1, const SelectionDAG &DAG, bool &IsAlias)
const TargetLowering & getTargetLoweringInfo() const
Helper struct to parse and store a memory address as base + index + offset.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const SDValue & getOffset() const
void print(raw_ostream &OS) const
Represents one node in the SelectionDAG.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool hasValidOffset() const
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
static BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG)
Parses tree in N for base, index, offset addresses.
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
void print(raw_ostream &OS, const SelectionDAG *G=nullptr) const
unsigned getResNo() const
get the index which selects a specific result in the SDNode
This class implements an extremely fast bulk output stream that can only output to a stream...
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
const SDValue & getBasePtr() const
This file describes how to lower LLVM code to machine code.