mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
Add a default implementation of createObjectStreamer.
This removes duplicated code from backends that don't need to do anything fancy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -58,6 +58,10 @@ namespace llvm {
|
|||||||
bool isVerboseAsm, bool useDwarfDirectory,
|
bool isVerboseAsm, bool useDwarfDirectory,
|
||||||
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
|
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
|
||||||
MCAsmBackend *TAB, bool ShowInst);
|
MCAsmBackend *TAB, bool ShowInst);
|
||||||
|
MCStreamer *createObjectStreamer(const Triple &T, MCContext &Ctx,
|
||||||
|
MCAsmBackend &TAB, raw_ostream &OS,
|
||||||
|
MCCodeEmitter *Emitter,
|
||||||
|
const MCSubtargetInfo &STI, bool RelaxAll);
|
||||||
|
|
||||||
MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx);
|
MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx);
|
||||||
|
|
||||||
@@ -419,7 +423,8 @@ namespace llvm {
|
|||||||
const MCSubtargetInfo &STI,
|
const MCSubtargetInfo &STI,
|
||||||
bool RelaxAll) const {
|
bool RelaxAll) const {
|
||||||
if (!MCObjectStreamerCtorFn)
|
if (!MCObjectStreamerCtorFn)
|
||||||
return nullptr;
|
return llvm::createObjectStreamer(T, Ctx, TAB, OS, Emitter, STI,
|
||||||
|
RelaxAll);
|
||||||
return MCObjectStreamerCtorFn(T, Ctx, TAB, OS, Emitter, STI, RelaxAll);
|
return MCObjectStreamerCtorFn(T, Ctx, TAB, OS, Emitter, STI, RelaxAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "llvm/MC/MCSection.h"
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
@@ -422,3 +423,16 @@ void MCObjectStreamer::FinishImpl() {
|
|||||||
flushPendingLabels(nullptr);
|
flushPendingLabels(nullptr);
|
||||||
getAssembler().Finish();
|
getAssembler().Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MCStreamer *llvm::createObjectStreamer(const Triple &T, MCContext &Ctx,
|
||||||
|
MCAsmBackend &TAB, raw_ostream &OS,
|
||||||
|
MCCodeEmitter *Emitter,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
|
bool RelaxAll) {
|
||||||
|
switch (T.getObjectFormat()) {
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
case Triple::ELF:
|
||||||
|
return createELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -47,15 +47,6 @@ static MCRegisterInfo *createHexagonMCRegisterInfo(StringRef TT) {
|
|||||||
return X;
|
return X;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MCStreamer *
|
|
||||||
createHexagonELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
|
||||||
raw_ostream &OS, MCCodeEmitter *CE,
|
|
||||||
bool RelaxAll) {
|
|
||||||
MCELFStreamer *ES = new MCELFStreamer(Context, MAB, OS, CE);
|
|
||||||
return ES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static MCSubtargetInfo *
|
static MCSubtargetInfo *
|
||||||
createHexagonMCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS) {
|
createHexagonMCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS) {
|
||||||
MCSubtargetInfo *X = new MCSubtargetInfo();
|
MCSubtargetInfo *X = new MCSubtargetInfo();
|
||||||
@@ -75,16 +66,6 @@ static MCAsmInfo *createHexagonMCAsmInfo(const MCRegisterInfo &MRI,
|
|||||||
return MAI;
|
return MAI;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
|
|
||||||
MCAsmBackend &MAB, raw_ostream &OS,
|
|
||||||
MCCodeEmitter *Emitter,
|
|
||||||
MCSubtargetInfo const &STI, bool RelaxAll) {
|
|
||||||
MCStreamer *ES = createHexagonELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
|
|
||||||
new MCTargetStreamer(*ES);
|
|
||||||
return ES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static MCCodeGenInfo *createHexagonMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
static MCCodeGenInfo *createHexagonMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
@@ -135,7 +116,4 @@ extern "C" void LLVMInitializeHexagonTargetMC() {
|
|||||||
// Register the asm backend
|
// Register the asm backend
|
||||||
TargetRegistry::RegisterMCAsmBackend(TheHexagonTarget,
|
TargetRegistry::RegisterMCAsmBackend(TheHexagonTarget,
|
||||||
createHexagonAsmBackend);
|
createHexagonAsmBackend);
|
||||||
|
|
||||||
// Register the obj streamer
|
|
||||||
TargetRegistry::RegisterMCObjectStreamer(TheHexagonTarget, createMCStreamer);
|
|
||||||
}
|
}
|
||||||
|
@@ -73,13 +73,6 @@ static MCInstPrinter *createAMDGPUMCInstPrinter(const Target &T,
|
|||||||
return new AMDGPUInstPrinter(MAI, MII, MRI);
|
return new AMDGPUInstPrinter(MAI, MII, MRI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MCStreamer *createMCStreamer(const Triple &T, MCContext &Ctx,
|
|
||||||
MCAsmBackend &MAB, raw_ostream &OS,
|
|
||||||
MCCodeEmitter *Emitter,
|
|
||||||
const MCSubtargetInfo &STI, bool RelaxAll) {
|
|
||||||
return createELFStreamer(Ctx, MAB, OS, Emitter, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void LLVMInitializeR600TargetMC() {
|
extern "C" void LLVMInitializeR600TargetMC() {
|
||||||
|
|
||||||
RegisterMCAsmInfo<AMDGPUMCAsmInfo> Y(TheAMDGPUTarget);
|
RegisterMCAsmInfo<AMDGPUMCAsmInfo> Y(TheAMDGPUTarget);
|
||||||
@@ -105,7 +98,4 @@ extern "C" void LLVMInitializeR600TargetMC() {
|
|||||||
|
|
||||||
TargetRegistry::RegisterMCAsmBackend(TheAMDGPUTarget, createAMDGPUAsmBackend);
|
TargetRegistry::RegisterMCAsmBackend(TheAMDGPUTarget, createAMDGPUAsmBackend);
|
||||||
TargetRegistry::RegisterMCAsmBackend(TheGCNTarget, createAMDGPUAsmBackend);
|
TargetRegistry::RegisterMCAsmBackend(TheGCNTarget, createAMDGPUAsmBackend);
|
||||||
|
|
||||||
TargetRegistry::RegisterMCObjectStreamer(TheAMDGPUTarget, createMCStreamer);
|
|
||||||
TargetRegistry::RegisterMCObjectStreamer(TheGCNTarget, createMCStreamer);
|
|
||||||
}
|
}
|
||||||
|
@@ -181,12 +181,6 @@ static MCInstPrinter *createSystemZMCInstPrinter(const Target &T,
|
|||||||
return new SystemZInstPrinter(MAI, MII, MRI);
|
return new SystemZInstPrinter(MAI, MII, MRI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MCStreamer *createSystemZMCObjectStreamer(
|
|
||||||
const Triple &T, MCContext &Ctx, MCAsmBackend &MAB, raw_ostream &OS,
|
|
||||||
MCCodeEmitter *Emitter, const MCSubtargetInfo &STI, bool RelaxAll) {
|
|
||||||
return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void LLVMInitializeSystemZTargetMC() {
|
extern "C" void LLVMInitializeSystemZTargetMC() {
|
||||||
// Register the MCAsmInfo.
|
// Register the MCAsmInfo.
|
||||||
TargetRegistry::RegisterMCAsmInfo(TheSystemZTarget,
|
TargetRegistry::RegisterMCAsmInfo(TheSystemZTarget,
|
||||||
@@ -219,8 +213,4 @@ extern "C" void LLVMInitializeSystemZTargetMC() {
|
|||||||
// Register the MCInstPrinter.
|
// Register the MCInstPrinter.
|
||||||
TargetRegistry::RegisterMCInstPrinter(TheSystemZTarget,
|
TargetRegistry::RegisterMCInstPrinter(TheSystemZTarget,
|
||||||
createSystemZMCInstPrinter);
|
createSystemZMCInstPrinter);
|
||||||
|
|
||||||
// Register the MCObjectStreamer;
|
|
||||||
TargetRegistry::RegisterMCObjectStreamer(TheSystemZTarget,
|
|
||||||
createSystemZMCObjectStreamer);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user