28 if (!
Base.getNode() || !
Other.Base.getNode())
33 Off = *
Other.Offset - *Offset;
35 if ((
Other.Index == Index) && (
Other.IsIndexSignExt == IsIndexSignExt)) {
41 if (
auto *
A = dyn_cast<GlobalAddressSDNode>(
Base)) {
42 if (
auto *
B = dyn_cast<GlobalAddressSDNode>(
Other.Base))
43 if (
A->getGlobal() ==
B->getGlobal()) {
44 Off +=
B->getOffset() -
A->getOffset();
52 if (
auto *
A = dyn_cast<ConstantPoolSDNode>(
Base)) {
53 if (
auto *
B = dyn_cast<ConstantPoolSDNode>(
Other.Base)) {
55 A->isMachineConstantPoolEntry() ==
B->isMachineConstantPoolEntry();
57 if (
A->isMachineConstantPoolEntry())
58 IsMatch =
A->getMachineCPVal() ==
B->getMachineCPVal();
60 IsMatch =
A->getConstVal() ==
B->getConstVal();
63 Off +=
B->getOffset() -
A->getOffset();
72 if (
auto *
A = dyn_cast<FrameIndexSDNode>(
Base))
73 if (
auto *
B = dyn_cast<FrameIndexSDNode>(
Other.Base)) {
75 if (
A->getIndex() ==
B->getIndex())
99 if (!BasePtr0.
getBase().getNode())
103 if (!BasePtr1.
getBase().getNode())
107 if (BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) {
123 IsAlias = !((PtrDiff +
static_cast<int64_t
>(
133 if (
auto *
A = dyn_cast<FrameIndexSDNode>(BasePtr0.
getBase()))
134 if (
auto *
B = dyn_cast<FrameIndexSDNode>(BasePtr1.
getBase())) {
145 bool IsFI0 = isa<FrameIndexSDNode>(BasePtr0.
getBase());
146 bool IsFI1 = isa<FrameIndexSDNode>(BasePtr1.
getBase());
147 bool IsGV0 = isa<GlobalAddressSDNode>(BasePtr0.
getBase());
148 bool IsGV1 = isa<GlobalAddressSDNode>(BasePtr1.
getBase());
149 bool IsCV0 = isa<ConstantPoolSDNode>(BasePtr0.
getBase());
150 bool IsCV1 = isa<ConstantPoolSDNode>(BasePtr1.
getBase());
152 if ((IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) {
154 if (IsFI0 != IsFI1 || IsGV0 != IsGV1 || IsCV0 != IsCV1) {
158 if (IsGV0 && IsGV1) {
159 auto *GV0 = cast<GlobalAddressSDNode>(BasePtr0.
getBase())->getGlobal();
160 auto *GV1 = cast<GlobalAddressSDNode>(BasePtr1.
getBase())->getGlobal();
168 if (GV0 != GV1 && !isa<GlobalAlias>(GV0) && !isa<GlobalAlias>(GV1)) {
179 int64_t OtherBitSize, int64_t &BitOffset)
const {
181 if (!equalBaseIndex(
Other, DAG, Offset))
188 BitOffset = 8 * Offset;
189 return BitOffset + OtherBitSize <= BitSize;
206 bool IsIndexSignExt =
false;
210 if (
auto *
C = dyn_cast<ConstantSDNode>(
N->getOffset()))
215 if (
auto *
C = dyn_cast<ConstantSDNode>(
N->getOffset()))
223 switch (
Base->getOpcode()) {
226 if (
auto *
C = dyn_cast<ConstantSDNode>(
Base->getOperand(1)))
234 if (
auto *
C = dyn_cast<ConstantSDNode>(
Base->getOperand(1))) {
242 auto *LSBase = cast<LSBaseSDNode>(
Base.getNode());
243 unsigned int IndexResNo = (
Base->getOpcode() ==
ISD::LOAD) ? 1 : 0;
244 if (LSBase->isIndexed() &&
Base.getResNo() == IndexResNo)
245 if (
auto *
C = dyn_cast<ConstantSDNode>(LSBase->getOffset())) {
246 auto Off =
C->getSExtValue();
275 Index =
Base->getOperand(1);
280 Index = Index->getOperand(0);
281 IsIndexSignExt =
true;
285 if (Index->getOpcode() !=
ISD::ADD ||
286 !isa<ConstantSDNode>(Index->getOperand(1)))
289 Offset += cast<ConstantSDNode>(Index->getOperand(1))->getSExtValue();
290 Index = Index->getOperand(0);
292 Index = Index->getOperand(0);
293 IsIndexSignExt =
true;
295 IsIndexSignExt =
false;
296 Base = PotentialBase;
303 if (
const auto *LS0 = dyn_cast<LSBaseSDNode>(
N))
305 if (
const auto *LN = dyn_cast<LifetimeSDNode>(
N)) {
314#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
321 OS <<
"BaseIndexOffset base=[";
326 OS <<
"] offset=" << Offset;
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
std::optional< std::vector< StOtherPiece > > Other
This file provides utility analysis objects describing memory locations.
static BaseIndexOffset matchLSNode(const LSBaseSDNode *N, const SelectionDAG &DAG)
Parses tree in Ptr for base, index, offset addresses.
This file describes how to lower LLVM code to machine code.
bool contains(const SelectionDAG &DAG, int64_t BitSize, const BaseIndexOffset &Other, int64_t OtherBitSize, int64_t &BitOffset) const
void print(raw_ostream &OS) const
static BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG)
Parses tree in N for base, index, offset addresses.
static bool computeAliasing(const SDNode *Op0, const LocationSize NumBytes0, const SDNode *Op1, const LocationSize NumBytes1, const SelectionDAG &DAG, bool &IsAlias)
bool equalBaseIndex(const BaseIndexOffset &Other, const SelectionDAG &DAG, int64_t &Off) const
Helper struct to store a base, index and offset that forms an address.
BaseIndexOffset()=default
bool hasValidOffset() const
Base class for LoadSDNode and StoreSDNode.
TypeSize getValue() const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const TargetLowering & getTargetLoweringInfo() const
MachineFunction & getMachineFunction() const
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
virtual SDValue unwrapAddress(SDValue N) const
constexpr ScalarTy getFixedValue() const
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
@ ADD
Simple integer binary arithmetic operators.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ SIGN_EXTEND
Conversion operators.
bool match(Val *V, const Pattern &P)
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.