From 1bb0e5ccfb07d0c86927273b715e48828d72c516 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 4 Feb 2019 09:30:43 +0000 Subject: [PATCH] [SelectionDAG] Add a BaseIndexOffset::print() method for debugging. llvm-svn: 353028 --- .../llvm/CodeGen/SelectionDAGAddressAnalysis.h | 3 +++ .../SelectionDAG/SelectionDAGAddressAnalysis.cpp | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h index 19033d6..f168b84 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h @@ -59,6 +59,9 @@ public: /// Parses tree in Ptr for base, index, offset addresses. static BaseIndexOffset match(const LSBaseSDNode *N, const SelectionDAG &DAG); + + void print(raw_ostream& OS) const; + void dump() const; }; } // end namespace llvm diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp index 56558e6..e57dabc 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp @@ -177,3 +177,22 @@ BaseIndexOffset BaseIndexOffset::match(const LSBaseSDNode *N, } return BaseIndexOffset(Base, Index, Offset, IsIndexSignExt); } + + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + +LLVM_DUMP_METHOD void BaseIndexOffset::dump() const { + print(dbgs()); +} + +void BaseIndexOffset::print(raw_ostream& OS) const { + OS << "BaseIndexOffset base=["; + Base->print(OS); + OS << "] index=["; + if (Index) + Index->print(OS); + OS << "] offset=" << Offset; +} + +#endif + -- 2.7.4