From 1cd1d98232c3c3a0bd3810c3bf6c2572ea02f208 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 24 Jul 2009 10:36:58 +0000 Subject: 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 --- lib/CodeGen/MachineBasicBlock.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/MachineBasicBlock.cpp') 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 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" -- cgit v1.2.3-18-g5258