diff --git a/include/llvm/CodeGen/PseudoSourceValue.h b/include/llvm/CodeGen/PseudoSourceValue.h index 115e565b6b6..4620456ecfe 100644 --- a/include/llvm/CodeGen/PseudoSourceValue.h +++ b/include/llvm/CodeGen/PseudoSourceValue.h @@ -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 @@ namespace llvm { 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 @@ namespace llvm { /// 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 diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 00987d76fcd..41df5df5a56 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -756,8 +756,8 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine *TM) const { OS << ""; else if (!V->getName().empty()) OS << V->getName(); - else if (isa(V)) - OS << *V; + else if (const PseudoSourceValue *PSV = dyn_cast(V)) + OS << *PSV; else OS << V; diff --git a/lib/CodeGen/PseudoSourceValue.cpp b/lib/CodeGen/PseudoSourceValue.cpp index bcf4ea8fb75..ac41609d39a 100644 --- a/lib/CodeGen/PseudoSourceValue.cpp +++ b/lib/CodeGen/PseudoSourceValue.cpp @@ -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 namespace llvm { @@ -43,6 +44,9 @@ namespace llvm { 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 @@ namespace llvm { virtual void print(std::ostream &OS) const { OS << "FixedStack" << FI; } + virtual void print(raw_ostream &OS) const { + OS << "FixedStack" << FI; + } }; static ManagedStatic > FSValues;