From 302008dbeae03364ffffc1bcf77d2eb28897d98a Mon Sep 17 00:00:00 2001 From: David Greene Date: Tue, 14 Jul 2009 20:18:05 +0000 Subject: Have asm printers use formatted_raw_ostream directly to avoid a dynamic_cast<>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75670 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARM.h | 4 +-- lib/Target/ARM/ARMTargetMachine.cpp | 16 +++++----- lib/Target/ARM/ARMTargetMachine.h | 4 +-- lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 10 +++--- lib/Target/Alpha/Alpha.h | 4 +-- lib/Target/Alpha/AlphaTargetMachine.cpp | 10 +++--- lib/Target/Alpha/AlphaTargetMachine.h | 4 +-- lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 6 ++-- lib/Target/CBackend/CBackend.cpp | 42 ++++++++++++++----------- lib/Target/CBackend/CTargetMachine.h | 3 +- lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 10 +++--- lib/Target/CellSPU/SPU.h | 4 +-- lib/Target/CellSPU/SPUTargetMachine.cpp | 2 +- lib/Target/CellSPU/SPUTargetMachine.h | 4 +-- lib/Target/CppBackend/CPPBackend.cpp | 12 +++---- lib/Target/CppBackend/CPPTargetMachine.h | 5 +-- lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp | 6 ++-- lib/Target/IA64/IA64.h | 4 +-- lib/Target/IA64/IA64TargetMachine.cpp | 2 +- lib/Target/IA64/IA64TargetMachine.h | 4 +-- lib/Target/MSIL/MSILWriter.cpp | 6 ++-- lib/Target/MSIL/MSILWriter.h | 8 +++-- lib/Target/MSP430/MSP430.h | 4 +-- lib/Target/MSP430/MSP430AsmPrinter.cpp | 6 ++-- lib/Target/MSP430/MSP430TargetMachine.cpp | 2 +- lib/Target/MSP430/MSP430TargetMachine.h | 2 +- lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 6 ++-- lib/Target/Mips/Mips.h | 4 +-- lib/Target/Mips/MipsTargetMachine.cpp | 2 +- lib/Target/Mips/MipsTargetMachine.h | 6 ++-- lib/Target/PIC16/PIC16.h | 4 +-- lib/Target/PIC16/PIC16AsmPrinter.cpp | 4 +-- lib/Target/PIC16/PIC16AsmPrinter.h | 2 +- lib/Target/PIC16/PIC16DebugInfo.cpp | 2 +- lib/Target/PIC16/PIC16DebugInfo.h | 7 +++-- lib/Target/PIC16/PIC16TargetMachine.cpp | 3 +- lib/Target/PIC16/PIC16TargetMachine.h | 2 +- lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 14 ++++----- lib/Target/PowerPC/PPC.h | 5 +-- lib/Target/PowerPC/PPCTargetMachine.cpp | 16 +++++----- lib/Target/PowerPC/PPCTargetMachine.h | 4 +-- lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 6 ++-- lib/Target/Sparc/Sparc.h | 5 +-- lib/Target/Sparc/SparcTargetMachine.cpp | 2 +- lib/Target/Sparc/SparcTargetMachine.h | 4 +-- lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 5 +-- lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h | 2 +- lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp | 2 +- lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 2 +- lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h | 4 +-- lib/Target/X86/X86.h | 5 +-- lib/Target/X86/X86TargetMachine.cpp | 16 +++++----- lib/Target/X86/X86TargetMachine.h | 6 ++-- lib/Target/XCore/XCore.h | 4 +-- lib/Target/XCore/XCoreAsmPrinter.cpp | 9 +++--- lib/Target/XCore/XCoreTargetMachine.cpp | 2 +- lib/Target/XCore/XCoreTargetMachine.h | 2 +- 57 files changed, 180 insertions(+), 161 deletions(-) (limited to 'lib/Target') diff --git a/lib/Target/ARM/ARM.h b/lib/Target/ARM/ARM.h index 3c0cfa5..f6ae680 100644 --- a/lib/Target/ARM/ARM.h +++ b/lib/Target/ARM/ARM.h @@ -26,7 +26,7 @@ class FunctionPass; class MachineCodeEmitter; class JITCodeEmitter; class ObjectCodeEmitter; -class raw_ostream; +class formatted_raw_ostream; // Enums corresponding to ARM condition codes namespace ARMCC { @@ -93,7 +93,7 @@ inline static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { } FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM); -FunctionPass *createARMCodePrinterPass(raw_ostream &O, +FunctionPass *createARMCodePrinterPass(formatted_raw_ostream &O, ARMBaseTargetMachine &TM, bool Verbose); FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM, diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index a827784..6ebc1fd 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -18,7 +18,7 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Target/TargetOptions.h" using namespace llvm; @@ -183,7 +183,7 @@ bool ARMBaseTargetMachine::addPreEmitPass(PassManagerBase &PM, bool ARMBaseTargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) @@ -206,7 +206,7 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -225,7 +225,7 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -244,7 +244,7 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -259,7 +259,7 @@ bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -274,7 +274,7 @@ bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -289,7 +289,7 @@ bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; diff --git a/lib/Target/ARM/ARMTargetMachine.h b/lib/Target/ARM/ARMTargetMachine.h index 4d97346..56b18ae 100644 --- a/lib/Target/ARM/ARMTargetMachine.h +++ b/lib/Target/ARM/ARMTargetMachine.h @@ -41,7 +41,7 @@ private: protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, ARMBaseTargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -71,7 +71,7 @@ public: virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool DumpAsm, MachineCodeEmitter &MCE); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 331d7ab..a7593c9 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -38,7 +38,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" #include using namespace llvm; @@ -82,7 +82,7 @@ namespace { /// True if asm printer is printing a series of CONSTPOOL_ENTRY. bool InCPMode; public: - explicit ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, + explicit ARMAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V), DW(0), AFI(NULL), MCP(NULL), InCPMode(false) { @@ -371,7 +371,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, } } -static void printSOImm(raw_ostream &O, int64_t V, bool VerboseAsm, +static void printSOImm(formatted_raw_ostream &O, int64_t V, bool VerboseAsm, const TargetAsmInfo *TAI) { // Break it up into two parts that make up a shifter immediate. V = ARM_AM::getSOImmVal(V); @@ -1013,7 +1013,7 @@ bool ARMAsmPrinter::doInitialization(Module &M) { /// PrintUnmangledNameSafely - Print out the printable characters in the name. /// Don't print things like \\n or \\0. -static void PrintUnmangledNameSafely(const Value *V, raw_ostream &OS) { +static void PrintUnmangledNameSafely(const Value *V, formatted_raw_ostream &OS) { for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen(); Name != E; ++Name) if (isprint(*Name)) @@ -1253,7 +1253,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) { /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createARMCodePrinterPass(formatted_raw_ostream &o, ARMBaseTargetMachine &tm, bool verbose) { return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/Alpha/Alpha.h b/lib/Target/Alpha/Alpha.h index 071257a..9226a55 100644 --- a/lib/Target/Alpha/Alpha.h +++ b/lib/Target/Alpha/Alpha.h @@ -23,10 +23,10 @@ namespace llvm { class FunctionPass; class MachineCodeEmitter; class ObjectCodeEmitter; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); - FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS, + FunctionPass *createAlphaCodePrinterPass(formatted_raw_ostream &OS, TargetMachine &TM, bool Verbose); FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM); diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index 9b0f8d0..625d0ce 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/lib/Target/Alpha/AlphaTargetMachine.cpp @@ -17,7 +17,7 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" using namespace llvm; @@ -89,7 +89,7 @@ bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM, bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { PM.add(createAlphaLLRPPass(*this)); // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); @@ -104,7 +104,7 @@ bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; } @@ -115,7 +115,7 @@ bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; } @@ -126,7 +126,7 @@ bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; } diff --git a/lib/Target/Alpha/AlphaTargetMachine.h b/lib/Target/Alpha/AlphaTargetMachine.h index 40ba4b3..7546892 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.h +++ b/lib/Target/Alpha/AlphaTargetMachine.h @@ -39,7 +39,7 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, TargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -69,7 +69,7 @@ public: virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool DumpAsm, MachineCodeEmitter &MCE); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index f43a394..21622db 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -27,7 +27,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Mangler.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/ADT/Statistic.h" using namespace llvm; @@ -38,7 +38,7 @@ namespace { /// Unique incrementer for label values for referencing Global values. /// - explicit AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, + explicit AlphaAsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, const TargetAsmInfo *T, bool V) : AsmPrinter(o, tm, T, V) {} @@ -68,7 +68,7 @@ namespace { /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createAlphaCodePrinterPass(formatted_raw_ostream &o, TargetMachine &tm, bool verbose) { return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index d9c6256..6f8386e 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -36,11 +36,11 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/CFG.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" @@ -89,7 +89,7 @@ namespace { /// CWriter - This class is the main chunk of code that converts an LLVM /// module to a C translation unit. class CWriter : public FunctionPass, public InstVisitor { - raw_ostream &Out; + formatted_raw_ostream &Out; IntrinsicLowering *IL; Mangler *Mang; LoopInfo *LI; @@ -107,7 +107,7 @@ namespace { public: static char ID; - explicit CWriter(raw_ostream &o) + explicit CWriter(formatted_raw_ostream &o) : FunctionPass(&ID), Out(o), IL(0), Mang(0), LI(0), TheModule(0), TAsm(0), TD(0), OpaqueCounter(0), NextAnonValueNumber(0) { FPCounter = 0; @@ -152,24 +152,26 @@ namespace { return false; } - raw_ostream &printType(raw_ostream &Out, const Type *Ty, - bool isSigned = false, - const std::string &VariableName = "", - bool IgnoreName = false, - const AttrListPtr &PAL = AttrListPtr()); + raw_ostream &printType(formatted_raw_ostream &Out, + const Type *Ty, + bool isSigned = false, + const std::string &VariableName = "", + bool IgnoreName = false, + const AttrListPtr &PAL = AttrListPtr()); std::ostream &printType(std::ostream &Out, const Type *Ty, bool isSigned = false, const std::string &VariableName = "", bool IgnoreName = false, const AttrListPtr &PAL = AttrListPtr()); - raw_ostream &printSimpleType(raw_ostream &Out, const Type *Ty, - bool isSigned, - const std::string &NameSoFar = ""); + raw_ostream &printSimpleType(formatted_raw_ostream &Out, + const Type *Ty, + bool isSigned, + const std::string &NameSoFar = ""); std::ostream &printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, const std::string &NameSoFar = ""); - void printStructReturnPointerFunctionType(raw_ostream &Out, + void printStructReturnPointerFunctionType(formatted_raw_ostream &Out, const AttrListPtr &PAL, const PointerType *Ty); @@ -435,7 +437,7 @@ bool CBackendNameAllUsedStructsAndMergeFunctions::runOnModule(Module &M) { /// printStructReturnPointerFunctionType - This is like printType for a struct /// return type, except, instead of printing the type as void (*)(Struct*, ...) /// print it as "Struct (*)(...)", for struct return functions. -void CWriter::printStructReturnPointerFunctionType(raw_ostream &Out, +void CWriter::printStructReturnPointerFunctionType(formatted_raw_ostream &Out, const AttrListPtr &PAL, const PointerType *TheTy) { const FunctionType *FTy = cast(TheTy->getElementType()); @@ -471,7 +473,8 @@ void CWriter::printStructReturnPointerFunctionType(raw_ostream &Out, } raw_ostream & -CWriter::printSimpleType(raw_ostream &Out, const Type *Ty, bool isSigned, +CWriter::printSimpleType(formatted_raw_ostream &Out, const Type *Ty, + bool isSigned, const std::string &NameSoFar) { assert((Ty->isPrimitiveType() || Ty->isInteger() || isa(Ty)) && "Invalid type for printSimpleType"); @@ -567,9 +570,10 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, // Pass the Type* and the variable name and this prints out the variable // declaration. // -raw_ostream &CWriter::printType(raw_ostream &Out, const Type *Ty, - bool isSigned, const std::string &NameSoFar, - bool IgnoreName, const AttrListPtr &PAL) { +raw_ostream &CWriter::printType(formatted_raw_ostream &Out, + const Type *Ty, + bool isSigned, const std::string &NameSoFar, + bool IgnoreName, const AttrListPtr &PAL) { if (Ty->isPrimitiveType() || Ty->isInteger() || isa(Ty)) { printSimpleType(Out, Ty, isSigned, NameSoFar); return Out; @@ -1640,7 +1644,7 @@ void CWriter::writeOperandWithCast(Value* Operand, const ICmpInst &Cmp) { // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // -static void generateCompilerSpecificCode(raw_ostream& Out, +static void generateCompilerSpecificCode(formatted_raw_ostream& Out, const TargetData *TD) { // Alloca is hard to get, and we don't want to include stdlib.h here. Out << "/* get a declaration for alloca */\n" @@ -3626,7 +3630,7 @@ void CWriter::visitExtractValueInst(ExtractValueInst &EVI) { //===----------------------------------------------------------------------===// bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM, - raw_ostream &o, + formatted_raw_ostream &o, CodeGenFileType FileType, CodeGenOpt::Level OptLevel) { if (FileType != TargetMachine::AssemblyFile) return true; diff --git a/lib/Target/CBackend/CTargetMachine.h b/lib/Target/CBackend/CTargetMachine.h index 8b26245..64b373b 100644 --- a/lib/Target/CBackend/CTargetMachine.h +++ b/lib/Target/CBackend/CTargetMachine.h @@ -26,7 +26,8 @@ struct CTargetMachine : public TargetMachine { : DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } - virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out, + virtual bool addPassesToEmitWholeFile(PassManager &PM, + formatted_raw_ostream &Out, CodeGenFileType FileType, CodeGenOpt::Level OptLevel); diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index 514006c..f0d8a36 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -32,7 +32,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Compiler.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" @@ -50,7 +50,7 @@ namespace { class VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; public: - explicit SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, + explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V) {} @@ -289,7 +289,7 @@ namespace { class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { DwarfWriter *DW; public: - explicit LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM, + explicit LinuxAsmPrinter(formatted_raw_ostream &O, SPUTargetMachine &TM, const TargetAsmInfo *T, bool V) : SPUAsmPrinter(O, TM, T, V), DW(0) {} @@ -492,7 +492,7 @@ bool LinuxAsmPrinter::doInitialization(Module &M) { /// PrintUnmangledNameSafely - Print out the printable characters in the name. /// Don't print things like \\n or \\0. -static void PrintUnmangledNameSafely(const Value *V, raw_ostream &OS) { +static void PrintUnmangledNameSafely(const Value *V, formatted_raw_ostream &OS) { for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen(); Name != E; ++Name) if (isprint(*Name)) @@ -598,7 +598,7 @@ bool LinuxAsmPrinter::doFinalization(Module &M) { /// assembly code for a MachineFunction to the given output stream, in a format /// that the Linux SPU assembler can deal with. /// -FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o, +FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o, SPUTargetMachine &tm, bool verbose) { return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/CellSPU/SPU.h b/lib/Target/CellSPU/SPU.h index 10d1110..0262348 100644 --- a/lib/Target/CellSPU/SPU.h +++ b/lib/Target/CellSPU/SPU.h @@ -21,10 +21,10 @@ namespace llvm { class SPUTargetMachine; class FunctionPass; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createSPUISelDag(SPUTargetMachine &TM); - FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, + FunctionPass *createSPUAsmPrinterPass(formatted_raw_ostream &o, SPUTargetMachine &tm, bool verbose); diff --git a/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp index 2470972..5c794c9 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/lib/Target/CellSPU/SPUTargetMachine.cpp @@ -90,7 +90,7 @@ SPUTargetMachine::addInstSelector(PassManagerBase &PM, bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) diff --git a/lib/Target/CellSPU/SPUTargetMachine.h b/lib/Target/CellSPU/SPUTargetMachine.h index 4c28521..ce8e550 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.h +++ b/lib/Target/CellSPU/SPUTargetMachine.h @@ -41,7 +41,7 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, SPUTargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -94,7 +94,7 @@ public: CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); static void registerAsmPrinter(AsmPrinterCtorFn F) { AsmPrinterCtor = F; diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 9ebbf00..b2d72dd 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -29,8 +29,8 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/Streams.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Config/config.h" #include #include @@ -98,7 +98,7 @@ namespace { /// CppWriter - This class is the main chunk of code that converts an LLVM /// module to a C++ translation unit. class CppWriter : public ModulePass { - raw_ostream &Out; + formatted_raw_ostream &Out; const Module *TheModule; uint64_t uniqueNum; TypeMap TypeNames; @@ -113,7 +113,7 @@ namespace { public: static char ID; - explicit CppWriter(raw_ostream &o) : + explicit CppWriter(formatted_raw_ostream &o) : ModulePass(&ID), Out(o), uniqueNum(0), is_inline(false) {} virtual const char *getPassName() const { return "C++ backend"; } @@ -166,7 +166,7 @@ namespace { }; static unsigned indent_level = 0; - inline raw_ostream& nl(raw_ostream& Out, int delta = 0) { + inline formatted_raw_ostream& nl(formatted_raw_ostream& Out, int delta = 0) { Out << "\n"; if (delta >= 0 || indent_level >= unsigned(-delta)) indent_level += delta; @@ -1807,8 +1807,8 @@ namespace { Out << "#include \n"; Out << "#include \n"; Out << "#include \n"; + Out << "#include \n"; Out << "#include \n"; - Out << "#include \n"; Out << "#include \n"; Out << "#include \n"; Out << "#include \n"; @@ -2013,7 +2013,7 @@ char CppWriter::ID = 0; //===----------------------------------------------------------------------===// bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM, - raw_ostream &o, + formatted_raw_ostream &o, CodeGenFileType FileType, CodeGenOpt::Level OptLevel) { if (FileType != TargetMachine::AssemblyFile) return true; diff --git a/lib/Target/CppBackend/CPPTargetMachine.h b/lib/Target/CppBackend/CPPTargetMachine.h index db4bc0e..84a07ea 100644 --- a/lib/Target/CppBackend/CPPTargetMachine.h +++ b/lib/Target/CppBackend/CPPTargetMachine.h @@ -19,7 +19,7 @@ namespace llvm { -class raw_ostream; +class formatted_raw_ostream; struct CPPTargetMachine : public TargetMachine { const TargetData DataLayout; // Calculates type size & alignment @@ -28,7 +28,8 @@ struct CPPTargetMachine : public TargetMachine { : DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } - virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out, + virtual bool addPassesToEmitWholeFile(PassManager &PM, + formatted_raw_ostream &Out, CodeGenFileType FileType, CodeGenOpt::Level OptLevel); diff --git a/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp b/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp index 6797868..b8aa37e 100644 --- a/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp +++ b/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp @@ -27,8 +27,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/Mangler.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" using namespace llvm; @@ -38,7 +38,7 @@ namespace { class IA64AsmPrinter : public AsmPrinter { std::set ExternalFunctionNames, ExternalObjectNames; public: - explicit IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, + explicit IA64AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V) {} @@ -368,7 +368,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) { /// assembly code for a MachineFunction to the given output stream, using /// the given target machine description. /// -FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createIA64CodePrinterPass(formatted_raw_ostream &o, IA64TargetMachine &tm, bool verbose) { return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/IA64/IA64.h b/lib/Target/IA64/IA64.h index 9c758fd..afcbdaf 100644 --- a/lib/Target/IA64/IA64.h +++ b/lib/Target/IA64/IA64.h @@ -20,7 +20,7 @@ namespace llvm { class IA64TargetMachine; class FunctionPass; -class raw_ostream; +class formatted_raw_ostream; /// createIA64DAGToDAGInstructionSelector - This pass converts an LLVM /// function into IA64 machine code in a sane, DAG->DAG transform. @@ -37,7 +37,7 @@ FunctionPass *createIA64BundlingPass(IA64TargetMachine &TM); /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *createIA64CodePrinterPass(raw_ostream &o, +FunctionPass *createIA64CodePrinterPass(formatted_raw_ostream &o, IA64TargetMachine &tm, bool verbose); diff --git a/lib/Target/IA64/IA64TargetMachine.cpp b/lib/Target/IA64/IA64TargetMachine.cpp index 71a0a98..00fdd5e 100644 --- a/lib/Target/IA64/IA64TargetMachine.cpp +++ b/lib/Target/IA64/IA64TargetMachine.cpp @@ -87,7 +87,7 @@ bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM, bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) diff --git a/lib/Target/IA64/IA64TargetMachine.h b/lib/Target/IA64/IA64TargetMachine.h index 402d833..8340052 100644 --- a/lib/Target/IA64/IA64TargetMachine.h +++ b/lib/Target/IA64/IA64TargetMachine.h @@ -36,7 +36,7 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, IA64TargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -62,7 +62,7 @@ public: virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); static void registerAsmPrinter(AsmPrinterCtorFn F) { AsmPrinterCtor = F; diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index b1239a2..2ae1d4f 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -35,7 +35,8 @@ namespace { : DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } - virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out, + virtual bool addPassesToEmitWholeFile(PassManager &PM, + formatted_raw_ostream &Out, CodeGenFileType FileType, CodeGenOpt::Level OptLevel); @@ -1702,7 +1703,8 @@ void MSILWriter::printExternals() { // External Interface declaration //===----------------------------------------------------------------------===// -bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM, raw_ostream &o, +bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM, + formatted_raw_ostream &o, CodeGenFileType FileType, CodeGenOpt::Level OptLevel) { diff --git a/lib/Target/MSIL/MSILWriter.h b/lib/Target/MSIL/MSILWriter.h index ea0dfad..cbb2d31 100644 --- a/lib/Target/MSIL/MSILWriter.h +++ b/lib/Target/MSIL/MSILWriter.h @@ -21,8 +21,8 @@ #include "llvm/PassManager.h" #include "llvm/Analysis/FindUsedTypes.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachineRegistry.h" @@ -75,7 +75,7 @@ namespace { } public: - raw_ostream &Out; + formatted_raw_ostream &Out; Module* ModulePtr; const TargetData* TD; Mangler* Mang; @@ -85,11 +85,15 @@ namespace { StaticInitList; const std::set* UsedTypes; static char ID; +<<<<<<< .mine + MSILWriter(formatted_raw_ostream &o) : FunctionPass(&ID), Out(o) { +======= DenseMap AnonValueNumbers; unsigned NextAnonValueNumber; MSILWriter(raw_ostream &o) : FunctionPass(&ID), Out(o), NextAnonValueNumber(0) { +>>>>>>> .r75668 UniqID = 0; } diff --git a/lib/Target/MSP430/MSP430.h b/lib/Target/MSP430/MSP430.h index fc13c9e..0562832 100644 --- a/lib/Target/MSP430/MSP430.h +++ b/lib/Target/MSP430/MSP430.h @@ -20,11 +20,11 @@ namespace llvm { class MSP430TargetMachine; class FunctionPass; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM, CodeGenOpt::Level OptLevel); - FunctionPass *createMSP430CodePrinterPass(raw_ostream &o, + FunctionPass *createMSP430CodePrinterPass(formatted_raw_ostream &o, MSP430TargetMachine &tm, bool verbose); } // end namespace llvm; diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp index c92824a..68cfe40 100644 --- a/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -29,8 +29,8 @@ #include "llvm/Target/TargetData.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/Mangler.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -40,7 +40,7 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter { public: - MSP430AsmPrinter(raw_ostream &O, MSP430TargetMachine &TM, + MSP430AsmPrinter(formatted_raw_ostream &O, MSP430TargetMachine &TM, const TargetAsmInfo *TAI, bool V) : AsmPrinter(O, TM, TAI, V) {} @@ -75,7 +75,7 @@ namespace { /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *llvm::createMSP430CodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createMSP430CodePrinterPass(formatted_raw_ostream &o, MSP430TargetMachine &tm, bool verbose) { return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp index dd09d43..924c7e8 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.cpp +++ b/lib/Target/MSP430/MSP430TargetMachine.cpp @@ -60,7 +60,7 @@ bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM, bool MSP430TargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { // Output assembly language. PM.add(createMSP430CodePrinterPass(Out, *this, Verbose)); return false; diff --git a/lib/Target/MSP430/MSP430TargetMachine.h b/lib/Target/MSP430/MSP430TargetMachine.h index d9ffa2b..0a5c64e 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.h +++ b/lib/Target/MSP430/MSP430TargetMachine.h @@ -59,7 +59,7 @@ public: virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out); + formatted_raw_ostream &Out); static unsigned getModuleMatchQuality(const Module &M); }; // MSP430TargetMachine. diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 55f3378..719c2586 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -39,8 +39,8 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/raw_ostream.h" #include using namespace llvm; @@ -51,7 +51,7 @@ namespace { class VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter { const MipsSubtarget *Subtarget; public: - explicit MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM, + explicit MipsAsmPrinter(formatted_raw_ostream &O, MipsTargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V) { Subtarget = &TM.getSubtarget(); @@ -91,7 +91,7 @@ namespace { /// assembly code for a MachineFunction to the given output stream, /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. -FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createMipsCodePrinterPass(formatted_raw_ostream &o, MipsTargetMachine &tm, bool verbose) { return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/Mips/Mips.h b/lib/Target/Mips/Mips.h index 9b22a91..c1d6fdd 100644 --- a/lib/Target/Mips/Mips.h +++ b/lib/Target/Mips/Mips.h @@ -21,11 +21,11 @@ namespace llvm { class MipsTargetMachine; class FunctionPass; class MachineCodeEmitter; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createMipsISelDag(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); - FunctionPass *createMipsCodePrinterPass(raw_ostream &OS, + FunctionPass *createMipsCodePrinterPass(formatted_raw_ostream &OS, MipsTargetMachine &TM, bool Verbose); } // end namespace llvm; diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index 4675536..1e6add4 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -131,7 +131,7 @@ addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel) // true if AssemblyEmitter is supported bool MipsTargetMachine:: addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out) { + bool Verbose, formatted_raw_ostream &Out) { // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); PM.add(AsmPrinterCtor(Out, *this, Verbose)); diff --git a/lib/Target/Mips/MipsTargetMachine.h b/lib/Target/Mips/MipsTargetMachine.h index 95e5be4..7dd8d2b 100644 --- a/lib/Target/Mips/MipsTargetMachine.h +++ b/lib/Target/Mips/MipsTargetMachine.h @@ -22,7 +22,7 @@ #include "llvm/Target/TargetFrameInfo.h" namespace llvm { - class raw_ostream; + class formatted_raw_ostream; class MipsTargetMachine : public LLVMTargetMachine { MipsSubtarget Subtarget; @@ -37,7 +37,7 @@ namespace llvm { // To avoid having target depend on the asmprinter stuff libraries, // asmprinter set this functions to ctor pointer at startup time if they are // linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, MipsTargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -75,7 +75,7 @@ namespace llvm { CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); }; /// MipselTargetMachine - Mipsel target machine. diff --git a/lib/Target/PIC16/PIC16.h b/lib/Target/PIC16/PIC16.h index 3b6fcee..0184b90 100644 --- a/lib/Target/PIC16/PIC16.h +++ b/lib/Target/PIC16/PIC16.h @@ -27,7 +27,7 @@ namespace llvm { class PIC16TargetMachine; class FunctionPass; class MachineCodeEmitter; - class raw_ostream; + class formatted_raw_ostream; namespace PIC16CC { enum CondCodes { @@ -343,7 +343,7 @@ namespace PIC16CC { FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); - FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, + FunctionPass *createPIC16CodePrinterPass(formatted_raw_ostream &OS, PIC16TargetMachine &TM, bool Verbose); // Banksel optimzer pass. diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp index 61d295c..ebfa3cb 100644 --- a/lib/Target/PIC16/PIC16AsmPrinter.cpp +++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp @@ -18,8 +18,8 @@ #include "llvm/Function.h" #include "llvm/Module.h" #include "llvm/CodeGen/DwarfWriter.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/CodeGen/DwarfWriter.h" @@ -112,7 +112,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createPIC16CodePrinterPass(formatted_raw_ostream &o, PIC16TargetMachine &tm, bool verbose) { return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/PIC16/PIC16AsmPrinter.h b/lib/Target/PIC16/PIC16AsmPrinter.h index cb11687..4e854ed 100644 --- a/lib/Target/PIC16/PIC16AsmPrinter.h +++ b/lib/Target/PIC16/PIC16AsmPrinter.h @@ -29,7 +29,7 @@ namespace llvm { struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { - explicit PIC16AsmPrinter(raw_ostream &O, PIC16TargetMachine &TM, + explicit PIC16AsmPrinter(formatted_raw_ostream &O, PIC16TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V), DbgInfo(O, T) { PTLI = TM.getTargetLowering(); diff --git a/lib/Target/PIC16/PIC16DebugInfo.cpp b/lib/Target/PIC16/PIC16DebugInfo.cpp index 1766fde..56359b3 100644 --- a/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -16,7 +16,7 @@ #include "llvm/GlobalVariable.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Support/DebugLoc.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" using namespace llvm; diff --git a/lib/Target/PIC16/PIC16DebugInfo.h b/lib/Target/PIC16/PIC16DebugInfo.h index d126d85..b1360fb 100644 --- a/lib/Target/PIC16/PIC16DebugInfo.h +++ b/lib/Target/PIC16/PIC16DebugInfo.h @@ -90,10 +90,10 @@ namespace llvm { }; } - class raw_ostream; + class formatted_raw_ostream; class PIC16DbgInfo { - raw_ostream &O; + formatted_raw_ostream &O; const TargetAsmInfo *TAI; std::string CurFile; unsigned CurLine; @@ -103,7 +103,8 @@ namespace llvm { bool EmitDebugDirectives; public: - PIC16DbgInfo(raw_ostream &o, const TargetAsmInfo *T) : O(o), TAI(T) { + PIC16DbgInfo(formatted_raw_ostream &o, const TargetAsmInfo *T) + : O(o), TAI(T) { CurFile = ""; CurLine = 0; EmitDebugDirectives = false; diff --git a/lib/Target/PIC16/PIC16TargetMachine.cpp b/lib/Target/PIC16/PIC16TargetMachine.cpp index 77ad188..50deab1 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.cpp +++ b/lib/Target/PIC16/PIC16TargetMachine.cpp @@ -67,7 +67,8 @@ bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM, bool PIC16TargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out) { + bool Verbose, + formatted_raw_ostream &Out) { // Output assembly language. PM.add(createPIC16CodePrinterPass(Out, *this, Verbose)); return false; diff --git a/lib/Target/PIC16/PIC16TargetMachine.h b/lib/Target/PIC16/PIC16TargetMachine.h index 7f62d5c..a0080df 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.h +++ b/lib/Target/PIC16/PIC16TargetMachine.h @@ -61,7 +61,7 @@ public: CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel); }; // PIC16TargetMachine. diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index e86c7c3..37f0fdb 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -38,7 +38,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Compiler.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" @@ -56,7 +56,7 @@ namespace { StringSet<> FnStubs, GVStubs, HiddenGVStubs; const PPCSubtarget &Subtarget; public: - explicit PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, + explicit PPCAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V), Subtarget(TM.getSubtarget()) {} @@ -294,7 +294,7 @@ namespace { /// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { public: - explicit PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, + explicit PPCLinuxAsmPrinter(formatted_raw_ostream &O, PPCTargetMachine &TM, const TargetAsmInfo *T, bool V) : PPCAsmPrinter(O, TM, T, V){} @@ -318,9 +318,9 @@ namespace { /// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac /// OS X class VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter { - raw_ostream &OS; + formatted_raw_ostream &OS; public: - explicit PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, + explicit PPCDarwinAsmPrinter(formatted_raw_ostream &O, PPCTargetMachine &TM, const TargetAsmInfo *T, bool V) : PPCAsmPrinter(O, TM, T, V), OS(O) {} @@ -629,7 +629,7 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { /// PrintUnmangledNameSafely - Print out the printable characters in the name. /// Don't print things like \\n or \\0. -static void PrintUnmangledNameSafely(const Value *V, raw_ostream &OS) { +static void PrintUnmangledNameSafely(const Value *V, formatted_raw_ostream &OS) { for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen(); Name != E; ++Name) if (isprint(*Name)) @@ -1108,7 +1108,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) { /// for a MachineFunction to the given output stream, in a format that the /// Darwin assembler can deal with. /// -FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o, +FunctionPass *llvm::createPPCAsmPrinterPass(formatted_raw_ostream &o, PPCTargetMachine &tm, bool verbose) { const PPCSubtarget *Subtarget = &tm.getSubtarget(); diff --git a/lib/Target/PowerPC/PPC.h b/lib/Target/PowerPC/PPC.h index b364e3f..89dc1c1 100644 --- a/lib/Target/PowerPC/PPC.h +++ b/lib/Target/PowerPC/PPC.h @@ -25,11 +25,12 @@ namespace llvm { class FunctionPass; class MachineCodeEmitter; class ObjectCodeEmitter; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); -FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, PPCTargetMachine &TM, +FunctionPass *createPPCAsmPrinterPass(formatted_raw_ostream &OS, + PPCTargetMachine &TM, bool Verbose); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 6e30df4..f1adc35 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -18,7 +18,7 @@ #include "llvm/PassManager.h" #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" using namespace llvm; /// PowerPCTargetMachineModule - Note that this is used on hosts that @@ -149,7 +149,7 @@ bool PPCTargetMachine::addPreEmitPass(PassManagerBase &PM, bool PPCTargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) PM.add(AsmPrinterCtor(Out, *this, Verbose)); @@ -183,7 +183,7 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -215,7 +215,7 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -247,7 +247,7 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -262,7 +262,7 @@ bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -277,7 +277,7 @@ bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -292,7 +292,7 @@ bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; diff --git a/lib/Target/PowerPC/PPCTargetMachine.h b/lib/Target/PowerPC/PPCTargetMachine.h index 9f5ff57..e6f6102 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.h +++ b/lib/Target/PowerPC/PPCTargetMachine.h @@ -44,7 +44,7 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, PPCTargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -80,7 +80,7 @@ public: virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool DumpAsm, MachineCodeEmitter &MCE); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index 024e692..c580285 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -27,8 +27,8 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/Mangler.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" @@ -50,7 +50,7 @@ namespace { ValueMapTy NumberForBB; unsigned BBNumber; public: - explicit SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, + explicit SparcAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V), BBNumber(0) {} @@ -82,7 +82,7 @@ namespace { /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createSparcCodePrinterPass(formatted_raw_ostream &o, TargetMachine &tm, bool verbose) { return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); diff --git a/lib/Target/Sparc/Sparc.h b/lib/Target/Sparc/Sparc.h index 82bc7e7..b1981eb 100644 --- a/lib/Target/Sparc/Sparc.h +++ b/lib/Target/Sparc/Sparc.h @@ -22,10 +22,11 @@ namespace llvm { class FunctionPass; class SparcTargetMachine; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createSparcISelDag(SparcTargetMachine &TM); - FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM, + FunctionPass *createSparcCodePrinterPass(formatted_raw_ostream &OS, + TargetMachine &TM, bool Verbose); FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); FunctionPass *createSparcFPMoverPass(TargetMachine &TM); diff --git a/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 1343bcc..66d5497 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/lib/Target/Sparc/SparcTargetMachine.cpp @@ -86,7 +86,7 @@ bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM, bool SparcTargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) diff --git a/lib/Target/Sparc/SparcTargetMachine.h b/lib/Target/Sparc/SparcTargetMachine.h index ee55d3c..5da4a78 100644 --- a/lib/Target/Sparc/SparcTargetMachine.h +++ b/lib/Target/Sparc/SparcTargetMachine.h @@ -37,7 +37,7 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, TargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -62,7 +62,7 @@ public: virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); static void registerAsmPrinter(AsmPrinterCtorFn F) { AsmPrinterCtor = F; diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index a567a8f..1257af5 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -34,8 +34,8 @@ #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/Mangler.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" using namespace llvm; @@ -60,7 +60,8 @@ void X86ATTAsmPrinter::PrintPICBaseSymbol() const { /// PrintUnmangledNameSafely - Print out the printable characters in the name. /// Don't print things like \\n or \\0. -static void PrintUnmangledNameSafely(const Value *V, raw_ostream &OS) { +static void PrintUnmangledNameSafely(const Value *V, + formatted_raw_ostream &OS) { for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen(); Name != E; ++Name) if (isprint(*Name)) diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h index 2ab63dc..9382d59 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h @@ -37,7 +37,7 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { MCContext *Context; MCStreamer *Streamer; public: - explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM, + explicit X86ATTAsmPrinter(formatted_raw_ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V) { Subtarget = &TM.getSubtarget(); diff --git a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp index e0fa83a..2324479 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp @@ -17,7 +17,7 @@ #include "X86ATTAsmPrinter.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" using namespace llvm; // Include the auto-generated portion of the assembly writer. diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index e5d80a4..40b24f3 100644 --- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -23,7 +23,7 @@ using namespace llvm; /// for a MachineFunction to the given output stream, using the given target /// machine description. /// -FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createX86CodePrinterPass(formatted_raw_ostream &o, X86TargetMachine &tm, bool verbose) { const X86Subtarget *Subtarget = &tm.getSubtarget(); diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h index a724c3c..8872869 100644 --- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h +++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h @@ -20,12 +20,12 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/Compiler.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" namespace llvm { struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { - explicit X86IntelAsmPrinter(raw_ostream &O, X86TargetMachine &TM, + explicit X86IntelAsmPrinter(formatted_raw_ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V) {} diff --git a/lib/Target/X86/X86.h b/lib/Target/X86/X86.h index 9b1fced..ead4ce1 100644 --- a/lib/Target/X86/X86.h +++ b/lib/Target/X86/X86.h @@ -23,7 +23,7 @@ class X86TargetMachine; class FunctionPass; class MachineCodeEmitter; class JITCodeEmitter; -class raw_ostream; +class formatted_raw_ostream; /// createX86ISelDag - This pass converts a legalized DAG into a /// X86-specific DAG, ready for instruction scheduling. @@ -46,7 +46,8 @@ FunctionPass *createX87FPRegKillInserterPass(); /// assembly code for a MachineFunction to the given output stream, /// using the given target machine description. /// -FunctionPass *createX86CodePrinterPass(raw_ostream &o, X86TargetMachine &tm, +FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o, + X86TargetMachine &tm, bool Verbose); /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 92a98a0..344370e 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -18,7 +18,7 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" using namespace llvm; @@ -237,7 +237,7 @@ bool X86TargetMachine::addPostRegAlloc(PassManagerBase &PM, bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) PM.add(AsmPrinterCtor(Out, *this, Verbose)); @@ -270,7 +270,7 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -302,7 +302,7 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -316,7 +316,7 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -330,7 +330,7 @@ bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -344,7 +344,7 @@ bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; @@ -358,7 +358,7 @@ bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, true)); + PM.add(AsmPrinterCtor(ferrs(), *this, true)); } return false; diff --git a/lib/Target/X86/X86TargetMachine.h b/lib/Target/X86/X86TargetMachine.h index f38a469..ea7a453 100644 --- a/lib/Target/X86/X86TargetMachine.h +++ b/lib/Target/X86/X86TargetMachine.h @@ -26,7 +26,7 @@ namespace llvm { -class raw_ostream; +class formatted_raw_ostream; class X86TargetMachine : public LLVMTargetMachine { X86Subtarget Subtarget; @@ -43,7 +43,7 @@ protected: // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. - typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, + typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o, X86TargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; @@ -79,7 +79,7 @@ public: virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool DumpAsm, MachineCodeEmitter &MCE); virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, diff --git a/lib/Target/XCore/XCore.h b/lib/Target/XCore/XCore.h index d95aab3..abc69b7 100644 --- a/lib/Target/XCore/XCore.h +++ b/lib/Target/XCore/XCore.h @@ -21,10 +21,10 @@ namespace llvm { class FunctionPass; class TargetMachine; class XCoreTargetMachine; - class raw_ostream; + class formatted_raw_ostream; FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); - FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS, + FunctionPass *createXCoreCodePrinterPass(formatted_raw_ostream &OS, XCoreTargetMachine &TM, bool Verbose); } // end namespace llvm; diff --git a/lib/Target/XCore/XCoreAsmPrinter.cpp b/lib/Target/XCore/XCoreAsmPrinter.cpp index 5beefe6..6256c8a 100644 --- a/lib/Target/XCore/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/XCoreAsmPrinter.cpp @@ -33,8 +33,8 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/raw_ostream.h" #include #include using namespace llvm; @@ -58,7 +58,7 @@ namespace { DwarfWriter *DW; const XCoreSubtarget &Subtarget; public: - explicit XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, + explicit XCoreAsmPrinter(formatted_raw_ostream &O, XCoreTargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V), DW(0), Subtarget(*TM.getSubtargetImpl()) {} @@ -104,7 +104,7 @@ namespace { /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, +FunctionPass *llvm::createXCoreCodePrinterPass(formatted_raw_ostream &o, XCoreTargetMachine &tm, bool verbose) { return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); @@ -112,7 +112,8 @@ FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, // PrintEscapedString - Print each character of the specified string, escaping // it if it is not printable or if it is an escape char. -static void PrintEscapedString(const std::string &Str, raw_ostream &Out) { +static void PrintEscapedString(const std::string &Str, + formatted_raw_ostream &Out) { for (unsigned i = 0, e = Str.size(); i != e; ++i) { unsigned char C = Str[i]; if (isprint(C) && C != '"' && C != '\\') { diff --git a/lib/Target/XCore/XCoreTargetMachine.cpp b/lib/Target/XCore/XCoreTargetMachine.cpp index b72225f..42b9875 100644 --- a/lib/Target/XCore/XCoreTargetMachine.cpp +++ b/lib/Target/XCore/XCoreTargetMachine.cpp @@ -67,7 +67,7 @@ bool XCoreTargetMachine::addInstSelector(PassManagerBase &PM, bool XCoreTargetMachine::addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, bool Verbose, - raw_ostream &Out) { + formatted_raw_ostream &Out) { // Output assembly language. PM.add(createXCoreCodePrinterPass(Out, *this, Verbose)); return false; diff --git a/lib/Target/XCore/XCoreTargetMachine.h b/lib/Target/XCore/XCoreTargetMachine.h index 2385aed..081cf7a 100644 --- a/lib/Target/XCore/XCoreTargetMachine.h +++ b/lib/Target/XCore/XCoreTargetMachine.h @@ -55,7 +55,7 @@ public: virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out); + bool Verbose, formatted_raw_ostream &Out); }; } // end namespace llvm -- cgit v1.1