[llvm-commits] [llvm] r55291 - in /llvm/trunk: include/llvm/CodeGen/PseudoSourceValue.h lib/CodeGen/MachineInstr.cpp lib/CodeGen/PseudoSourceValue.cpp

Evan Cheng evan.cheng at apple.com
Sun Aug 24 11:51:21 PDT 2008


Author: evancheng
Date: Sun Aug 24 13:51:20 2008
New Revision: 55291

URL: http://llvm.org/viewvc/llvm-project?rev=55291&view=rev
Log:
Print PseudoSourceValue.

Modified:
    llvm/trunk/include/llvm/CodeGen/PseudoSourceValue.h
    llvm/trunk/lib/CodeGen/MachineInstr.cpp
    llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp

Modified: llvm/trunk/include/llvm/CodeGen/PseudoSourceValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/PseudoSourceValue.h?rev=55291&r1=55290&r2=55291&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/PseudoSourceValue.h (original)
+++ llvm/trunk/include/llvm/CodeGen/PseudoSourceValue.h Sun Aug 24 13:51:20 2008
@@ -18,6 +18,7 @@
 
 namespace llvm {
   class MachineFrameInfo;
+  class raw_ostream;
 
   /// PseudoSourceValue - Special value supplied for machine level alias
   /// analysis. It indicates that the a memory access references the functions
@@ -28,6 +29,7 @@
     PseudoSourceValue();
 
     virtual void print(std::ostream &OS) const;
+    virtual void print(raw_ostream &OS) const;
 
     /// isConstant - Test whether this PseudoSourceValue has a constant value.
     ///
@@ -59,6 +61,16 @@
     /// A SV referencing the jump table
     static const PseudoSourceValue *getJumpTable();
   };
+
+inline std::ostream &operator<<(std::ostream &OS,const PseudoSourceValue &PSV) {
+  PSV.print(OS);
+  return OS;
+}
+inline raw_ostream &operator<<(raw_ostream &OS, const PseudoSourceValue &PSV) {
+  PSV.print(OS);
+  return OS;
+}
+
 } // End llvm namespace
 
 #endif

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=55291&r1=55290&r2=55291&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Sun Aug 24 13:51:20 2008
@@ -756,8 +756,8 @@
         OS << "<unknown>";
       else if (!V->getName().empty())
         OS << V->getName();
-      else if (isa<PseudoSourceValue>(V))
-        OS << *V;
+      else if (const PseudoSourceValue *PSV = dyn_cast<PseudoSourceValue>(V))
+        OS << *PSV;
       else
         OS << V;
 

Modified: llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp?rev=55291&r1=55290&r2=55291&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp (original)
+++ llvm/trunk/lib/CodeGen/PseudoSourceValue.cpp Sun Aug 24 13:51:20 2008
@@ -16,6 +16,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/raw_ostream.h"
 #include <map>
 
 namespace llvm {
@@ -43,6 +44,9 @@
   void PseudoSourceValue::print(std::ostream &OS) const {
     OS << PSVNames[this - *PSVs];
   }
+  void PseudoSourceValue::print(raw_ostream &OS) const {
+    OS << PSVNames[this - *PSVs];
+  }
 
   /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
   /// for holding FixedStack values, which must include a frame
@@ -58,6 +62,9 @@
     virtual void print(std::ostream &OS) const {
       OS << "FixedStack" << FI;
     }
+    virtual void print(raw_ostream &OS) const {
+      OS << "FixedStack" << FI;
+    }
   };
 
   static ManagedStatic<std::map<int, const PseudoSourceValue *> > FSValues;





More information about the llvm-commits mailing list