Add debugging support.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 29 Oct 2008 23:55:17 +0000 (23:55 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 29 Oct 2008 23:55:17 +0000 (23:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58408 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMConstantPoolValue.cpp
lib/Target/ARM/ARMConstantPoolValue.h

index 04db1644f8c8c65da292379cbecbee907d5cf100..002ebf109f7835626baa06d6cae77b957e8dca16 100644 (file)
@@ -15,7 +15,9 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/GlobalValue.h"
 #include "llvm/Type.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/Support/raw_ostream.h"
+#include <ostream>
 using namespace llvm;
 
 ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, unsigned id,
@@ -73,6 +75,15 @@ ARMConstantPoolValue::AddSelectionDAGCSEId(FoldingSetNodeID &ID) {
   ID.AddInteger(PCAdjust);
 }
 
+void ARMConstantPoolValue::dump() const {
+  cerr << "  " << *this;
+}
+
+void ARMConstantPoolValue::print(std::ostream &O) const {
+  raw_os_ostream RawOS(O);
+  print(RawOS);
+}
+
 void ARMConstantPoolValue::print(raw_ostream &O) const {
   if (GV)
     O << GV->getName();
index caf8d54f16334a38d953519c400791967de57e4e..b5f8325f045db9a79c5b35d1cb0da85e98311f6f 100644 (file)
@@ -69,9 +69,23 @@ public:
 
   virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID);
 
-  virtual void print(raw_ostream &O) const;
+  void print(std::ostream *O) const { if (O) print(*O); }
+  void print(std::ostream &O) const;
+  void print(raw_ostream *O) const { if (O) print(*O); }
+  void print(raw_ostream &O) const;
+  void dump() const;
 };
+
+  inline std::ostream &operator<<(std::ostream &O, const ARMConstantPoolValue &V) {
+  V.print(O);
+  return O;
+}
   
+inline raw_ostream &operator<<(raw_ostream &O, const ARMConstantPoolValue &V) {
+  V.print(O);
+  return O;
 }
 
+} // End llvm namespace
+
 #endif