mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-10 16:24:04 +00:00
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
This commit is contained in:
parent
a266b5f228
commit
71847813bc
@ -40,7 +40,7 @@ namespace llvm {
|
|||||||
class Section;
|
class Section;
|
||||||
class TargetAsmInfo;
|
class TargetAsmInfo;
|
||||||
class Type;
|
class Type;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
/// AsmPrinter - This class is intended to be used as a driving class for all
|
/// AsmPrinter - This class is intended to be used as a driving class for all
|
||||||
/// asm writers.
|
/// asm writers.
|
||||||
@ -69,7 +69,7 @@ namespace llvm {
|
|||||||
public:
|
public:
|
||||||
/// Output stream on which we're printing assembly code.
|
/// Output stream on which we're printing assembly code.
|
||||||
///
|
///
|
||||||
raw_ostream &O;
|
formatted_raw_ostream &O;
|
||||||
|
|
||||||
/// Target machine description.
|
/// Target machine description.
|
||||||
///
|
///
|
||||||
@ -118,7 +118,7 @@ namespace llvm {
|
|||||||
mutable DebugLocTuple PrevDLT;
|
mutable DebugLocTuple PrevDLT;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit AsmPrinter(raw_ostream &o, TargetMachine &TM,
|
explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V);
|
const TargetAsmInfo *T, bool V);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -23,10 +23,23 @@ namespace llvm
|
|||||||
/// asm-specific constructs.
|
/// asm-specific constructs.
|
||||||
///
|
///
|
||||||
class formatted_raw_ostream : public raw_ostream {
|
class formatted_raw_ostream : public raw_ostream {
|
||||||
|
public:
|
||||||
|
/// DELETE_STREAM - Tell the destructor to delete the held stream.
|
||||||
|
///
|
||||||
|
const static bool DELETE_STREAM = true;
|
||||||
|
/// PRESERVE_STREAM - Tell the destructor to not delete the held
|
||||||
|
/// stream.
|
||||||
|
///
|
||||||
|
const static bool PRESERVE_STREAM = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// TheStream - The real stream we output to.
|
/// TheStream - The real stream we output to.
|
||||||
///
|
///
|
||||||
raw_ostream &TheStream;
|
raw_ostream &TheStream;
|
||||||
|
/// DeleteStream - Do we need to delete TheStream in the
|
||||||
|
/// destructor?
|
||||||
|
///
|
||||||
|
bool DeleteStream;
|
||||||
|
|
||||||
/// Column - The current output column of the stream. The column
|
/// Column - The current output column of the stream. The column
|
||||||
/// scheme is zero-based.
|
/// scheme is zero-based.
|
||||||
@ -61,8 +74,13 @@ namespace llvm
|
|||||||
/// stream will use stdout instead.
|
/// stream will use stdout instead.
|
||||||
/// \param Binary - The file should be opened in binary mode on
|
/// \param Binary - The file should be opened in binary mode on
|
||||||
/// platforms that support this distinction.
|
/// platforms that support this distinction.
|
||||||
formatted_raw_ostream(raw_ostream &Stream)
|
formatted_raw_ostream(raw_ostream &Stream, bool Delete = false)
|
||||||
: raw_ostream(), TheStream(Stream), Column(0) {}
|
: raw_ostream(), TheStream(Stream), DeleteStream(Delete), Column(0) {}
|
||||||
|
|
||||||
|
~formatted_raw_ostream() {
|
||||||
|
if (DeleteStream)
|
||||||
|
delete &TheStream;
|
||||||
|
}
|
||||||
|
|
||||||
/// PadToColumn - Align the output to some column number.
|
/// PadToColumn - Align the output to some column number.
|
||||||
///
|
///
|
||||||
@ -72,6 +90,16 @@ namespace llvm
|
|||||||
///
|
///
|
||||||
void PadToColumn(unsigned NewCol, unsigned MinPad = 0);
|
void PadToColumn(unsigned NewCol, unsigned MinPad = 0);
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
/// fouts() - This returns a reference to a formatted_raw_ostream for
|
||||||
|
/// standard output. Use it like: fouts() << "foo" << "bar";
|
||||||
|
formatted_raw_ostream &fouts();
|
||||||
|
|
||||||
|
/// ferrs() - This returns a reference to a formatted_raw_ostream for
|
||||||
|
/// standard error. Use it like: ferrs() << "foo" << "bar";
|
||||||
|
formatted_raw_ostream &ferrs();
|
||||||
|
|
||||||
|
} // end llvm namespace
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,7 +37,7 @@ class PassManager;
|
|||||||
class Pass;
|
class Pass;
|
||||||
class TargetMachOWriterInfo;
|
class TargetMachOWriterInfo;
|
||||||
class TargetELFWriterInfo;
|
class TargetELFWriterInfo;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
// Relocation model types.
|
// Relocation model types.
|
||||||
namespace Reloc {
|
namespace Reloc {
|
||||||
@ -232,7 +232,7 @@ public:
|
|||||||
/// is not supported.
|
/// is not supported.
|
||||||
///
|
///
|
||||||
virtual FileModel::Model addPassesToEmitFile(PassManagerBase &,
|
virtual FileModel::Model addPassesToEmitFile(PassManagerBase &,
|
||||||
raw_ostream &,
|
formatted_raw_ostream &,
|
||||||
CodeGenFileType,
|
CodeGenFileType,
|
||||||
CodeGenOpt::Level) {
|
CodeGenOpt::Level) {
|
||||||
return FileModel::None;
|
return FileModel::None;
|
||||||
@ -296,7 +296,7 @@ public:
|
|||||||
/// require having the entire module at once. This is not recommended, do not
|
/// require having the entire module at once. This is not recommended, do not
|
||||||
/// use this.
|
/// use this.
|
||||||
virtual bool WantsWholeFile() const { return false; }
|
virtual bool WantsWholeFile() const { return false; }
|
||||||
virtual bool addPassesToEmitWholeFile(PassManager &, raw_ostream &,
|
virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &,
|
||||||
CodeGenFileType,
|
CodeGenFileType,
|
||||||
CodeGenOpt::Level) {
|
CodeGenOpt::Level) {
|
||||||
return true;
|
return true;
|
||||||
@ -329,7 +329,7 @@ public:
|
|||||||
/// target-specific passes in standard locations.
|
/// target-specific passes in standard locations.
|
||||||
///
|
///
|
||||||
virtual FileModel::Model addPassesToEmitFile(PassManagerBase &PM,
|
virtual FileModel::Model addPassesToEmitFile(PassManagerBase &PM,
|
||||||
raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level);
|
CodeGenOpt::Level);
|
||||||
|
|
||||||
@ -413,7 +413,8 @@ public:
|
|||||||
/// the asmprinter, if asm emission is supported. If this is not supported,
|
/// the asmprinter, if asm emission is supported. If this is not supported,
|
||||||
/// 'true' should be returned.
|
/// 'true' should be returned.
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &, CodeGenOpt::Level,
|
virtual bool addAssemblyEmitter(PassManagerBase &, CodeGenOpt::Level,
|
||||||
bool /* VerboseAsmDefault */, raw_ostream &) {
|
bool /* VerboseAsmDefault */,
|
||||||
|
formatted_raw_ostream &) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetLowering.h"
|
#include "llvm/Target/TargetLowering.h"
|
||||||
@ -43,7 +43,7 @@ AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
|
|||||||
cl::init(cl::BOU_UNSET));
|
cl::init(cl::BOU_UNSET));
|
||||||
|
|
||||||
char AsmPrinter::ID = 0;
|
char AsmPrinter::ID = 0;
|
||||||
AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm,
|
AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
|
||||||
const TargetAsmInfo *T, bool VDef)
|
const TargetAsmInfo *T, bool VDef)
|
||||||
: MachineFunctionPass(&ID), FunctionNumber(0), O(o),
|
: MachineFunctionPass(&ID), FunctionNumber(0), O(o),
|
||||||
TM(tm), TAI(T), TRI(tm.getRegisterInfo()),
|
TM(tm), TAI(T), TRI(tm.getRegisterInfo()),
|
||||||
@ -736,7 +736,7 @@ static inline char toOctal(int X) {
|
|||||||
|
|
||||||
/// printStringChar - Print a char, escaped if necessary.
|
/// printStringChar - Print a char, escaped if necessary.
|
||||||
///
|
///
|
||||||
static void printStringChar(raw_ostream &O, unsigned char C) {
|
static void printStringChar(formatted_raw_ostream &O, unsigned char C) {
|
||||||
if (C == '"') {
|
if (C == '"') {
|
||||||
O << "\\\"";
|
O << "\\\"";
|
||||||
} else if (C == '\\') {
|
} else if (C == '\\') {
|
||||||
@ -978,7 +978,7 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
|
|||||||
/// printAsCString - Print the specified array as a C compatible string, only if
|
/// printAsCString - Print the specified array as a C compatible string, only if
|
||||||
/// the predicate isString is true.
|
/// the predicate isString is true.
|
||||||
///
|
///
|
||||||
static void printAsCString(raw_ostream &O, const ConstantArray *CVA,
|
static void printAsCString(formatted_raw_ostream &O, const ConstantArray *CVA,
|
||||||
unsigned LastElt) {
|
unsigned LastElt) {
|
||||||
assert(CVA->isString() && "Array is not string compatible!");
|
assert(CVA->isString() && "Array is not string compatible!");
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -56,7 +56,7 @@ EnableFastISelOption("fast-isel", cl::Hidden,
|
|||||||
|
|
||||||
FileModel::Model
|
FileModel::Model
|
||||||
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||||
raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel) {
|
||||||
// Add common CodeGen passes.
|
// Add common CodeGen passes.
|
||||||
|
@ -55,3 +55,16 @@ void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// fouts() - This returns a reference to a formatted_raw_ostream for
|
||||||
|
/// standard output. Use it like: fouts() << "foo" << "bar";
|
||||||
|
formatted_raw_ostream &llvm::fouts() {
|
||||||
|
static formatted_raw_ostream S(outs());
|
||||||
|
return S;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ferrs() - This returns a reference to a formatted_raw_ostream for
|
||||||
|
/// standard error. Use it like: ferrs() << "foo" << "bar";
|
||||||
|
formatted_raw_ostream &llvm::ferrs() {
|
||||||
|
static formatted_raw_ostream S(errs());
|
||||||
|
return S;
|
||||||
|
}
|
||||||
|
@ -166,7 +166,7 @@ raw_ostream &raw_ostream::write(const char *Ptr, unsigned Size) {
|
|||||||
case 0: break;
|
case 0: break;
|
||||||
default:
|
default:
|
||||||
// Normally the string to emit is shorter than the buffer.
|
// Normally the string to emit is shorter than the buffer.
|
||||||
if (Size <= unsigned(OutBufEnd-OutBufStart)) {
|
if (Size <= unsigned(OutBufEnd-OutBufCur)) {
|
||||||
memcpy(OutBufCur, Ptr, Size);
|
memcpy(OutBufCur, Ptr, Size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class FunctionPass;
|
|||||||
class MachineCodeEmitter;
|
class MachineCodeEmitter;
|
||||||
class JITCodeEmitter;
|
class JITCodeEmitter;
|
||||||
class ObjectCodeEmitter;
|
class ObjectCodeEmitter;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
// Enums corresponding to ARM condition codes
|
// Enums corresponding to ARM condition codes
|
||||||
namespace ARMCC {
|
namespace ARMCC {
|
||||||
@ -93,7 +93,7 @@ inline static const char *ARMCondCodeToString(ARMCC::CondCodes CC) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM);
|
FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM);
|
||||||
FunctionPass *createARMCodePrinterPass(raw_ostream &O,
|
FunctionPass *createARMCodePrinterPass(formatted_raw_ostream &O,
|
||||||
ARMBaseTargetMachine &TM,
|
ARMBaseTargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM,
|
FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM,
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/CodeGen/Passes.h"
|
#include "llvm/CodeGen/Passes.h"
|
||||||
#include "llvm/Support/CommandLine.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/TargetMachineRegistry.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -183,7 +183,7 @@ bool ARMBaseTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|||||||
bool ARMBaseTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool ARMBaseTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
@ -206,7 +206,7 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -225,7 +225,7 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -244,7 +244,7 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -259,7 +259,7 @@ bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -274,7 +274,7 @@ bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -289,7 +289,7 @@ bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -41,7 +41,7 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
ARMBaseTargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ namespace {
|
|||||||
/// True if asm printer is printing a series of CONSTPOOL_ENTRY.
|
/// True if asm printer is printing a series of CONSTPOOL_ENTRY.
|
||||||
bool InCPMode;
|
bool InCPMode;
|
||||||
public:
|
public:
|
||||||
explicit ARMAsmPrinter(raw_ostream &O, TargetMachine &TM,
|
explicit ARMAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V), DW(0), AFI(NULL), MCP(NULL),
|
: AsmPrinter(O, TM, T, V), DW(0), AFI(NULL), MCP(NULL),
|
||||||
InCPMode(false) {
|
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) {
|
const TargetAsmInfo *TAI) {
|
||||||
// Break it up into two parts that make up a shifter immediate.
|
// Break it up into two parts that make up a shifter immediate.
|
||||||
V = ARM_AM::getSOImmVal(V);
|
V = ARM_AM::getSOImmVal(V);
|
||||||
@ -1013,7 +1013,7 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
|
|||||||
|
|
||||||
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
|
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
|
||||||
/// Don't print things like \\n or \\0.
|
/// 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();
|
for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
|
||||||
Name != E; ++Name)
|
Name != E; ++Name)
|
||||||
if (isprint(*Name))
|
if (isprint(*Name))
|
||||||
@ -1253,7 +1253,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
|
|||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createARMCodePrinterPass(formatted_raw_ostream &o,
|
||||||
ARMBaseTargetMachine &tm,
|
ARMBaseTargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -23,10 +23,10 @@ namespace llvm {
|
|||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class MachineCodeEmitter;
|
class MachineCodeEmitter;
|
||||||
class ObjectCodeEmitter;
|
class ObjectCodeEmitter;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM);
|
FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM);
|
||||||
FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS,
|
FunctionPass *createAlphaCodePrinterPass(formatted_raw_ostream &OS,
|
||||||
TargetMachine &TM,
|
TargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM);
|
FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Target/TargetMachineRegistry.h"
|
#include "llvm/Target/TargetMachineRegistry.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|||||||
bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
PM.add(createAlphaLLRPPass(*this));
|
PM.add(createAlphaLLRPPass(*this));
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
@ -104,7 +104,7 @@ bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ protected:
|
|||||||
|
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
TargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -69,7 +69,7 @@ public:
|
|||||||
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ namespace {
|
|||||||
/// Unique incrementer for label values for referencing Global values.
|
/// 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)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(o, tm, T, V) {}
|
: AsmPrinter(o, tm, T, V) {}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace {
|
|||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createAlphaCodePrinterPass(formatted_raw_ostream &o,
|
||||||
TargetMachine &tm,
|
TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -36,11 +36,11 @@
|
|||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
@ -89,7 +89,7 @@ namespace {
|
|||||||
/// CWriter - This class is the main chunk of code that converts an LLVM
|
/// CWriter - This class is the main chunk of code that converts an LLVM
|
||||||
/// module to a C translation unit.
|
/// module to a C translation unit.
|
||||||
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
||||||
raw_ostream &Out;
|
formatted_raw_ostream &Out;
|
||||||
IntrinsicLowering *IL;
|
IntrinsicLowering *IL;
|
||||||
Mangler *Mang;
|
Mangler *Mang;
|
||||||
LoopInfo *LI;
|
LoopInfo *LI;
|
||||||
@ -107,7 +107,7 @@ namespace {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
explicit CWriter(raw_ostream &o)
|
explicit CWriter(formatted_raw_ostream &o)
|
||||||
: FunctionPass(&ID), Out(o), IL(0), Mang(0), LI(0),
|
: FunctionPass(&ID), Out(o), IL(0), Mang(0), LI(0),
|
||||||
TheModule(0), TAsm(0), TD(0), OpaqueCounter(0), NextAnonValueNumber(0) {
|
TheModule(0), TAsm(0), TD(0), OpaqueCounter(0), NextAnonValueNumber(0) {
|
||||||
FPCounter = 0;
|
FPCounter = 0;
|
||||||
@ -152,7 +152,8 @@ namespace {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
raw_ostream &printType(raw_ostream &Out, const Type *Ty,
|
raw_ostream &printType(formatted_raw_ostream &Out,
|
||||||
|
const Type *Ty,
|
||||||
bool isSigned = false,
|
bool isSigned = false,
|
||||||
const std::string &VariableName = "",
|
const std::string &VariableName = "",
|
||||||
bool IgnoreName = false,
|
bool IgnoreName = false,
|
||||||
@ -162,14 +163,15 @@ namespace {
|
|||||||
const std::string &VariableName = "",
|
const std::string &VariableName = "",
|
||||||
bool IgnoreName = false,
|
bool IgnoreName = false,
|
||||||
const AttrListPtr &PAL = AttrListPtr());
|
const AttrListPtr &PAL = AttrListPtr());
|
||||||
raw_ostream &printSimpleType(raw_ostream &Out, const Type *Ty,
|
raw_ostream &printSimpleType(formatted_raw_ostream &Out,
|
||||||
|
const Type *Ty,
|
||||||
bool isSigned,
|
bool isSigned,
|
||||||
const std::string &NameSoFar = "");
|
const std::string &NameSoFar = "");
|
||||||
std::ostream &printSimpleType(std::ostream &Out, const Type *Ty,
|
std::ostream &printSimpleType(std::ostream &Out, const Type *Ty,
|
||||||
bool isSigned,
|
bool isSigned,
|
||||||
const std::string &NameSoFar = "");
|
const std::string &NameSoFar = "");
|
||||||
|
|
||||||
void printStructReturnPointerFunctionType(raw_ostream &Out,
|
void printStructReturnPointerFunctionType(formatted_raw_ostream &Out,
|
||||||
const AttrListPtr &PAL,
|
const AttrListPtr &PAL,
|
||||||
const PointerType *Ty);
|
const PointerType *Ty);
|
||||||
|
|
||||||
@ -435,7 +437,7 @@ bool CBackendNameAllUsedStructsAndMergeFunctions::runOnModule(Module &M) {
|
|||||||
/// printStructReturnPointerFunctionType - This is like printType for a struct
|
/// printStructReturnPointerFunctionType - This is like printType for a struct
|
||||||
/// return type, except, instead of printing the type as void (*)(Struct*, ...)
|
/// return type, except, instead of printing the type as void (*)(Struct*, ...)
|
||||||
/// print it as "Struct (*)(...)", for struct return functions.
|
/// 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 AttrListPtr &PAL,
|
||||||
const PointerType *TheTy) {
|
const PointerType *TheTy) {
|
||||||
const FunctionType *FTy = cast<FunctionType>(TheTy->getElementType());
|
const FunctionType *FTy = cast<FunctionType>(TheTy->getElementType());
|
||||||
@ -471,7 +473,8 @@ void CWriter::printStructReturnPointerFunctionType(raw_ostream &Out,
|
|||||||
}
|
}
|
||||||
|
|
||||||
raw_ostream &
|
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) {
|
const std::string &NameSoFar) {
|
||||||
assert((Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) &&
|
assert((Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) &&
|
||||||
"Invalid type for printSimpleType");
|
"Invalid type for printSimpleType");
|
||||||
@ -567,7 +570,8 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned,
|
|||||||
// Pass the Type* and the variable name and this prints out the variable
|
// Pass the Type* and the variable name and this prints out the variable
|
||||||
// declaration.
|
// declaration.
|
||||||
//
|
//
|
||||||
raw_ostream &CWriter::printType(raw_ostream &Out, const Type *Ty,
|
raw_ostream &CWriter::printType(formatted_raw_ostream &Out,
|
||||||
|
const Type *Ty,
|
||||||
bool isSigned, const std::string &NameSoFar,
|
bool isSigned, const std::string &NameSoFar,
|
||||||
bool IgnoreName, const AttrListPtr &PAL) {
|
bool IgnoreName, const AttrListPtr &PAL) {
|
||||||
if (Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) {
|
if (Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) {
|
||||||
@ -1640,7 +1644,7 @@ void CWriter::writeOperandWithCast(Value* Operand, const ICmpInst &Cmp) {
|
|||||||
// generateCompilerSpecificCode - This is where we add conditional compilation
|
// generateCompilerSpecificCode - This is where we add conditional compilation
|
||||||
// directives to cater to specific compilers as need be.
|
// 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) {
|
const TargetData *TD) {
|
||||||
// Alloca is hard to get, and we don't want to include stdlib.h here.
|
// Alloca is hard to get, and we don't want to include stdlib.h here.
|
||||||
Out << "/* get a declaration for alloca */\n"
|
Out << "/* get a declaration for alloca */\n"
|
||||||
@ -3626,7 +3630,7 @@ void CWriter::visitExtractValueInst(ExtractValueInst &EVI) {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
||||||
raw_ostream &o,
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel) {
|
||||||
if (FileType != TargetMachine::AssemblyFile) return true;
|
if (FileType != TargetMachine::AssemblyFile) return true;
|
||||||
|
@ -26,7 +26,8 @@ struct CTargetMachine : public TargetMachine {
|
|||||||
: DataLayout(&M) {}
|
: DataLayout(&M) {}
|
||||||
|
|
||||||
virtual bool WantsWholeFile() const { return true; }
|
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,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Compiler.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/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
@ -50,7 +50,7 @@ namespace {
|
|||||||
class VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter {
|
class VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter {
|
||||||
std::set<std::string> FnStubs, GVStubs;
|
std::set<std::string> FnStubs, GVStubs;
|
||||||
public:
|
public:
|
||||||
explicit SPUAsmPrinter(raw_ostream &O, TargetMachine &TM,
|
explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V) :
|
const TargetAsmInfo *T, bool V) :
|
||||||
AsmPrinter(O, TM, T, V) {}
|
AsmPrinter(O, TM, T, V) {}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ namespace {
|
|||||||
class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter {
|
class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter {
|
||||||
DwarfWriter *DW;
|
DwarfWriter *DW;
|
||||||
public:
|
public:
|
||||||
explicit LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM,
|
explicit LinuxAsmPrinter(formatted_raw_ostream &O, SPUTargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: SPUAsmPrinter(O, TM, T, V), DW(0) {}
|
: 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.
|
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
|
||||||
/// Don't print things like \\n or \\0.
|
/// 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();
|
for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
|
||||||
Name != E; ++Name)
|
Name != E; ++Name)
|
||||||
if (isprint(*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
|
/// assembly code for a MachineFunction to the given output stream, in a format
|
||||||
/// that the Linux SPU assembler can deal with.
|
/// that the Linux SPU assembler can deal with.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o,
|
||||||
SPUTargetMachine &tm,
|
SPUTargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class SPUTargetMachine;
|
class SPUTargetMachine;
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
|
FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
|
||||||
FunctionPass *createSPUAsmPrinterPass(raw_ostream &o,
|
FunctionPass *createSPUAsmPrinterPass(formatted_raw_ostream &o,
|
||||||
SPUTargetMachine &tm,
|
SPUTargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ SPUTargetMachine::addInstSelector(PassManagerBase &PM,
|
|||||||
bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
|
@ -41,7 +41,7 @@ protected:
|
|||||||
|
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
SPUTargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
|
|
||||||
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
||||||
AsmPrinterCtor = F;
|
AsmPrinterCtor = F;
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
#include "llvm/ADT/SmallPtrSet.h"
|
#include "llvm/ADT/SmallPtrSet.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -98,7 +98,7 @@ namespace {
|
|||||||
/// CppWriter - This class is the main chunk of code that converts an LLVM
|
/// CppWriter - This class is the main chunk of code that converts an LLVM
|
||||||
/// module to a C++ translation unit.
|
/// module to a C++ translation unit.
|
||||||
class CppWriter : public ModulePass {
|
class CppWriter : public ModulePass {
|
||||||
raw_ostream &Out;
|
formatted_raw_ostream &Out;
|
||||||
const Module *TheModule;
|
const Module *TheModule;
|
||||||
uint64_t uniqueNum;
|
uint64_t uniqueNum;
|
||||||
TypeMap TypeNames;
|
TypeMap TypeNames;
|
||||||
@ -113,7 +113,7 @@ namespace {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
explicit CppWriter(raw_ostream &o) :
|
explicit CppWriter(formatted_raw_ostream &o) :
|
||||||
ModulePass(&ID), Out(o), uniqueNum(0), is_inline(false) {}
|
ModulePass(&ID), Out(o), uniqueNum(0), is_inline(false) {}
|
||||||
|
|
||||||
virtual const char *getPassName() const { return "C++ backend"; }
|
virtual const char *getPassName() const { return "C++ backend"; }
|
||||||
@ -166,7 +166,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned indent_level = 0;
|
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";
|
Out << "\n";
|
||||||
if (delta >= 0 || indent_level >= unsigned(-delta))
|
if (delta >= 0 || indent_level >= unsigned(-delta))
|
||||||
indent_level += delta;
|
indent_level += delta;
|
||||||
@ -1807,8 +1807,8 @@ namespace {
|
|||||||
Out << "#include <llvm/BasicBlock.h>\n";
|
Out << "#include <llvm/BasicBlock.h>\n";
|
||||||
Out << "#include <llvm/Instructions.h>\n";
|
Out << "#include <llvm/Instructions.h>\n";
|
||||||
Out << "#include <llvm/InlineAsm.h>\n";
|
Out << "#include <llvm/InlineAsm.h>\n";
|
||||||
|
Out << "#include <llvm/Support/FormattedStream.h>\n";
|
||||||
Out << "#include <llvm/Support/MathExtras.h>\n";
|
Out << "#include <llvm/Support/MathExtras.h>\n";
|
||||||
Out << "#include <llvm/Support/raw_ostream.h>\n";
|
|
||||||
Out << "#include <llvm/Pass.h>\n";
|
Out << "#include <llvm/Pass.h>\n";
|
||||||
Out << "#include <llvm/PassManager.h>\n";
|
Out << "#include <llvm/PassManager.h>\n";
|
||||||
Out << "#include <llvm/ADT/SmallVector.h>\n";
|
Out << "#include <llvm/ADT/SmallVector.h>\n";
|
||||||
@ -2013,7 +2013,7 @@ char CppWriter::ID = 0;
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
|
||||||
raw_ostream &o,
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel) {
|
||||||
if (FileType != TargetMachine::AssemblyFile) return true;
|
if (FileType != TargetMachine::AssemblyFile) return true;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
struct CPPTargetMachine : public TargetMachine {
|
struct CPPTargetMachine : public TargetMachine {
|
||||||
const TargetData DataLayout; // Calculates type size & alignment
|
const TargetData DataLayout; // Calculates type size & alignment
|
||||||
@ -28,7 +28,8 @@ struct CPPTargetMachine : public TargetMachine {
|
|||||||
: DataLayout(&M) {}
|
: DataLayout(&M) {}
|
||||||
|
|
||||||
virtual bool WantsWholeFile() const { return true; }
|
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,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ namespace {
|
|||||||
class IA64AsmPrinter : public AsmPrinter {
|
class IA64AsmPrinter : public AsmPrinter {
|
||||||
std::set<std::string> ExternalFunctionNames, ExternalObjectNames;
|
std::set<std::string> ExternalFunctionNames, ExternalObjectNames;
|
||||||
public:
|
public:
|
||||||
explicit IA64AsmPrinter(raw_ostream &O, TargetMachine &TM,
|
explicit IA64AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, 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
|
/// assembly code for a MachineFunction to the given output stream, using
|
||||||
/// the given target machine description.
|
/// the given target machine description.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createIA64CodePrinterPass(formatted_raw_ostream &o,
|
||||||
IA64TargetMachine &tm,
|
IA64TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -20,7 +20,7 @@ namespace llvm {
|
|||||||
|
|
||||||
class IA64TargetMachine;
|
class IA64TargetMachine;
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
/// createIA64DAGToDAGInstructionSelector - This pass converts an LLVM
|
/// createIA64DAGToDAGInstructionSelector - This pass converts an LLVM
|
||||||
/// function into IA64 machine code in a sane, DAG->DAG transform.
|
/// 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
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *createIA64CodePrinterPass(raw_ostream &o,
|
FunctionPass *createIA64CodePrinterPass(formatted_raw_ostream &o,
|
||||||
IA64TargetMachine &tm,
|
IA64TargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|||||||
bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
|
@ -36,7 +36,7 @@ protected:
|
|||||||
|
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
IA64TargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -62,7 +62,7 @@ public:
|
|||||||
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
|
|
||||||
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
||||||
AsmPrinterCtor = F;
|
AsmPrinterCtor = F;
|
||||||
|
@ -35,7 +35,8 @@ namespace {
|
|||||||
: DataLayout(&M) {}
|
: DataLayout(&M) {}
|
||||||
|
|
||||||
virtual bool WantsWholeFile() const { return true; }
|
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,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
|
|
||||||
@ -1702,7 +1703,8 @@ void MSILWriter::printExternals() {
|
|||||||
// External Interface declaration
|
// External Interface declaration
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM, raw_ostream &o,
|
bool MSILTarget::addPassesToEmitWholeFile(PassManager &PM,
|
||||||
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
CodeGenOpt::Level OptLevel)
|
CodeGenOpt::Level OptLevel)
|
||||||
{
|
{
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/FindUsedTypes.h"
|
#include "llvm/Analysis/FindUsedTypes.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/TargetMachineRegistry.h"
|
#include "llvm/Target/TargetMachineRegistry.h"
|
||||||
@ -75,7 +75,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
raw_ostream &Out;
|
formatted_raw_ostream &Out;
|
||||||
Module* ModulePtr;
|
Module* ModulePtr;
|
||||||
const TargetData* TD;
|
const TargetData* TD;
|
||||||
Mangler* Mang;
|
Mangler* Mang;
|
||||||
@ -85,11 +85,15 @@ namespace {
|
|||||||
StaticInitList;
|
StaticInitList;
|
||||||
const std::set<const Type *>* UsedTypes;
|
const std::set<const Type *>* UsedTypes;
|
||||||
static char ID;
|
static char ID;
|
||||||
|
<<<<<<< .mine
|
||||||
|
MSILWriter(formatted_raw_ostream &o) : FunctionPass(&ID), Out(o) {
|
||||||
|
=======
|
||||||
DenseMap<const Value*, unsigned> AnonValueNumbers;
|
DenseMap<const Value*, unsigned> AnonValueNumbers;
|
||||||
unsigned NextAnonValueNumber;
|
unsigned NextAnonValueNumber;
|
||||||
|
|
||||||
MSILWriter(raw_ostream &o)
|
MSILWriter(raw_ostream &o)
|
||||||
: FunctionPass(&ID), Out(o), NextAnonValueNumber(0) {
|
: FunctionPass(&ID), Out(o), NextAnonValueNumber(0) {
|
||||||
|
>>>>>>> .r75668
|
||||||
UniqID = 0;
|
UniqID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class MSP430TargetMachine;
|
class MSP430TargetMachine;
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM,
|
FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
FunctionPass *createMSP430CodePrinterPass(raw_ostream &o,
|
FunctionPass *createMSP430CodePrinterPass(formatted_raw_ostream &o,
|
||||||
MSP430TargetMachine &tm,
|
MSP430TargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
} // end namespace llvm;
|
} // end namespace llvm;
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -40,7 +40,7 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
|||||||
namespace {
|
namespace {
|
||||||
class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter {
|
class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter {
|
||||||
public:
|
public:
|
||||||
MSP430AsmPrinter(raw_ostream &O, MSP430TargetMachine &TM,
|
MSP430AsmPrinter(formatted_raw_ostream &O, MSP430TargetMachine &TM,
|
||||||
const TargetAsmInfo *TAI, bool V)
|
const TargetAsmInfo *TAI, bool V)
|
||||||
: AsmPrinter(O, TM, TAI, V) {}
|
: AsmPrinter(O, TM, TAI, V) {}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ namespace {
|
|||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createMSP430CodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createMSP430CodePrinterPass(formatted_raw_ostream &o,
|
||||||
MSP430TargetMachine &tm,
|
MSP430TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -60,7 +60,7 @@ bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
|
|||||||
bool MSP430TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool MSP430TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
PM.add(createMSP430CodePrinterPass(Out, *this, Verbose));
|
PM.add(createMSP430CodePrinterPass(Out, *this, Verbose));
|
||||||
return false;
|
return false;
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel, bool Verbose,
|
CodeGenOpt::Level OptLevel, bool Verbose,
|
||||||
raw_ostream &Out);
|
formatted_raw_ostream &Out);
|
||||||
static unsigned getModuleMatchQuality(const Module &M);
|
static unsigned getModuleMatchQuality(const Module &M);
|
||||||
}; // MSP430TargetMachine.
|
}; // MSP430TargetMachine.
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -51,7 +51,7 @@ namespace {
|
|||||||
class VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter {
|
class VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter {
|
||||||
const MipsSubtarget *Subtarget;
|
const MipsSubtarget *Subtarget;
|
||||||
public:
|
public:
|
||||||
explicit MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM,
|
explicit MipsAsmPrinter(formatted_raw_ostream &O, MipsTargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V) {
|
: AsmPrinter(O, TM, T, V) {
|
||||||
Subtarget = &TM.getSubtarget<MipsSubtarget>();
|
Subtarget = &TM.getSubtarget<MipsSubtarget>();
|
||||||
@ -91,7 +91,7 @@ namespace {
|
|||||||
/// assembly code for a MachineFunction to the given output stream,
|
/// assembly code for a MachineFunction to the given output stream,
|
||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createMipsCodePrinterPass(formatted_raw_ostream &o,
|
||||||
MipsTargetMachine &tm,
|
MipsTargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -21,11 +21,11 @@ namespace llvm {
|
|||||||
class MipsTargetMachine;
|
class MipsTargetMachine;
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class MachineCodeEmitter;
|
class MachineCodeEmitter;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createMipsISelDag(MipsTargetMachine &TM);
|
FunctionPass *createMipsISelDag(MipsTargetMachine &TM);
|
||||||
FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM);
|
FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM);
|
||||||
FunctionPass *createMipsCodePrinterPass(raw_ostream &OS,
|
FunctionPass *createMipsCodePrinterPass(formatted_raw_ostream &OS,
|
||||||
MipsTargetMachine &TM,
|
MipsTargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
} // end namespace llvm;
|
} // end namespace llvm;
|
||||||
|
@ -131,7 +131,7 @@ addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
|
|||||||
// true if AssemblyEmitter is supported
|
// true if AssemblyEmitter is supported
|
||||||
bool MipsTargetMachine::
|
bool MipsTargetMachine::
|
||||||
addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out) {
|
bool Verbose, formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
PM.add(AsmPrinterCtor(Out, *this, Verbose));
|
PM.add(AsmPrinterCtor(Out, *this, Verbose));
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "llvm/Target/TargetFrameInfo.h"
|
#include "llvm/Target/TargetFrameInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
class MipsTargetMachine : public LLVMTargetMachine {
|
class MipsTargetMachine : public LLVMTargetMachine {
|
||||||
MipsSubtarget Subtarget;
|
MipsSubtarget Subtarget;
|
||||||
@ -37,7 +37,7 @@ namespace llvm {
|
|||||||
// To avoid having target depend on the asmprinter stuff libraries,
|
// To avoid having target depend on the asmprinter stuff libraries,
|
||||||
// asmprinter set this functions to ctor pointer at startup time if they are
|
// asmprinter set this functions to ctor pointer at startup time if they are
|
||||||
// linked in.
|
// linked in.
|
||||||
typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
|
typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
|
||||||
MipsTargetMachine &tm,
|
MipsTargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -75,7 +75,7 @@ namespace llvm {
|
|||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MipselTargetMachine - Mipsel target machine.
|
/// MipselTargetMachine - Mipsel target machine.
|
||||||
|
@ -27,7 +27,7 @@ namespace llvm {
|
|||||||
class PIC16TargetMachine;
|
class PIC16TargetMachine;
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class MachineCodeEmitter;
|
class MachineCodeEmitter;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
namespace PIC16CC {
|
namespace PIC16CC {
|
||||||
enum CondCodes {
|
enum CondCodes {
|
||||||
@ -343,7 +343,7 @@ namespace PIC16CC {
|
|||||||
|
|
||||||
|
|
||||||
FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM);
|
FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM);
|
||||||
FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS,
|
FunctionPass *createPIC16CodePrinterPass(formatted_raw_ostream &OS,
|
||||||
PIC16TargetMachine &TM,
|
PIC16TargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
// Banksel optimzer pass.
|
// Banksel optimzer pass.
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
@ -112,7 +112,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createPIC16CodePrinterPass(formatted_raw_ostream &o,
|
||||||
PIC16TargetMachine &tm,
|
PIC16TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
|
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)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V), DbgInfo(O, T) {
|
: AsmPrinter(O, TM, T, V), DbgInfo(O, T) {
|
||||||
PTLI = TM.getTargetLowering();
|
PTLI = TM.getTargetLowering();
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/Support/DebugLoc.h"
|
#include "llvm/Support/DebugLoc.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -90,10 +90,10 @@ namespace llvm {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
class PIC16DbgInfo {
|
class PIC16DbgInfo {
|
||||||
raw_ostream &O;
|
formatted_raw_ostream &O;
|
||||||
const TargetAsmInfo *TAI;
|
const TargetAsmInfo *TAI;
|
||||||
std::string CurFile;
|
std::string CurFile;
|
||||||
unsigned CurLine;
|
unsigned CurLine;
|
||||||
@ -103,7 +103,8 @@ namespace llvm {
|
|||||||
bool EmitDebugDirectives;
|
bool EmitDebugDirectives;
|
||||||
|
|
||||||
public:
|
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 = "";
|
CurFile = "";
|
||||||
CurLine = 0;
|
CurLine = 0;
|
||||||
EmitDebugDirectives = false;
|
EmitDebugDirectives = false;
|
||||||
|
@ -67,7 +67,8 @@ bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM,
|
|||||||
|
|
||||||
bool PIC16TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool PIC16TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out) {
|
bool Verbose,
|
||||||
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
PM.add(createPIC16CodePrinterPass(Out, *this, Verbose));
|
PM.add(createPIC16CodePrinterPass(Out, *this, Verbose));
|
||||||
return false;
|
return false;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
}; // PIC16TargetMachine.
|
}; // PIC16TargetMachine.
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Compiler.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/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
@ -56,7 +56,7 @@ namespace {
|
|||||||
StringSet<> FnStubs, GVStubs, HiddenGVStubs;
|
StringSet<> FnStubs, GVStubs, HiddenGVStubs;
|
||||||
const PPCSubtarget &Subtarget;
|
const PPCSubtarget &Subtarget;
|
||||||
public:
|
public:
|
||||||
explicit PPCAsmPrinter(raw_ostream &O, TargetMachine &TM,
|
explicit PPCAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V),
|
: AsmPrinter(O, TM, T, V),
|
||||||
Subtarget(TM.getSubtarget<PPCSubtarget>()) {}
|
Subtarget(TM.getSubtarget<PPCSubtarget>()) {}
|
||||||
@ -294,7 +294,7 @@ namespace {
|
|||||||
/// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux
|
/// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux
|
||||||
class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter {
|
class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter {
|
||||||
public:
|
public:
|
||||||
explicit PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM,
|
explicit PPCLinuxAsmPrinter(formatted_raw_ostream &O, PPCTargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: PPCAsmPrinter(O, TM, T, V){}
|
: PPCAsmPrinter(O, TM, T, V){}
|
||||||
|
|
||||||
@ -318,9 +318,9 @@ namespace {
|
|||||||
/// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac
|
/// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac
|
||||||
/// OS X
|
/// OS X
|
||||||
class VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter {
|
class VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter {
|
||||||
raw_ostream &OS;
|
formatted_raw_ostream &OS;
|
||||||
public:
|
public:
|
||||||
explicit PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM,
|
explicit PPCDarwinAsmPrinter(formatted_raw_ostream &O, PPCTargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: PPCAsmPrinter(O, TM, T, V), OS(O) {}
|
: 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.
|
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
|
||||||
/// Don't print things like \\n or \\0.
|
/// 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();
|
for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
|
||||||
Name != E; ++Name)
|
Name != E; ++Name)
|
||||||
if (isprint(*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
|
/// for a MachineFunction to the given output stream, in a format that the
|
||||||
/// Darwin assembler can deal with.
|
/// Darwin assembler can deal with.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createPPCAsmPrinterPass(formatted_raw_ostream &o,
|
||||||
PPCTargetMachine &tm,
|
PPCTargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
const PPCSubtarget *Subtarget = &tm.getSubtarget<PPCSubtarget>();
|
const PPCSubtarget *Subtarget = &tm.getSubtarget<PPCSubtarget>();
|
||||||
|
@ -25,11 +25,12 @@ namespace llvm {
|
|||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class MachineCodeEmitter;
|
class MachineCodeEmitter;
|
||||||
class ObjectCodeEmitter;
|
class ObjectCodeEmitter;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createPPCBranchSelectionPass();
|
FunctionPass *createPPCBranchSelectionPass();
|
||||||
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
||||||
FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, PPCTargetMachine &TM,
|
FunctionPass *createPPCAsmPrinterPass(formatted_raw_ostream &OS,
|
||||||
|
PPCTargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM,
|
FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM,
|
||||||
MachineCodeEmitter &MCE);
|
MachineCodeEmitter &MCE);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Target/TargetMachineRegistry.h"
|
#include "llvm/Target/TargetMachineRegistry.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
/// PowerPCTargetMachineModule - Note that this is used on hosts that
|
/// PowerPCTargetMachineModule - Note that this is used on hosts that
|
||||||
@ -149,7 +149,7 @@ bool PPCTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|||||||
bool PPCTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool PPCTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(Out, *this, Verbose));
|
PM.add(AsmPrinterCtor(Out, *this, Verbose));
|
||||||
@ -183,7 +183,7 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -215,7 +215,7 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -247,7 +247,7 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -262,7 +262,7 @@ bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -277,7 +277,7 @@ bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -292,7 +292,7 @@ bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,7 +44,7 @@ protected:
|
|||||||
|
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
PPCTargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
@ -50,7 +50,7 @@ namespace {
|
|||||||
ValueMapTy NumberForBB;
|
ValueMapTy NumberForBB;
|
||||||
unsigned BBNumber;
|
unsigned BBNumber;
|
||||||
public:
|
public:
|
||||||
explicit SparcAsmPrinter(raw_ostream &O, TargetMachine &TM,
|
explicit SparcAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V), BBNumber(0) {}
|
: AsmPrinter(O, TM, T, V), BBNumber(0) {}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ namespace {
|
|||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createSparcCodePrinterPass(formatted_raw_ostream &o,
|
||||||
TargetMachine &tm,
|
TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class SparcTargetMachine;
|
class SparcTargetMachine;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
|
FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
|
||||||
FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM,
|
FunctionPass *createSparcCodePrinterPass(formatted_raw_ostream &OS,
|
||||||
|
TargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
|
FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
|
||||||
FunctionPass *createSparcFPMoverPass(TargetMachine &TM);
|
FunctionPass *createSparcFPMoverPass(TargetMachine &TM);
|
||||||
|
@ -86,7 +86,7 @@ bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|||||||
bool SparcTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool SparcTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
|||||||
|
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
TargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -62,7 +62,7 @@ public:
|
|||||||
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
|
|
||||||
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
||||||
AsmPrinterCtor = F;
|
AsmPrinterCtor = F;
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -60,7 +60,8 @@ void X86ATTAsmPrinter::PrintPICBaseSymbol() const {
|
|||||||
|
|
||||||
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
|
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
|
||||||
/// Don't print things like \\n or \\0.
|
/// 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();
|
for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
|
||||||
Name != E; ++Name)
|
Name != E; ++Name)
|
||||||
if (isprint(*Name))
|
if (isprint(*Name))
|
||||||
|
@ -37,7 +37,7 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
|
|||||||
MCContext *Context;
|
MCContext *Context;
|
||||||
MCStreamer *Streamer;
|
MCStreamer *Streamer;
|
||||||
public:
|
public:
|
||||||
explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM,
|
explicit X86ATTAsmPrinter(formatted_raw_ostream &O, X86TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V) {
|
: AsmPrinter(O, TM, T, V) {
|
||||||
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "X86ATTAsmPrinter.h"
|
#include "X86ATTAsmPrinter.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Include the auto-generated portion of the assembly writer.
|
// Include the auto-generated portion of the assembly writer.
|
||||||
|
@ -23,7 +23,7 @@ using namespace llvm;
|
|||||||
/// for a MachineFunction to the given output stream, using the given target
|
/// for a MachineFunction to the given output stream, using the given target
|
||||||
/// machine description.
|
/// machine description.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createX86CodePrinterPass(formatted_raw_ostream &o,
|
||||||
X86TargetMachine &tm,
|
X86TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
|
const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
#include "llvm/CodeGen/AsmPrinter.h"
|
#include "llvm/CodeGen/AsmPrinter.h"
|
||||||
#include "llvm/ADT/StringSet.h"
|
#include "llvm/ADT/StringSet.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter {
|
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)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V) {}
|
: AsmPrinter(O, TM, T, V) {}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class X86TargetMachine;
|
|||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class MachineCodeEmitter;
|
class MachineCodeEmitter;
|
||||||
class JITCodeEmitter;
|
class JITCodeEmitter;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
/// createX86ISelDag - This pass converts a legalized DAG into a
|
/// createX86ISelDag - This pass converts a legalized DAG into a
|
||||||
/// X86-specific DAG, ready for instruction scheduling.
|
/// X86-specific DAG, ready for instruction scheduling.
|
||||||
@ -46,7 +46,8 @@ FunctionPass *createX87FPRegKillInserterPass();
|
|||||||
/// assembly code for a MachineFunction to the given output stream,
|
/// assembly code for a MachineFunction to the given output stream,
|
||||||
/// using the given target machine description.
|
/// using the given target machine description.
|
||||||
///
|
///
|
||||||
FunctionPass *createX86CodePrinterPass(raw_ostream &o, X86TargetMachine &tm,
|
FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o,
|
||||||
|
X86TargetMachine &tm,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
|
|
||||||
/// createX86CodeEmitterPass - Return a pass that emits the collected X86 code
|
/// createX86CodeEmitterPass - Return a pass that emits the collected X86 code
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/Passes.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/TargetOptions.h"
|
||||||
#include "llvm/Target/TargetMachineRegistry.h"
|
#include "llvm/Target/TargetMachineRegistry.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -237,7 +237,7 @@ bool X86TargetMachine::addPostRegAlloc(PassManagerBase &PM,
|
|||||||
bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(Out, *this, Verbose));
|
PM.add(AsmPrinterCtor(Out, *this, Verbose));
|
||||||
@ -270,7 +270,7 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -302,7 +302,7 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -316,7 +316,7 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -330,7 +330,7 @@ bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -344,7 +344,7 @@ bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -358,7 +358,7 @@ bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
|
|||||||
if (DumpAsm) {
|
if (DumpAsm) {
|
||||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||||
if (AsmPrinterCtor)
|
if (AsmPrinterCtor)
|
||||||
PM.add(AsmPrinterCtor(errs(), *this, true));
|
PM.add(AsmPrinterCtor(ferrs(), *this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
class X86TargetMachine : public LLVMTargetMachine {
|
class X86TargetMachine : public LLVMTargetMachine {
|
||||||
X86Subtarget Subtarget;
|
X86Subtarget Subtarget;
|
||||||
@ -43,7 +43,7 @@ protected:
|
|||||||
|
|
||||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
// 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.
|
// 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,
|
X86TargetMachine &tm,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||||
@ -79,7 +79,7 @@ public:
|
|||||||
virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||||
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
||||||
|
@ -21,10 +21,10 @@ namespace llvm {
|
|||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class XCoreTargetMachine;
|
class XCoreTargetMachine;
|
||||||
class raw_ostream;
|
class formatted_raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM);
|
FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM);
|
||||||
FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS,
|
FunctionPass *createXCoreCodePrinterPass(formatted_raw_ostream &OS,
|
||||||
XCoreTargetMachine &TM,
|
XCoreTargetMachine &TM,
|
||||||
bool Verbose);
|
bool Verbose);
|
||||||
} // end namespace llvm;
|
} // end namespace llvm;
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -58,7 +58,7 @@ namespace {
|
|||||||
DwarfWriter *DW;
|
DwarfWriter *DW;
|
||||||
const XCoreSubtarget &Subtarget;
|
const XCoreSubtarget &Subtarget;
|
||||||
public:
|
public:
|
||||||
explicit XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM,
|
explicit XCoreAsmPrinter(formatted_raw_ostream &O, XCoreTargetMachine &TM,
|
||||||
const TargetAsmInfo *T, bool V)
|
const TargetAsmInfo *T, bool V)
|
||||||
: AsmPrinter(O, TM, T, V), DW(0),
|
: AsmPrinter(O, TM, T, V), DW(0),
|
||||||
Subtarget(*TM.getSubtargetImpl()) {}
|
Subtarget(*TM.getSubtargetImpl()) {}
|
||||||
@ -104,7 +104,7 @@ namespace {
|
|||||||
/// using the given target machine description. This should work
|
/// using the given target machine description. This should work
|
||||||
/// regardless of whether the function is in SSA form.
|
/// regardless of whether the function is in SSA form.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o,
|
FunctionPass *llvm::createXCoreCodePrinterPass(formatted_raw_ostream &o,
|
||||||
XCoreTargetMachine &tm,
|
XCoreTargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), 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
|
// PrintEscapedString - Print each character of the specified string, escaping
|
||||||
// it if it is not printable or if it is an escape char.
|
// 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) {
|
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
|
||||||
unsigned char C = Str[i];
|
unsigned char C = Str[i];
|
||||||
if (isprint(C) && C != '"' && C != '\\') {
|
if (isprint(C) && C != '"' && C != '\\') {
|
||||||
|
@ -67,7 +67,7 @@ bool XCoreTargetMachine::addInstSelector(PassManagerBase &PM,
|
|||||||
bool XCoreTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
bool XCoreTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose,
|
bool Verbose,
|
||||||
raw_ostream &Out) {
|
formatted_raw_ostream &Out) {
|
||||||
// Output assembly language.
|
// Output assembly language.
|
||||||
PM.add(createXCoreCodePrinterPass(Out, *this, Verbose));
|
PM.add(createXCoreCodePrinterPass(Out, *this, Verbose));
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel,
|
CodeGenOpt::Level OptLevel,
|
||||||
bool Verbose, raw_ostream &Out);
|
bool Verbose, formatted_raw_ostream &Out);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -30,12 +30,12 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/PluginLoader.h"
|
#include "llvm/Support/PluginLoader.h"
|
||||||
#include "llvm/Support/PrettyStackTrace.h"
|
#include "llvm/Support/PrettyStackTrace.h"
|
||||||
#include "llvm/Support/RegistryParser.h"
|
#include "llvm/Support/RegistryParser.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
@ -128,10 +128,10 @@ GetFileNameRoot(const std::string &InputFilename) {
|
|||||||
return outputFilename;
|
return outputFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
static raw_ostream *GetOutputStream(const char *ProgName) {
|
static formatted_raw_ostream *GetOutputStream(const char *ProgName) {
|
||||||
if (OutputFilename != "") {
|
if (OutputFilename != "") {
|
||||||
if (OutputFilename == "-")
|
if (OutputFilename == "-")
|
||||||
return &outs();
|
return &fouts();
|
||||||
|
|
||||||
// Specified an output filename?
|
// Specified an output filename?
|
||||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||||
@ -146,7 +146,10 @@ static raw_ostream *GetOutputStream(const char *ProgName) {
|
|||||||
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
||||||
|
|
||||||
std::string error;
|
std::string error;
|
||||||
raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), true, error);
|
raw_fd_ostream *FDOut = new raw_fd_ostream(OutputFilename.c_str(),
|
||||||
|
true, error);
|
||||||
|
formatted_raw_ostream *Out =
|
||||||
|
new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
|
||||||
if (!error.empty()) {
|
if (!error.empty()) {
|
||||||
std::cerr << error << '\n';
|
std::cerr << error << '\n';
|
||||||
delete Out;
|
delete Out;
|
||||||
@ -158,7 +161,7 @@ static raw_ostream *GetOutputStream(const char *ProgName) {
|
|||||||
|
|
||||||
if (InputFilename == "-") {
|
if (InputFilename == "-") {
|
||||||
OutputFilename = "-";
|
OutputFilename = "-";
|
||||||
return &outs();
|
return &fouts();
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputFilename = GetFileNameRoot(InputFilename);
|
OutputFilename = GetFileNameRoot(InputFilename);
|
||||||
@ -199,7 +202,10 @@ static raw_ostream *GetOutputStream(const char *ProgName) {
|
|||||||
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
||||||
|
|
||||||
std::string error;
|
std::string error;
|
||||||
raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), Binary, error);
|
raw_fd_ostream *FDOut = new raw_fd_ostream(OutputFilename.c_str(),
|
||||||
|
Binary, error);
|
||||||
|
formatted_raw_ostream *Out =
|
||||||
|
new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
|
||||||
if (!error.empty()) {
|
if (!error.empty()) {
|
||||||
std::cerr << error << '\n';
|
std::cerr << error << '\n';
|
||||||
delete Out;
|
delete Out;
|
||||||
@ -268,7 +274,7 @@ int main(int argc, char **argv) {
|
|||||||
TargetMachine &Target = *target.get();
|
TargetMachine &Target = *target.get();
|
||||||
|
|
||||||
// Figure out where we are going to send the output...
|
// Figure out where we are going to send the output...
|
||||||
raw_ostream *Out = GetOutputStream(argv[0]);
|
formatted_raw_ostream *Out = GetOutputStream(argv[0]);
|
||||||
if (Out == 0) return 1;
|
if (Out == 0) return 1;
|
||||||
|
|
||||||
CodeGenOpt::Level OLvl = CodeGenOpt::Default;
|
CodeGenOpt::Level OLvl = CodeGenOpt::Default;
|
||||||
@ -295,7 +301,7 @@ int main(int argc, char **argv) {
|
|||||||
if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, OLvl)) {
|
if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, OLvl)) {
|
||||||
std::cerr << argv[0] << ": target does not support generation of this"
|
std::cerr << argv[0] << ": target does not support generation of this"
|
||||||
<< " file type!\n";
|
<< " file type!\n";
|
||||||
if (Out != &outs()) delete Out;
|
if (Out != &fouts()) delete Out;
|
||||||
// And the Out file is empty and useless, so remove it now.
|
// And the Out file is empty and useless, so remove it now.
|
||||||
sys::Path(OutputFilename).eraseFromDisk();
|
sys::Path(OutputFilename).eraseFromDisk();
|
||||||
return 1;
|
return 1;
|
||||||
@ -325,7 +331,7 @@ int main(int argc, char **argv) {
|
|||||||
case FileModel::Error:
|
case FileModel::Error:
|
||||||
std::cerr << argv[0] << ": target does not support generation of this"
|
std::cerr << argv[0] << ": target does not support generation of this"
|
||||||
<< " file type!\n";
|
<< " file type!\n";
|
||||||
if (Out != &outs()) delete Out;
|
if (Out != &fouts()) delete Out;
|
||||||
// And the Out file is empty and useless, so remove it now.
|
// And the Out file is empty and useless, so remove it now.
|
||||||
sys::Path(OutputFilename).eraseFromDisk();
|
sys::Path(OutputFilename).eraseFromDisk();
|
||||||
return 1;
|
return 1;
|
||||||
@ -342,7 +348,7 @@ int main(int argc, char **argv) {
|
|||||||
if (Target.addPassesToEmitFileFinish(Passes, OCE, OLvl)) {
|
if (Target.addPassesToEmitFileFinish(Passes, OCE, OLvl)) {
|
||||||
std::cerr << argv[0] << ": target does not support generation of this"
|
std::cerr << argv[0] << ": target does not support generation of this"
|
||||||
<< " file type!\n";
|
<< " file type!\n";
|
||||||
if (Out != &outs()) delete Out;
|
if (Out != &fouts()) delete Out;
|
||||||
// And the Out file is empty and useless, so remove it now.
|
// And the Out file is empty and useless, so remove it now.
|
||||||
sys::Path(OutputFilename).eraseFromDisk();
|
sys::Path(OutputFilename).eraseFromDisk();
|
||||||
return 1;
|
return 1;
|
||||||
@ -364,8 +370,10 @@ int main(int argc, char **argv) {
|
|||||||
Passes.doFinalization();
|
Passes.doFinalization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Out->flush();
|
||||||
|
|
||||||
// Delete the ostream if it's not a stdout stream
|
// Delete the ostream if it's not a stdout stream
|
||||||
if (Out != &outs()) delete Out;
|
if (Out != &fouts()) delete Out;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@
|
|||||||
#include "llvm/Bitcode/ReaderWriter.h"
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/CodeGen/FileWriters.h"
|
#include "llvm/CodeGen/FileWriters.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/StandardPasses.h"
|
#include "llvm/Support/StandardPasses.h"
|
||||||
#include "llvm/Support/SystemUtils.h"
|
#include "llvm/Support/SystemUtils.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include "llvm/Target/SubtargetFeature.h"
|
#include "llvm/Target/SubtargetFeature.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
@ -185,7 +185,9 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
|
|||||||
// generate assembly code
|
// generate assembly code
|
||||||
bool genResult = false;
|
bool genResult = false;
|
||||||
{
|
{
|
||||||
raw_fd_ostream asmFile(uniqueAsmPath.c_str(), false, errMsg);
|
raw_fd_ostream asmFD(raw_fd_ostream(uniqueAsmPath.c_str(),
|
||||||
|
false, errMsg));
|
||||||
|
formatted_raw_ostream asmFile(asmFD);
|
||||||
if (!errMsg.empty())
|
if (!errMsg.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
||||||
@ -390,7 +392,7 @@ void LTOCodeGenerator::applyScopeRestrictions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Optimize merged modules using various IPO passes
|
/// Optimize merged modules using various IPO passes
|
||||||
bool LTOCodeGenerator::generateAssemblyCode(raw_ostream& out,
|
bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
|
||||||
std::string& errMsg)
|
std::string& errMsg)
|
||||||
{
|
{
|
||||||
if ( this->determineTarget(errMsg) )
|
if ( this->determineTarget(errMsg) )
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
const void* compile(size_t* length, std::string& errMsg);
|
const void* compile(size_t* length, std::string& errMsg);
|
||||||
void setCodeGenDebugOptions(const char *opts);
|
void setCodeGenDebugOptions(const char *opts);
|
||||||
private:
|
private:
|
||||||
bool generateAssemblyCode(llvm::raw_ostream& out,
|
bool generateAssemblyCode(llvm::formatted_raw_ostream& out,
|
||||||
std::string& errMsg);
|
std::string& errMsg);
|
||||||
bool assemble(const std::string& asmPath,
|
bool assemble(const std::string& asmPath,
|
||||||
const std::string& objPath, std::string& errMsg);
|
const std::string& objPath, std::string& errMsg);
|
||||||
|
Loading…
Reference in New Issue
Block a user