1618c555bSEugene Zelenko //==- llvm/CodeGen/SelectionDAGAddressAnalysis.cpp - DAG Address Analysis --==//
2c1b6aa77SNirav Dave //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6c1b6aa77SNirav Dave //
7c1b6aa77SNirav Dave //===----------------------------------------------------------------------===//
8c1b6aa77SNirav Dave 
9c1b6aa77SNirav Dave #include "llvm/CodeGen/SelectionDAGAddressAnalysis.h"
108d06a678SHsiangkai Wang #include "llvm/Analysis/MemoryLocation.h"
11c1b6aa77SNirav Dave #include "llvm/CodeGen/ISDOpcodes.h"
12168c5a6aSNirav Dave #include "llvm/CodeGen/MachineFrameInfo.h"
13618c555bSEugene Zelenko #include "llvm/CodeGen/MachineFunction.h"
14c1b6aa77SNirav Dave #include "llvm/CodeGen/SelectionDAG.h"
15c1b6aa77SNirav Dave #include "llvm/CodeGen/SelectionDAGNodes.h"
16b3bde2eaSDavid Blaikie #include "llvm/CodeGen/TargetLowering.h"
171896fb2cSBjorn Pettersson #include "llvm/IR/GlobalAlias.h"
18618c555bSEugene Zelenko #include "llvm/Support/Casting.h"
19904cd3e0SReid Kleckner #include "llvm/Support/Debug.h"
20618c555bSEugene Zelenko #include <cstdint>
21c1b6aa77SNirav Dave 
22618c555bSEugene Zelenko using namespace llvm;
23c1b6aa77SNirav Dave 
equalBaseIndex(const BaseIndexOffset & Other,const SelectionDAG & DAG,int64_t & Off) const24eedd2ccdSNirav Dave bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other,
25eedd2ccdSNirav Dave                                      const SelectionDAG &DAG,
26eedd2ccdSNirav Dave                                      int64_t &Off) const {
276e2d03d4SNirav Dave   // Conservatively fail if we a match failed..
286e2d03d4SNirav Dave   if (!Base.getNode() || !Other.Base.getNode())
296e2d03d4SNirav Dave     return false;
30b5630a2aSNirav Dave   if (!hasValidOffset() || !Other.hasValidOffset())
31b5630a2aSNirav Dave     return false;
32168c5a6aSNirav Dave   // Initial Offset difference.
33b5630a2aSNirav Dave   Off = *Other.Offset - *Offset;
34168c5a6aSNirav Dave 
35168c5a6aSNirav Dave   if ((Other.Index == Index) && (Other.IsIndexSignExt == IsIndexSignExt)) {
36168c5a6aSNirav Dave     // Trivial match.
37168c5a6aSNirav Dave     if (Other.Base == Base)
38c1b6aa77SNirav Dave       return true;
39c1b6aa77SNirav Dave 
40c1b6aa77SNirav Dave     // Match GlobalAddresses
41168c5a6aSNirav Dave     if (auto *A = dyn_cast<GlobalAddressSDNode>(Base))
42168c5a6aSNirav Dave       if (auto *B = dyn_cast<GlobalAddressSDNode>(Other.Base))
43c1b6aa77SNirav Dave         if (A->getGlobal() == B->getGlobal()) {
44c1b6aa77SNirav Dave           Off += B->getOffset() - A->getOffset();
45c1b6aa77SNirav Dave           return true;
46c1b6aa77SNirav Dave         }
47c1b6aa77SNirav Dave 
48d8e3633dSNirav Dave     // Match Constants
49d8e3633dSNirav Dave     if (auto *A = dyn_cast<ConstantPoolSDNode>(Base))
50d8e3633dSNirav Dave       if (auto *B = dyn_cast<ConstantPoolSDNode>(Other.Base)) {
51d8e3633dSNirav Dave         bool IsMatch =
52d8e3633dSNirav Dave             A->isMachineConstantPoolEntry() == B->isMachineConstantPoolEntry();
53d8e3633dSNirav Dave         if (IsMatch) {
54d8e3633dSNirav Dave           if (A->isMachineConstantPoolEntry())
55d8e3633dSNirav Dave             IsMatch = A->getMachineCPVal() == B->getMachineCPVal();
56d8e3633dSNirav Dave           else
57d8e3633dSNirav Dave             IsMatch = A->getConstVal() == B->getConstVal();
58d8e3633dSNirav Dave         }
59d8e3633dSNirav Dave         if (IsMatch) {
60d8e3633dSNirav Dave           Off += B->getOffset() - A->getOffset();
61d8e3633dSNirav Dave           return true;
62d8e3633dSNirav Dave         }
63d8e3633dSNirav Dave       }
64d8e3633dSNirav Dave 
65168c5a6aSNirav Dave     const MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
66c1b6aa77SNirav Dave 
6717b51b65SClement Courbet     // Match FrameIndexes.
6817b51b65SClement Courbet     if (auto *A = dyn_cast<FrameIndexSDNode>(Base))
6917b51b65SClement Courbet       if (auto *B = dyn_cast<FrameIndexSDNode>(Other.Base)) {
7017b51b65SClement Courbet         // Equal FrameIndexes - offsets are directly comparable.
7117b51b65SClement Courbet         if (A->getIndex() == B->getIndex())
7217b51b65SClement Courbet           return true;
7317b51b65SClement Courbet         // Non-equal FrameIndexes - If both frame indices are fixed
74a2810e67SNirav Dave         // we know their relative offsets and can compare them. Otherwise
75a2810e67SNirav Dave         // we must be conservative.
76a2810e67SNirav Dave         if (MFI.isFixedObjectIndex(A->getIndex()) &&
77a2810e67SNirav Dave             MFI.isFixedObjectIndex(B->getIndex())) {
78168c5a6aSNirav Dave           Off += MFI.getObjectOffset(B->getIndex()) -
79168c5a6aSNirav Dave                  MFI.getObjectOffset(A->getIndex());
80168c5a6aSNirav Dave           return true;
81168c5a6aSNirav Dave         }
82168c5a6aSNirav Dave       }
8317b51b65SClement Courbet   }
84c1b6aa77SNirav Dave   return false;
85c1b6aa77SNirav Dave }
86c1b6aa77SNirav Dave 
computeAliasing(const SDNode * Op0,const Optional<int64_t> NumBytes0,const SDNode * Op1,const Optional<int64_t> NumBytes1,const SelectionDAG & DAG,bool & IsAlias)87b5630a2aSNirav Dave bool BaseIndexOffset::computeAliasing(const SDNode *Op0,
88b5630a2aSNirav Dave                                       const Optional<int64_t> NumBytes0,
89b5630a2aSNirav Dave                                       const SDNode *Op1,
90b5630a2aSNirav Dave                                       const Optional<int64_t> NumBytes1,
9162b3b91aSClement Courbet                                       const SelectionDAG &DAG, bool &IsAlias) {
92b5630a2aSNirav Dave 
93b5630a2aSNirav Dave   BaseIndexOffset BasePtr0 = match(Op0, DAG);
94b5630a2aSNirav Dave   BaseIndexOffset BasePtr1 = match(Op1, DAG);
95b5630a2aSNirav Dave 
9662b3b91aSClement Courbet   if (!(BasePtr0.getBase().getNode() && BasePtr1.getBase().getNode()))
9762b3b91aSClement Courbet     return false;
9862b3b91aSClement Courbet   int64_t PtrDiff;
99*e0e687a6SKazu Hirata   if (NumBytes0 && NumBytes1 &&
100b5630a2aSNirav Dave       BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) {
1018d06a678SHsiangkai Wang     // If the size of memory access is unknown, do not use it to analysis.
1028d06a678SHsiangkai Wang     // One example of unknown size memory access is to load/store scalable
1038d06a678SHsiangkai Wang     // vector objects on the stack.
10462b3b91aSClement Courbet     // BasePtr1 is PtrDiff away from BasePtr0. They alias if none of the
10562b3b91aSClement Courbet     // following situations arise:
1068d06a678SHsiangkai Wang     if (PtrDiff >= 0 &&
1078d06a678SHsiangkai Wang         *NumBytes0 != static_cast<int64_t>(MemoryLocation::UnknownSize)) {
10862b3b91aSClement Courbet       // [----BasePtr0----]
10962b3b91aSClement Courbet       //                         [---BasePtr1--]
11062b3b91aSClement Courbet       // ========PtrDiff========>
1118d06a678SHsiangkai Wang       IsAlias = !(*NumBytes0 <= PtrDiff);
1128d06a678SHsiangkai Wang       return true;
1138d06a678SHsiangkai Wang     }
1148d06a678SHsiangkai Wang     if (PtrDiff < 0 &&
1158d06a678SHsiangkai Wang         *NumBytes1 != static_cast<int64_t>(MemoryLocation::UnknownSize)) {
11662b3b91aSClement Courbet       //                     [----BasePtr0----]
11762b3b91aSClement Courbet       // [---BasePtr1--]
11862b3b91aSClement Courbet       // =====(-PtrDiff)====>
1198d06a678SHsiangkai Wang       IsAlias = !((PtrDiff + *NumBytes1) <= 0);
12062b3b91aSClement Courbet       return true;
12162b3b91aSClement Courbet     }
1228d06a678SHsiangkai Wang     return false;
1238d06a678SHsiangkai Wang   }
12462b3b91aSClement Courbet   // If both BasePtr0 and BasePtr1 are FrameIndexes, we will not be
12562b3b91aSClement Courbet   // able to calculate their relative offset if at least one arises
12662b3b91aSClement Courbet   // from an alloca. However, these allocas cannot overlap and we
12762b3b91aSClement Courbet   // can infer there is no alias.
12862b3b91aSClement Courbet   if (auto *A = dyn_cast<FrameIndexSDNode>(BasePtr0.getBase()))
12962b3b91aSClement Courbet     if (auto *B = dyn_cast<FrameIndexSDNode>(BasePtr1.getBase())) {
13062b3b91aSClement Courbet       MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
13162b3b91aSClement Courbet       // If the base are the same frame index but the we couldn't find a
13262b3b91aSClement Courbet       // constant offset, (indices are different) be conservative.
13362b3b91aSClement Courbet       if (A != B && (!MFI.isFixedObjectIndex(A->getIndex()) ||
13462b3b91aSClement Courbet                      !MFI.isFixedObjectIndex(B->getIndex()))) {
13562b3b91aSClement Courbet         IsAlias = false;
13662b3b91aSClement Courbet         return true;
13762b3b91aSClement Courbet       }
13862b3b91aSClement Courbet     }
13962b3b91aSClement Courbet 
14062b3b91aSClement Courbet   bool IsFI0 = isa<FrameIndexSDNode>(BasePtr0.getBase());
14162b3b91aSClement Courbet   bool IsFI1 = isa<FrameIndexSDNode>(BasePtr1.getBase());
14262b3b91aSClement Courbet   bool IsGV0 = isa<GlobalAddressSDNode>(BasePtr0.getBase());
14362b3b91aSClement Courbet   bool IsGV1 = isa<GlobalAddressSDNode>(BasePtr1.getBase());
14462b3b91aSClement Courbet   bool IsCV0 = isa<ConstantPoolSDNode>(BasePtr0.getBase());
14562b3b91aSClement Courbet   bool IsCV1 = isa<ConstantPoolSDNode>(BasePtr1.getBase());
14662b3b91aSClement Courbet 
1471896fb2cSBjorn Pettersson   if ((IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) {
1481896fb2cSBjorn Pettersson     // We can derive NoAlias In case of mismatched base types.
1491896fb2cSBjorn Pettersson     if (IsFI0 != IsFI1 || IsGV0 != IsGV1 || IsCV0 != IsCV1) {
15062b3b91aSClement Courbet       IsAlias = false;
15162b3b91aSClement Courbet       return true;
15262b3b91aSClement Courbet     }
1538ed0e6b2SBjorn Pettersson     if (IsGV0 && IsGV1) {
1548ed0e6b2SBjorn Pettersson       auto *GV0 = cast<GlobalAddressSDNode>(BasePtr0.getBase())->getGlobal();
1558ed0e6b2SBjorn Pettersson       auto *GV1 = cast<GlobalAddressSDNode>(BasePtr1.getBase())->getGlobal();
1568ed0e6b2SBjorn Pettersson       // It doesn't make sense to access one global value using another globals
1578ed0e6b2SBjorn Pettersson       // values address, so we can assume that there is no aliasing in case of
1588ed0e6b2SBjorn Pettersson       // two different globals (unless we have symbols that may indirectly point
1598ed0e6b2SBjorn Pettersson       // to each other).
1608ed0e6b2SBjorn Pettersson       // FIXME: This is perhaps a bit too defensive. We could try to follow the
1618ed0e6b2SBjorn Pettersson       // chain with aliasee information for GlobalAlias variables to find out if
1628ed0e6b2SBjorn Pettersson       // we indirect symbols may alias or not.
1638ed0e6b2SBjorn Pettersson       if (GV0 != GV1 && !isa<GlobalAlias>(GV0) && !isa<GlobalAlias>(GV1)) {
1641896fb2cSBjorn Pettersson         IsAlias = false;
1651896fb2cSBjorn Pettersson         return true;
1661896fb2cSBjorn Pettersson       }
1671896fb2cSBjorn Pettersson     }
1688ed0e6b2SBjorn Pettersson   }
16962b3b91aSClement Courbet   return false; // Cannot determine whether the pointers alias.
17062b3b91aSClement Courbet }
17162b3b91aSClement Courbet 
contains(const SelectionDAG & DAG,int64_t BitSize,const BaseIndexOffset & Other,int64_t OtherBitSize,int64_t & BitOffset) const172582d4632SNirav Dave bool BaseIndexOffset::contains(const SelectionDAG &DAG, int64_t BitSize,
173582d4632SNirav Dave                                const BaseIndexOffset &Other,
174582d4632SNirav Dave                                int64_t OtherBitSize, int64_t &BitOffset) const {
175582d4632SNirav Dave   int64_t Offset;
17662b3b91aSClement Courbet   if (!equalBaseIndex(Other, DAG, Offset))
17762b3b91aSClement Courbet     return false;
17862b3b91aSClement Courbet   if (Offset >= 0) {
17962b3b91aSClement Courbet     // Other is after *this:
18062b3b91aSClement Courbet     // [-------*this---------]
18162b3b91aSClement Courbet     //            [---Other--]
18262b3b91aSClement Courbet     // ==Offset==>
183582d4632SNirav Dave     BitOffset = 8 * Offset;
184582d4632SNirav Dave     return BitOffset + OtherBitSize <= BitSize;
18562b3b91aSClement Courbet   }
18662b3b91aSClement Courbet   // Other starts strictly before *this, it cannot be fully contained.
18762b3b91aSClement Courbet   //    [-------*this---------]
18862b3b91aSClement Courbet   // [--Other--]
18962b3b91aSClement Courbet   return false;
19062b3b91aSClement Courbet }
19162b3b91aSClement Courbet 
192c1b6aa77SNirav Dave /// Parses tree in Ptr for base, index, offset addresses.
matchLSNode(const LSBaseSDNode * N,const SelectionDAG & DAG)193b5630a2aSNirav Dave static BaseIndexOffset matchLSNode(const LSBaseSDNode *N,
1946e2d03d4SNirav Dave                                    const SelectionDAG &DAG) {
1956e2d03d4SNirav Dave   SDValue Ptr = N->getBasePtr();
1966e2d03d4SNirav Dave 
197c1b6aa77SNirav Dave   // (((B + I*M) + c)) + c ...
198d1b3f09fSNirav Dave   SDValue Base = DAG.getTargetLoweringInfo().unwrapAddress(Ptr);
199c1b6aa77SNirav Dave   SDValue Index = SDValue();
200c1b6aa77SNirav Dave   int64_t Offset = 0;
201c1b6aa77SNirav Dave   bool IsIndexSignExt = false;
202c1b6aa77SNirav Dave 
2036e2d03d4SNirav Dave   // pre-inc/pre-dec ops are components of EA.
2046e2d03d4SNirav Dave   if (N->getAddressingMode() == ISD::PRE_INC) {
2056e2d03d4SNirav Dave     if (auto *C = dyn_cast<ConstantSDNode>(N->getOffset()))
2066e2d03d4SNirav Dave       Offset += C->getSExtValue();
2076e2d03d4SNirav Dave     else // If unknown, give up now.
2086e2d03d4SNirav Dave       return BaseIndexOffset(SDValue(), SDValue(), 0, false);
2096e2d03d4SNirav Dave   } else if (N->getAddressingMode() == ISD::PRE_DEC) {
2106e2d03d4SNirav Dave     if (auto *C = dyn_cast<ConstantSDNode>(N->getOffset()))
2116e2d03d4SNirav Dave       Offset -= C->getSExtValue();
2126e2d03d4SNirav Dave     else // If unknown, give up now.
2136e2d03d4SNirav Dave       return BaseIndexOffset(SDValue(), SDValue(), 0, false);
2146e2d03d4SNirav Dave   }
2156e2d03d4SNirav Dave 
216b320ef9fSNirav Dave   // Consume constant adds & ors with appropriate masking.
2179896238dSNirav Dave   while (true) {
2189896238dSNirav Dave     switch (Base->getOpcode()) {
2199896238dSNirav Dave     case ISD::OR:
220b320ef9fSNirav Dave       // Only consider ORs which act as adds.
2219896238dSNirav Dave       if (auto *C = dyn_cast<ConstantSDNode>(Base->getOperand(1)))
2229896238dSNirav Dave         if (DAG.MaskedValueIsZero(Base->getOperand(0), C->getAPIntValue())) {
223b320ef9fSNirav Dave           Offset += C->getSExtValue();
224923f463eSCraig Topper           Base = DAG.getTargetLoweringInfo().unwrapAddress(Base->getOperand(0));
225b320ef9fSNirav Dave           continue;
226b320ef9fSNirav Dave         }
227b320ef9fSNirav Dave       break;
2289896238dSNirav Dave     case ISD::ADD:
2299896238dSNirav Dave       if (auto *C = dyn_cast<ConstantSDNode>(Base->getOperand(1))) {
2309896238dSNirav Dave         Offset += C->getSExtValue();
231923f463eSCraig Topper         Base = DAG.getTargetLoweringInfo().unwrapAddress(Base->getOperand(0));
2329896238dSNirav Dave         continue;
2339896238dSNirav Dave       }
2349896238dSNirav Dave       break;
2359896238dSNirav Dave     case ISD::LOAD:
2369896238dSNirav Dave     case ISD::STORE: {
2379896238dSNirav Dave       auto *LSBase = cast<LSBaseSDNode>(Base.getNode());
2389896238dSNirav Dave       unsigned int IndexResNo = (Base->getOpcode() == ISD::LOAD) ? 1 : 0;
2399896238dSNirav Dave       if (LSBase->isIndexed() && Base.getResNo() == IndexResNo)
2409896238dSNirav Dave         if (auto *C = dyn_cast<ConstantSDNode>(LSBase->getOffset())) {
2419896238dSNirav Dave           auto Off = C->getSExtValue();
2429896238dSNirav Dave           if (LSBase->getAddressingMode() == ISD::PRE_DEC ||
2439896238dSNirav Dave               LSBase->getAddressingMode() == ISD::POST_DEC)
2449896238dSNirav Dave             Offset -= Off;
2459896238dSNirav Dave           else
2469896238dSNirav Dave             Offset += Off;
247923f463eSCraig Topper           Base = DAG.getTargetLoweringInfo().unwrapAddress(LSBase->getBasePtr());
2489896238dSNirav Dave           continue;
2499896238dSNirav Dave         }
2509896238dSNirav Dave       break;
2519896238dSNirav Dave     }
2529896238dSNirav Dave     }
2539896238dSNirav Dave     // If we get here break out of the loop.
2549896238dSNirav Dave     break;
255c1b6aa77SNirav Dave   }
256c1b6aa77SNirav Dave 
257c1b6aa77SNirav Dave   if (Base->getOpcode() == ISD::ADD) {
258c1b6aa77SNirav Dave     // TODO: The following code appears to be needless as it just
259c1b6aa77SNirav Dave     //       bails on some Ptrs early, reducing the cases where we
260c1b6aa77SNirav Dave     //       find equivalence. We should be able to remove this.
261c1b6aa77SNirav Dave     // Inside a loop the current BASE pointer is calculated using an ADD and a
262c1b6aa77SNirav Dave     // MUL instruction. In this case Base is the actual BASE pointer.
263c1b6aa77SNirav Dave     // (i64 add (i64 %array_ptr)
264c1b6aa77SNirav Dave     //          (i64 mul (i64 %induction_var)
265c1b6aa77SNirav Dave     //                   (i64 %element_size)))
266c1b6aa77SNirav Dave     if (Base->getOperand(1)->getOpcode() == ISD::MUL)
267c1b6aa77SNirav Dave       return BaseIndexOffset(Base, Index, Offset, IsIndexSignExt);
268c1b6aa77SNirav Dave 
269c1b6aa77SNirav Dave     // Look at Base + Index + Offset cases.
270c1b6aa77SNirav Dave     Index = Base->getOperand(1);
271c1b6aa77SNirav Dave     SDValue PotentialBase = Base->getOperand(0);
272c1b6aa77SNirav Dave 
273c1b6aa77SNirav Dave     // Skip signextends.
274c1b6aa77SNirav Dave     if (Index->getOpcode() == ISD::SIGN_EXTEND) {
275c1b6aa77SNirav Dave       Index = Index->getOperand(0);
276c1b6aa77SNirav Dave       IsIndexSignExt = true;
277c1b6aa77SNirav Dave     }
278c1b6aa77SNirav Dave 
279c1b6aa77SNirav Dave     // Check if Index Offset pattern
280c1b6aa77SNirav Dave     if (Index->getOpcode() != ISD::ADD ||
281c1b6aa77SNirav Dave         !isa<ConstantSDNode>(Index->getOperand(1)))
282c1b6aa77SNirav Dave       return BaseIndexOffset(PotentialBase, Index, Offset, IsIndexSignExt);
283c1b6aa77SNirav Dave 
284c1b6aa77SNirav Dave     Offset += cast<ConstantSDNode>(Index->getOperand(1))->getSExtValue();
285c1b6aa77SNirav Dave     Index = Index->getOperand(0);
286c1b6aa77SNirav Dave     if (Index->getOpcode() == ISD::SIGN_EXTEND) {
287c1b6aa77SNirav Dave       Index = Index->getOperand(0);
288c1b6aa77SNirav Dave       IsIndexSignExt = true;
289c1b6aa77SNirav Dave     } else
290c1b6aa77SNirav Dave       IsIndexSignExt = false;
291c1b6aa77SNirav Dave     Base = PotentialBase;
292c1b6aa77SNirav Dave   }
293c1b6aa77SNirav Dave   return BaseIndexOffset(Base, Index, Offset, IsIndexSignExt);
294c1b6aa77SNirav Dave }
2951bb0e5ccSClement Courbet 
match(const SDNode * N,const SelectionDAG & DAG)296b5630a2aSNirav Dave BaseIndexOffset BaseIndexOffset::match(const SDNode *N,
297b5630a2aSNirav Dave                                        const SelectionDAG &DAG) {
298b5630a2aSNirav Dave   if (const auto *LS0 = dyn_cast<LSBaseSDNode>(N))
299b5630a2aSNirav Dave     return matchLSNode(LS0, DAG);
300b5630a2aSNirav Dave   if (const auto *LN = dyn_cast<LifetimeSDNode>(N)) {
301b5630a2aSNirav Dave     if (LN->hasOffset())
302b5630a2aSNirav Dave       return BaseIndexOffset(LN->getOperand(1), SDValue(), LN->getOffset(),
303b5630a2aSNirav Dave                              false);
304b5630a2aSNirav Dave     return BaseIndexOffset(LN->getOperand(1), SDValue(), false);
305b5630a2aSNirav Dave   }
306b5630a2aSNirav Dave   return BaseIndexOffset();
307b5630a2aSNirav Dave }
3081bb0e5ccSClement Courbet 
3091bb0e5ccSClement Courbet #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
3101bb0e5ccSClement Courbet 
dump() const3111bb0e5ccSClement Courbet LLVM_DUMP_METHOD void BaseIndexOffset::dump() const {
3121bb0e5ccSClement Courbet   print(dbgs());
3131bb0e5ccSClement Courbet }
3141bb0e5ccSClement Courbet 
print(raw_ostream & OS) const3151bb0e5ccSClement Courbet void BaseIndexOffset::print(raw_ostream& OS) const {
3161bb0e5ccSClement Courbet   OS << "BaseIndexOffset base=[";
3171bb0e5ccSClement Courbet   Base->print(OS);
3181bb0e5ccSClement Courbet   OS << "] index=[";
3191bb0e5ccSClement Courbet   if (Index)
3201bb0e5ccSClement Courbet     Index->print(OS);
3211bb0e5ccSClement Courbet   OS << "] offset=" << Offset;
3221bb0e5ccSClement Courbet }
3231bb0e5ccSClement Courbet 
3241bb0e5ccSClement Courbet #endif
325