mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Momentous day: remove the "O" member from AsmPrinter. Now all
"asm printering" happens through MCStreamer. This also Streamerizes PIC16 debug info, which escaped my attention. This removes a leak from LLVMTargetMachine of the 'legacy' output stream. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100327 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de0f339ec3
commit
b23569aff0
@ -54,7 +54,6 @@ namespace llvm {
|
||||
class TargetLoweringObjectFile;
|
||||
class Twine;
|
||||
class Type;
|
||||
class formatted_raw_ostream;
|
||||
|
||||
/// AsmPrinter - This class is intended to be used as a driving class for all
|
||||
/// asm writers.
|
||||
@ -80,10 +79,6 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
|
||||
/// Output stream on which we're printing assembly code.
|
||||
///
|
||||
formatted_raw_ostream &O;
|
||||
|
||||
/// Target machine description.
|
||||
///
|
||||
TargetMachine &TM;
|
||||
@ -138,8 +133,7 @@ namespace llvm {
|
||||
mutable unsigned SetCounter;
|
||||
|
||||
protected:
|
||||
explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
|
||||
MCStreamer &Streamer);
|
||||
explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
|
||||
|
||||
public:
|
||||
virtual ~AsmPrinter();
|
||||
|
@ -38,7 +38,6 @@ namespace llvm {
|
||||
class TargetAsmLexer;
|
||||
class TargetAsmParser;
|
||||
class TargetMachine;
|
||||
class formatted_raw_ostream;
|
||||
class raw_ostream;
|
||||
|
||||
/// Target - Wrapper for Target specific information.
|
||||
@ -60,8 +59,7 @@ namespace llvm {
|
||||
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
|
||||
const std::string &TT,
|
||||
const std::string &Features);
|
||||
typedef AsmPrinter *(*AsmPrinterCtorTy)(formatted_raw_ostream &OS,
|
||||
TargetMachine &TM,
|
||||
typedef AsmPrinter *(*AsmPrinterCtorTy)(TargetMachine &TM,
|
||||
MCStreamer &Streamer);
|
||||
typedef TargetAsmBackend *(*AsmBackendCtorTy)(const Target &T,
|
||||
const std::string &TT);
|
||||
@ -233,11 +231,10 @@ namespace llvm {
|
||||
|
||||
/// createAsmPrinter - Create a target specific assembly printer pass. This
|
||||
/// takes ownership of the MCStreamer object.
|
||||
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||
MCStreamer &Streamer) const {
|
||||
AsmPrinter *createAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) const{
|
||||
if (!AsmPrinterCtorFn)
|
||||
return 0;
|
||||
return AsmPrinterCtorFn(OS, TM, Streamer);
|
||||
return AsmPrinterCtorFn(TM, Streamer);
|
||||
}
|
||||
|
||||
MCDisassembler *createMCDisassembler() const {
|
||||
@ -644,9 +641,8 @@ namespace llvm {
|
||||
}
|
||||
|
||||
private:
|
||||
static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||
MCStreamer &Streamer) {
|
||||
return new AsmPrinterImpl(OS, TM, Streamer);
|
||||
static AsmPrinter *Allocator(TargetMachine &TM, MCStreamer &Streamer) {
|
||||
return new AsmPrinterImpl(TM, Streamer);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include <cerrno>
|
||||
using namespace llvm;
|
||||
|
||||
@ -56,9 +55,8 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
||||
|
||||
char AsmPrinter::ID = 0;
|
||||
|
||||
AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
|
||||
MCStreamer &Streamer)
|
||||
: MachineFunctionPass(&ID), O(o),
|
||||
AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
|
||||
: MachineFunctionPass(&ID),
|
||||
TM(tm), MAI(tm.getMCAsmInfo()), TRI(tm.getRegisterInfo()),
|
||||
OutContext(Streamer.getContext()),
|
||||
OutStreamer(Streamer),
|
||||
|
@ -123,7 +123,6 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
const MCAsmInfo &MAI = *getMCAsmInfo();
|
||||
OwningPtr<MCStreamer> AsmStreamer;
|
||||
|
||||
formatted_raw_ostream *LegacyOutput;
|
||||
switch (FileType) {
|
||||
default: return true;
|
||||
case CGFT_AssemblyFile: {
|
||||
@ -133,8 +132,6 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
getTargetData()->isLittleEndian(),
|
||||
getVerboseAsm(), InstPrinter,
|
||||
/*codeemitter*/0));
|
||||
// Set the AsmPrinter's "O" to the output file.
|
||||
LegacyOutput = &Out;
|
||||
break;
|
||||
}
|
||||
case CGFT_ObjectFile: {
|
||||
@ -146,29 +143,17 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
return true;
|
||||
|
||||
AsmStreamer.reset(createMachOStreamer(*Context, *TAB, Out, MCE));
|
||||
|
||||
// Any output to the asmprinter's "O" stream is bad and needs to be fixed,
|
||||
// force it to come out stderr.
|
||||
// FIXME: this is horrible and leaks, eventually remove the raw_ostream from
|
||||
// asmprinter.
|
||||
LegacyOutput = new formatted_raw_ostream(errs());
|
||||
break;
|
||||
}
|
||||
case CGFT_Null:
|
||||
// The Null output is intended for use for performance analysis and testing,
|
||||
// not real users.
|
||||
AsmStreamer.reset(createNullStreamer(*Context));
|
||||
// Any output to the asmprinter's "O" stream is bad and needs to be fixed,
|
||||
// force it to come out stderr.
|
||||
// FIXME: this is horrible and leaks, eventually remove the raw_ostream from
|
||||
// asmprinter.
|
||||
LegacyOutput = new formatted_raw_ostream(errs());
|
||||
break;
|
||||
}
|
||||
|
||||
// Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
|
||||
FunctionPass *Printer =
|
||||
getTarget().createAsmPrinter(*LegacyOutput, *this, *AsmStreamer);
|
||||
FunctionPass *Printer = getTarget().createAsmPrinter(*this, *AsmStreamer);
|
||||
if (Printer == 0)
|
||||
return true;
|
||||
|
||||
|
@ -46,11 +46,9 @@
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cctype>
|
||||
using namespace llvm;
|
||||
|
||||
@ -74,9 +72,8 @@ namespace {
|
||||
const MachineConstantPool *MCP;
|
||||
|
||||
public:
|
||||
explicit ARMAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer), AFI(NULL), MCP(NULL) {
|
||||
explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer), AFI(NULL), MCP(NULL) {
|
||||
Subtarget = &TM.getSubtarget<ARMSubtarget>();
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -38,9 +37,8 @@ namespace {
|
||||
/// Unique incrementer for label values for referencing Global values.
|
||||
///
|
||||
|
||||
explicit AlphaAsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(o, tm, Streamer) {}
|
||||
explicit AlphaAsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
|
||||
: AsmPrinter(tm, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Alpha Assembly Printer";
|
||||
|
@ -33,15 +33,14 @@
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class BlackfinAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
BlackfinAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
BlackfinAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Blackfin Assembly Printer";
|
||||
|
@ -33,15 +33,14 @@
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class SPUAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer) :
|
||||
AsmPrinter(O, TM, Streamer) {}
|
||||
explicit SPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) :
|
||||
AsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "STI CBEA SPU Assembly Printer";
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/DwarfWriter.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@ -38,13 +37,9 @@
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cctype>
|
||||
|
||||
using namespace llvm;
|
||||
@ -53,9 +48,8 @@ namespace {
|
||||
class MBlazeAsmPrinter : public AsmPrinter {
|
||||
const MBlazeSubtarget *Subtarget;
|
||||
public:
|
||||
explicit MBlazeAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {
|
||||
explicit MBlazeAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {
|
||||
Subtarget = &TM.getSubtarget<MBlazeSubtarget>();
|
||||
}
|
||||
|
||||
|
@ -36,15 +36,14 @@
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class MSP430AsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
MSP430AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
MSP430AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "MSP430 Assembly Printer";
|
||||
|
@ -19,9 +19,6 @@
|
||||
#include "MipsInstrInfo.h"
|
||||
#include "MipsTargetMachine.h"
|
||||
#include "MipsMachineFunction.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/DwarfWriter.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
@ -39,20 +36,16 @@
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <cctype>
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class MipsAsmPrinter : public AsmPrinter {
|
||||
const MipsSubtarget *Subtarget;
|
||||
public:
|
||||
explicit MipsAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {
|
||||
explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {
|
||||
Subtarget = &TM.getSubtarget<MipsSubtarget>();
|
||||
}
|
||||
|
||||
|
@ -29,16 +29,15 @@
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include <cstring>
|
||||
using namespace llvm;
|
||||
|
||||
#include "PIC16GenAsmWriter.inc"
|
||||
|
||||
PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer), DbgInfo(O, TM.getMCAsmInfo()) {
|
||||
PIC16AsmPrinter::PIC16AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer), DbgInfo(Streamer, TM.getMCAsmInfo()) {
|
||||
PTLI = static_cast<PIC16TargetLowering*>(TM.getTargetLowering());
|
||||
PMAI = static_cast<const PIC16MCAsmInfo*>(TM.getMCAsmInfo());
|
||||
PTOF = (PIC16TargetObjectFile *)&PTLI->getObjFileLowering();
|
||||
|
@ -31,8 +31,7 @@
|
||||
namespace llvm {
|
||||
class VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer);
|
||||
explicit PIC16AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
|
||||
private:
|
||||
virtual const char *getPassName() const {
|
||||
return "PIC16 Assembly Printer";
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/Support/DebugLoc.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
using namespace llvm;
|
||||
|
||||
/// PopulateDebugInfo - Populate the TypeNo, Aux[] and TagName from Ty.
|
||||
@ -267,7 +267,8 @@ void PIC16DbgInfo::ChangeDebugLoc(const MachineFunction &MF,
|
||||
///
|
||||
void PIC16DbgInfo::SwitchToLine(unsigned Line, bool IsInBeginFunction) {
|
||||
if (CurLine == Line) return;
|
||||
if (!IsInBeginFunction) O << "\n\t.line " << Line << "\n";
|
||||
if (!IsInBeginFunction)
|
||||
OS.EmitRawText("\n\t.line " + Twine(Line));
|
||||
CurLine = Line;
|
||||
}
|
||||
|
||||
@ -286,7 +287,7 @@ void PIC16DbgInfo::EndFunction(const MachineFunction &MF) {
|
||||
void PIC16DbgInfo::EndModule(Module &M) {
|
||||
if (! EmitDebugDirectives) return;
|
||||
EmitVarDebugInfo(M);
|
||||
if (CurFile != "") O << "\n\t.eof";
|
||||
if (CurFile != "") OS.EmitRawText(StringRef("\n\t.eof"));
|
||||
}
|
||||
|
||||
/// EmitCompositeTypeElements - Emit debug information for members of a
|
||||
@ -410,22 +411,26 @@ void PIC16DbgInfo::EmitFunctEndDI(const Function *F, unsigned Line) {
|
||||
///
|
||||
void PIC16DbgInfo::EmitAuxEntry(const std::string VarName, int Aux[], int Num,
|
||||
std::string TagName) {
|
||||
O << "\n\t.dim " << VarName << ", 1" ;
|
||||
std::string Tmp;
|
||||
// TagName is emitted in case of structure/union objects.
|
||||
if (TagName != "")
|
||||
O << ", " << TagName;
|
||||
if (!TagName.empty()) Tmp += ", " + TagName;
|
||||
|
||||
for (int i = 0; i<Num; i++)
|
||||
O << "," << (Aux[i] && 0xff);
|
||||
Tmp += "," + utostr(Aux[i] && 0xff);
|
||||
|
||||
OS.EmitRawText("\n\t.dim " + Twine(VarName) + ", 1" + Tmp);
|
||||
}
|
||||
|
||||
/// EmitSymbol - Emit .def for a symbol. Value is offset for the member.
|
||||
///
|
||||
void PIC16DbgInfo::EmitSymbol(std::string Name, short Class, unsigned short
|
||||
Type, unsigned long Value) {
|
||||
O << "\n\t" << ".def "<< Name << ", type = " << Type << ", class = "
|
||||
<< Class;
|
||||
void PIC16DbgInfo::EmitSymbol(std::string Name, short Class,
|
||||
unsigned short Type, unsigned long Value) {
|
||||
std::string Tmp;
|
||||
if (Value > 0)
|
||||
O << ", value = " << Value;
|
||||
Tmp = ", value = " + utostr(Value);
|
||||
|
||||
OS.EmitRawText("\n\t.def " + Twine(Name) + ", type = " + utostr(Type) +
|
||||
", class = " + utostr(Class) + Tmp);
|
||||
}
|
||||
|
||||
/// EmitVarDebugInfo - Emit debug information for all variables.
|
||||
@ -447,14 +452,13 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) {
|
||||
PopulateDebugInfo(Ty, TypeNo, HasAux, Aux, TagName);
|
||||
// Emit debug info only if type information is availaible.
|
||||
if (TypeNo != PIC16Dbg::T_NULL) {
|
||||
O << "\n\t.type " << VarName << ", " << TypeNo;
|
||||
OS.EmitRawText("\t.type " + Twine(VarName) + ", " + Twine(TypeNo));
|
||||
short ClassNo = getStorageClass(DIGV);
|
||||
O << "\n\t.class " << VarName << ", " << ClassNo;
|
||||
if (HasAux)
|
||||
OS.EmitRawText("\t.class " + Twine(VarName) + ", " + Twine(ClassNo));
|
||||
if (HasAux)
|
||||
EmitAuxEntry(VarName, Aux, PIC16Dbg::AuxSize, TagName);
|
||||
}
|
||||
}
|
||||
O << "\n";
|
||||
}
|
||||
|
||||
/// SwitchToCU - Switch to a new compilation unit.
|
||||
@ -470,8 +474,9 @@ void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
||||
if ( FilePath == CurFile ) return;
|
||||
|
||||
// Else, close the current one and start a new.
|
||||
if (CurFile != "") O << "\n\t.eof";
|
||||
O << "\n\t.file\t\"" << FilePath << "\"\n" ;
|
||||
if (CurFile != "")
|
||||
OS.EmitRawText(StringRef("\t.eof"));
|
||||
OS.EmitRawText("\n\t.file\t\"" + Twine(FilePath) + "\"");
|
||||
CurFile = FilePath;
|
||||
CurLine = 0;
|
||||
}
|
||||
@ -480,6 +485,6 @@ void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
||||
///
|
||||
void PIC16DbgInfo::EmitEOF() {
|
||||
if (CurFile != "")
|
||||
O << "\n\t.EOF";
|
||||
OS.EmitRawText(StringRef("\t.EOF"));
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
namespace llvm {
|
||||
class MachineFunction;
|
||||
class DebugLoc;
|
||||
class MCStreamer;
|
||||
|
||||
namespace PIC16Dbg {
|
||||
enum VarType {
|
||||
T_NULL,
|
||||
@ -88,10 +90,8 @@ namespace llvm {
|
||||
};
|
||||
}
|
||||
|
||||
class formatted_raw_ostream;
|
||||
|
||||
class PIC16DbgInfo {
|
||||
formatted_raw_ostream &O;
|
||||
MCStreamer &OS;
|
||||
const MCAsmInfo *MAI;
|
||||
std::string CurFile;
|
||||
unsigned CurLine;
|
||||
@ -101,8 +101,7 @@ namespace llvm {
|
||||
bool EmitDebugDirectives;
|
||||
|
||||
public:
|
||||
PIC16DbgInfo(formatted_raw_ostream &o, const MCAsmInfo *T)
|
||||
: O(o), MAI(T) {
|
||||
PIC16DbgInfo(MCStreamer &os, const MCAsmInfo *T) : OS(os), MAI(T) {
|
||||
CurFile = "";
|
||||
CurLine = 0;
|
||||
EmitDebugDirectives = false;
|
||||
|
@ -44,10 +44,8 @@
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
@ -60,9 +58,8 @@ namespace {
|
||||
const PPCSubtarget &Subtarget;
|
||||
uint64_t LabelID;
|
||||
public:
|
||||
explicit PPCAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer),
|
||||
explicit PPCAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer),
|
||||
Subtarget(TM.getSubtarget<PPCSubtarget>()), LabelID(0) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
@ -335,9 +332,8 @@ namespace {
|
||||
/// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux
|
||||
class PPCLinuxAsmPrinter : public PPCAsmPrinter {
|
||||
public:
|
||||
explicit PPCLinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: PPCAsmPrinter(O, TM, Streamer) {}
|
||||
explicit PPCLinuxAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: PPCAsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Linux PPC Assembly Printer";
|
||||
@ -358,11 +354,9 @@ namespace {
|
||||
/// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac
|
||||
/// OS X
|
||||
class PPCDarwinAsmPrinter : public PPCAsmPrinter {
|
||||
formatted_raw_ostream &OS;
|
||||
public:
|
||||
explicit PPCDarwinAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: PPCAsmPrinter(O, TM, Streamer), OS(O) {}
|
||||
explicit PPCDarwinAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: PPCAsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Darwin PPC Assembly Printer";
|
||||
@ -895,14 +889,13 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
||||
/// for a MachineFunction to the given output stream, in a format that the
|
||||
/// Darwin assembler can deal with.
|
||||
///
|
||||
static AsmPrinter *createPPCAsmPrinterPass(formatted_raw_ostream &o,
|
||||
TargetMachine &tm,
|
||||
static AsmPrinter *createPPCAsmPrinterPass(TargetMachine &tm,
|
||||
MCStreamer &Streamer) {
|
||||
const PPCSubtarget *Subtarget = &tm.getSubtarget<PPCSubtarget>();
|
||||
|
||||
if (Subtarget->isDarwin())
|
||||
return new PPCDarwinAsmPrinter(o, tm, Streamer);
|
||||
return new PPCLinuxAsmPrinter(o, tm, Streamer);
|
||||
return new PPCDarwinAsmPrinter(tm, Streamer);
|
||||
return new PPCLinuxAsmPrinter(tm, Streamer);
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
|
@ -25,15 +25,14 @@
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class SparcAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit SparcAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
explicit SparcAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Sparc Assembly Printer";
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
@ -34,16 +33,14 @@
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class SystemZAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
SystemZAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
SystemZAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "SystemZ Assembly Printer";
|
||||
@ -172,8 +169,7 @@ void SystemZAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
||||
}
|
||||
|
||||
switch (MO.getTargetFlags()) {
|
||||
default:
|
||||
llvm_unreachable("Unknown target flag on GV operand");
|
||||
default: assert(0 && "Unknown target flag on GV operand");
|
||||
case SystemZII::MO_NO_FLAG:
|
||||
break;
|
||||
case SystemZII::MO_GOTENT: O << "@GOTENT"; break;
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Target/Mangler.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
|
@ -35,9 +35,8 @@ class MCSymbol;
|
||||
class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
|
||||
const X86Subtarget *Subtarget;
|
||||
public:
|
||||
explicit X86AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {
|
||||
explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer) {
|
||||
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,7 @@
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
using namespace llvm;
|
||||
@ -54,10 +53,8 @@ namespace {
|
||||
class XCoreAsmPrinter : public AsmPrinter {
|
||||
const XCoreSubtarget &Subtarget;
|
||||
public:
|
||||
explicit XCoreAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer),
|
||||
Subtarget(TM.getSubtarget<XCoreSubtarget>()) {}
|
||||
explicit XCoreAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
||||
: AsmPrinter(TM, Streamer), Subtarget(TM.getSubtarget<XCoreSubtarget>()){}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "XCore Assembly Printer";
|
||||
|
Loading…
Reference in New Issue
Block a user