OSDN Git Service

[SelectionDAG] Add a BaseIndexOffset::print() method for debugging.
authorClement Courbet <courbet@google.com>
Mon, 4 Feb 2019 09:30:43 +0000 (09:30 +0000)
committerClement Courbet <courbet@google.com>
Mon, 4 Feb 2019 09:30:43 +0000 (09:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353028 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGAddressAnalysis.h
lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp

index 19033d6..f168b84 100644 (file)
@@ -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
index 56558e6..e57dabc 100644 (file)
@@ -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
+