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
This commit is contained in:
Daniel Dunbar
2009-07-24 10:36:58 +00:00
parent b95c2fd270
commit 1cd1d98232
8 changed files with 67 additions and 8 deletions

View File

@@ -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"