Use raw_ostream throughout the AsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55092 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2008-08-21 00:14:44 +00:00
parent f4a97da407
commit cb37188323
66 changed files with 448 additions and 180 deletions

View File

@@ -34,6 +34,7 @@ namespace llvm {
class Mangler;
class TargetAsmInfo;
class Type;
class raw_ostream;
/// AsmPrinter - This class is intended to be used as a driving class for all
/// asm writers.
@@ -64,7 +65,7 @@ namespace llvm {
public:
/// Output stream on which we're printing assembly code.
///
std::ostream &O;
raw_ostream &O;
/// Target machine description.
///
@@ -96,7 +97,7 @@ namespace llvm {
bool IsInTextSection;
protected:
AsmPrinter(std::ostream &o, TargetMachine &TM, const TargetAsmInfo *T);
AsmPrinter(raw_ostream &o, TargetMachine &TM, const TargetAsmInfo *T);
public:
virtual ~AsmPrinter();

View File

@@ -31,6 +31,7 @@ class MachineModuleInfo;
class MachineFunction;
class Module;
class TargetAsmInfo;
class raw_ostream;
//===----------------------------------------------------------------------===//
// DwarfWriter - Emits Dwarf debug and exception handling directives.
@@ -48,7 +49,7 @@ private:
public:
DwarfWriter(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T);
DwarfWriter(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T);
virtual ~DwarfWriter();
/// SetModuleInfo - Set machine module info when it's known that pass manager

View File

@@ -21,10 +21,11 @@ namespace llvm {
class PassManagerBase;
class MachineCodeEmitter;
class TargetMachine;
class raw_ostream;
MachineCodeEmitter *AddELFWriter(PassManagerBase &FPM, std::ostream &O,
MachineCodeEmitter *AddELFWriter(PassManagerBase &FPM, raw_ostream &O,
TargetMachine &TM);
MachineCodeEmitter *AddMachOWriter(PassManagerBase &FPM, std::ostream &O,
MachineCodeEmitter *AddMachOWriter(PassManagerBase &FPM, raw_ostream &O,
TargetMachine &TM);
} // end llvm namespace

View File

@@ -29,6 +29,7 @@
namespace llvm {
class GCMetadataPrinter;
class raw_ostream;
/// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
/// defaults from Registry.
@@ -63,10 +64,10 @@ namespace llvm {
iterator end() { return S->end(); }
/// beginAssembly/finishAssembly - Emit module metadata as assembly code.
virtual void beginAssembly(std::ostream &OS, AsmPrinter &AP,
virtual void beginAssembly(raw_ostream &OS, AsmPrinter &AP,
const TargetAsmInfo &TAI);
virtual void finishAssembly(std::ostream &OS, AsmPrinter &AP,
virtual void finishAssembly(raw_ostream &OS, AsmPrinter &AP,
const TargetAsmInfo &TAI);
virtual ~GCMetadataPrinter();

View File

@@ -258,6 +258,11 @@ public:
}
void print(std::ostream &OS, const TargetMachine *TM = 0) const;
void print(std::ostream *OS) const { if (OS) print(*OS); }
void print(raw_ostream *OS, const TargetMachine *TM) const {
if (OS) print(*OS, TM);
}
void print(raw_ostream &OS, const TargetMachine *TM = 0) const;
void print(raw_ostream *OS) const { if (OS) print(*OS); }
void dump() const;
//===--------------------------------------------------------------------===//
@@ -316,6 +321,11 @@ inline std::ostream& operator<<(std::ostream &OS, const MachineInstr &MI) {
return OS;
}
inline raw_ostream& operator<<(raw_ostream &OS, const MachineInstr &MI) {
MI.print(OS);
return OS;
}
} // End llvm namespace
#endif

View File

@@ -26,6 +26,7 @@ class GlobalValue;
class MachineInstr;
class TargetMachine;
class MachineRegisterInfo;
class raw_ostream;
/// MachineOperand class - Representation of each machine instruction operand.
///
@@ -117,6 +118,7 @@ public:
const MachineInstr *getParent() const { return ParentMI; }
void print(std::ostream &os, const TargetMachine *TM = 0) const;
void print(raw_ostream &os, const TargetMachine *TM = 0) const;
/// Accessors that tell you what kind of MachineOperand you're looking at.
///
@@ -425,6 +427,11 @@ inline std::ostream &operator<<(std::ostream &OS, const MachineOperand &MO) {
return OS;
}
inline raw_ostream &operator<<(raw_ostream &OS, const MachineOperand& MO) {
MO.print(OS, 0);
return OS;
}
} // End llvm namespace
#endif