diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-24 10:36:58 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-24 10:36:58 +0000 |
commit | 1cd1d98232c3c3a0bd3810c3bf6c2572ea02f208 (patch) | |
tree | 233ac1c2bca5a7f2a8eb43b1a2815d807d9e4f9f /lib/CodeGen/MachineBasicBlock.cpp | |
parent | b95c2fd2700a92a7b857ebd1ecf6c7d561d676d2 (diff) |
Move more to raw_ostream, provide support for writing MachineBasicBlock,
LiveInterval, etc to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | lib/CodeGen/MachineBasicBlock.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index 71e6b3e4d0..80ca8727f7 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/lib/CodeGen/MachineBasicBlock.cpp @@ -19,6 +19,7 @@ #include "llvm/Target/TargetInstrDesc.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/LeakDetector.h" +#include "llvm/Support/raw_ostream.h" #include <algorithm> using namespace llvm; @@ -35,6 +36,10 @@ std::ostream& llvm::operator<<(std::ostream &OS, const MachineBasicBlock &MBB) { MBB.print(OS); return OS; } +raw_ostream& llvm::operator<<(raw_ostream &OS, const MachineBasicBlock &MBB) { + MBB.print(OS); + return OS; +} /// addNodeToList (MBB) - When an MBB is added to an MF, we need to update the /// parent pointer of the MBB, the MBB numbering, and any instructions in the @@ -137,7 +142,7 @@ void MachineBasicBlock::dump() const { print(*cerr.stream()); } -static inline void OutputReg(std::ostream &os, unsigned RegNo, +static inline void OutputReg(raw_ostream &os, unsigned RegNo, const TargetRegisterInfo *TRI = 0) { if (!RegNo || TargetRegisterInfo::isPhysicalRegister(RegNo)) { if (TRI) @@ -149,6 +154,11 @@ static inline void OutputReg(std::ostream &os, unsigned RegNo, } void MachineBasicBlock::print(std::ostream &OS) const { + raw_os_ostream RawOS(OS); + print(RawOS); +} + +void MachineBasicBlock::print(raw_ostream &OS) const { const MachineFunction *MF = getParent(); if(!MF) { OS << "Can't print out MachineBasicBlock because parent MachineFunction" |