[MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.

MCObjectStreamer owns its MCAsmBackend -- this fixes the types to reflect that,
and allows us to remove another instance of MCObjectStreamer's weird "holding
ownership via someone else's reference" trick.

llvm-svn: 315410
This commit is contained in:
Lang Hames 2017-10-11 01:57:21 +00:00
parent 6b394caaf1
commit 02d330548d
39 changed files with 251 additions and 184 deletions

View File

@ -23,9 +23,8 @@ class MCInst;
class MCELFStreamer : public MCObjectStreamer {
public:
MCELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter)
: MCObjectStreamer(Context, TAB, OS, Emitter) {}
MCELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
~MCELFStreamer() override = default;
@ -90,7 +89,8 @@ private:
SmallVector<MCDataFragment *, 4> BundleGroups;
};
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MCELFStreamer *createARMELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool IsThumb);

View File

@ -35,6 +35,7 @@ class raw_pwrite_stream;
/// implementation.
class MCObjectStreamer : public MCStreamer {
std::unique_ptr<MCObjectWriter> ObjectWriter;
std::unique_ptr<MCAsmBackend> TAB;
std::unique_ptr<MCAssembler> Assembler;
MCSection::iterator CurInsertionPoint;
bool EmitEHFrame;
@ -47,8 +48,8 @@ class MCObjectStreamer : public MCStreamer {
MCSymbol *EmitCFILabel() override;
protected:
MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter);
MCObjectStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
~MCObjectStreamer() override;
public:

View File

@ -26,9 +26,10 @@ class raw_ostream;
class MCWasmStreamer : public MCObjectStreamer {
public:
MCWasmStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter)
: MCObjectStreamer(Context, TAB, OS, Emitter), SeenIdent(false) {}
MCWasmStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
: MCObjectStreamer(Context, std::move(TAB), OS, Emitter),
SeenIdent(false) {}
~MCWasmStreamer() override;

View File

@ -27,8 +27,8 @@ class raw_pwrite_stream;
class MCWinCOFFStreamer : public MCObjectStreamer {
public:
MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB, MCCodeEmitter &CE,
raw_pwrite_stream &OS);
MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
MCCodeEmitter &CE, raw_pwrite_stream &OS);
/// state management
void reset() override {

View File

@ -67,14 +67,17 @@ MCStreamer *createAsmStreamer(MCContext &Ctx,
MCAsmBackend *TAB, bool ShowInst);
/// Takes ownership of \p TAB and \p CE.
MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
MCStreamer *createELFStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll);
MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
MCStreamer *createMachOStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll, bool DWARFMustBeAtTheEnd,
bool LabelSections = false);
MCStreamer *createWasmStreamer(MCContext &Ctx, MCAsmBackend &TAB,
MCStreamer *createWasmStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll);
@ -135,25 +138,21 @@ public:
const MCRegisterInfo &MRI,
MCContext &Ctx);
using ELFStreamerCtorTy = MCStreamer *(*)(const Triple &T, MCContext &Ctx,
MCAsmBackend &TAB,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll);
using MachOStreamerCtorTy = MCStreamer *(*)(MCContext &Ctx, MCAsmBackend &TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll,
bool DWARFMustBeAtTheEnd);
using COFFStreamerCtorTy = MCStreamer *(*)(MCContext &Ctx, MCAsmBackend &TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll,
bool IncrementalLinkerCompatible);
using WasmStreamerCtorTy = MCStreamer *(*)(const Triple &T, MCContext &Ctx,
MCAsmBackend &TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll);
using MachOStreamerCtorTy =
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
bool RelaxAll, bool DWARFMustBeAtTheEnd);
using COFFStreamerCtorTy =
MCStreamer *(*)(MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
bool RelaxAll, bool IncrementalLinkerCompatible);
using WasmStreamerCtorTy = MCStreamer
*(*)(const Triple &T, MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll);
using NullTargetStreamerCtorTy = MCTargetStreamer *(*)(MCStreamer &S);
using AsmTargetStreamerCtorTy = MCTargetStreamer *(*)(
MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint,
@ -435,7 +434,8 @@ public:
/// \param Emitter The target independent assembler object.Takes ownership.
/// \param RelaxAll Relax all fixups?
MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
MCAsmBackend &TAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
const MCSubtargetInfo &STI, bool RelaxAll,
bool IncrementalLinkerCompatible,
@ -446,28 +446,28 @@ public:
llvm_unreachable("Unknown object format");
case Triple::COFF:
assert(T.isOSWindows() && "only Windows COFF is supported");
S = COFFStreamerCtorFn(Ctx, TAB, OS, Emitter, RelaxAll,
S = COFFStreamerCtorFn(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
IncrementalLinkerCompatible);
break;
case Triple::MachO:
if (MachOStreamerCtorFn)
S = MachOStreamerCtorFn(Ctx, TAB, OS, Emitter, RelaxAll,
S = MachOStreamerCtorFn(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
DWARFMustBeAtTheEnd);
else
S = createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
S = createMachOStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
DWARFMustBeAtTheEnd);
break;
case Triple::ELF:
if (ELFStreamerCtorFn)
S = ELFStreamerCtorFn(T, Ctx, TAB, OS, Emitter, RelaxAll);
S = ELFStreamerCtorFn(T, Ctx, std::move(TAB), OS, Emitter, RelaxAll);
else
S = createELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
S = createELFStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll);
break;
case Triple::Wasm:
if (WasmStreamerCtorFn)
S = WasmStreamerCtorFn(T, Ctx, TAB, OS, Emitter, RelaxAll);
S = WasmStreamerCtorFn(T, Ctx, std::move(TAB), OS, Emitter, RelaxAll);
else
S = createWasmStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
S = createWasmStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll);
break;
}
if (ObjectTargetStreamerCtorFn)

View File

@ -20,6 +20,7 @@
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstrInfo.h"
@ -163,7 +164,8 @@ bool LLVMTargetMachine::addAsmPrinter(PassManagerBase &PM,
Triple T(getTargetTriple().str());
AsmStreamer.reset(getTarget().createMCObjectStreamer(
T, Context, *MAB, Out, MCE, STI, Options.MCOptions.MCRelaxAll,
T, Context, std::unique_ptr<MCAsmBackend>(MAB), Out, MCE, STI,
Options.MCOptions.MCRelaxAll,
Options.MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ true));
break;
@ -238,7 +240,8 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
const Triple &T = getTargetTriple();
const MCSubtargetInfo &STI = *getMCSubtargetInfo();
std::unique_ptr<MCStreamer> AsmStreamer(getTarget().createMCObjectStreamer(
T, *Ctx, *MAB, Out, MCE, STI, Options.MCOptions.MCRelaxAll,
T, *Ctx, std::unique_ptr<MCAsmBackend>(MAB), Out, MCE, STI,
Options.MCOptions.MCRelaxAll,
Options.MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ true));

View File

@ -39,6 +39,11 @@
using namespace llvm;
MCELFStreamer::MCELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
: MCObjectStreamer(Context, std::move(TAB), OS, Emitter) {}
bool MCELFStreamer::isBundleLocked() const {
return getCurrentSectionOnly()->isBundleLocked();
}
@ -639,10 +644,11 @@ void MCELFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
llvm_unreachable("ELF doesn't support this directive");
}
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
MCStreamer *llvm::createELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll) {
MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
MCELFStreamer *S = new MCELFStreamer(Context, std::move(MAB), OS, CE);
if (RelaxAll)
S->getAssembler().setRelaxAll(true);
return S;

View File

@ -62,10 +62,12 @@ private:
void EmitDataRegionEnd();
public:
MCMachOStreamer(MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool DWARFMustBeAtTheEnd, bool label)
: MCObjectStreamer(Context, MAB, OS, Emitter), LabelSections(label),
DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd), CreatedADWARFSection(false) {}
MCMachOStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
bool DWARFMustBeAtTheEnd, bool label)
: MCObjectStreamer(Context, std::move(MAB), OS, Emitter),
LabelSections(label), DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd),
CreatedADWARFSection(false) {}
/// state management
void reset() override {
@ -483,11 +485,12 @@ void MCMachOStreamer::FinishImpl() {
this->MCObjectStreamer::FinishImpl();
}
MCStreamer *llvm::createMachOStreamer(MCContext &Context, MCAsmBackend &MAB,
MCStreamer *llvm::createMachOStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll, bool DWARFMustBeAtTheEnd,
bool LabelSections) {
MCMachOStreamer *S = new MCMachOStreamer(Context, MAB, OS, CE,
MCMachOStreamer *S = new MCMachOStreamer(Context, std::move(MAB), OS, CE,
DWARFMustBeAtTheEnd, LabelSections);
const Triple &TT = Context.getObjectFileInfo()->getTargetTriple();
if (TT.isOSDarwin()) {

View File

@ -25,16 +25,16 @@
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
MCObjectStreamer::MCObjectStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter_)
: MCStreamer(Context), ObjectWriter(TAB.createObjectWriter(OS)),
Assembler(llvm::make_unique<MCAssembler>(Context, TAB, *Emitter_,
*ObjectWriter)),
: MCStreamer(Context), ObjectWriter(TAB->createObjectWriter(OS)),
TAB(std::move(TAB)), Assembler(llvm::make_unique<MCAssembler>(
Context, *this->TAB, *Emitter_, *ObjectWriter)),
EmitEHFrame(true), EmitDebugFrame(false) {}
MCObjectStreamer::~MCObjectStreamer() {
delete &Assembler->getBackend();
delete &Assembler->getEmitter();
}

View File

@ -200,10 +200,11 @@ void MCWasmStreamer::FinishImpl() {
this->MCObjectStreamer::FinishImpl();
}
MCStreamer *llvm::createWasmStreamer(MCContext &Context, MCAsmBackend &MAB,
MCStreamer *llvm::createWasmStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll) {
MCWasmStreamer *S = new MCWasmStreamer(Context, MAB, OS, CE);
MCWasmStreamer *S = new MCWasmStreamer(Context, std::move(MAB), OS, CE);
if (RelaxAll)
S->getAssembler().setRelaxAll(true);
return S;

View File

@ -41,9 +41,10 @@ using namespace llvm;
#define DEBUG_TYPE "WinCOFFStreamer"
MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> MAB,
MCCodeEmitter &CE, raw_pwrite_stream &OS)
: MCObjectStreamer(Context, MAB, OS, &CE), CurSymbol(nullptr) {}
: MCObjectStreamer(Context, std::move(MAB), OS, &CE), CurSymbol(nullptr) {}
void MCWinCOFFStreamer::EmitInstToData(const MCInst &Inst,
const MCSubtargetInfo &STI) {

View File

@ -86,10 +86,10 @@ class AArch64ELFStreamer : public MCELFStreamer {
public:
friend class AArch64TargetELFStreamer;
AArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
AArch64ELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
: MCELFStreamer(Context, TAB, OS, Emitter), MappingSymbolCounter(0),
LastEMS(EMS_None) {}
: MCELFStreamer(Context, std::move(TAB), OS, Emitter),
MappingSymbolCounter(0), LastEMS(EMS_None) {}
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
// We have to keep track of the mapping symbol state of any sections we
@ -198,10 +198,12 @@ MCTargetStreamer *createAArch64AsmTargetStreamer(MCStreamer &S,
return new AArch64TargetAsmStreamer(S, OS);
}
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
AArch64ELFStreamer *S = new AArch64ELFStreamer(Context, TAB, OS, Emitter);
AArch64ELFStreamer *S =
new AArch64ELFStreamer(Context, std::move(TAB), OS, Emitter);
if (RelaxAll)
S->getAssembler().setRelaxAll(true);
return S;

View File

@ -18,7 +18,8 @@
namespace llvm {
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll);
}

View File

@ -100,26 +100,29 @@ static MCInstPrinter *createAArch64MCInstPrinter(const Triple &T,
}
static MCStreamer *createELFStreamer(const Triple &T, MCContext &Ctx,
MCAsmBackend &TAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
return createAArch64ELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
return createAArch64ELFStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll);
}
static MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
static MCStreamer *createMachOStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool DWARFMustBeAtTheEnd) {
return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
return createMachOStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
DWARFMustBeAtTheEnd,
/*LabelSections*/ true);
}
static MCStreamer *createWinCOFFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
static MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool IncrementalLinkerCompatible) {
return createAArch64WinCOFFStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
IncrementalLinkerCompatible);
return createAArch64WinCOFFStreamer(Ctx, std::move(TAB), OS, Emitter,
RelaxAll, IncrementalLinkerCompatible);
}
static MCInstrAnalysis *createAArch64InstrAnalysis(const MCInstrInfo *Info) {

View File

@ -17,19 +17,19 @@ class AArch64WinCOFFStreamer : public MCWinCOFFStreamer {
public:
friend class AArch64TargetWinCOFFStreamer;
AArch64WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter &CE,
raw_pwrite_stream &OS)
: MCWinCOFFStreamer(C, AB, CE, OS) {}
AArch64WinCOFFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> AB,
MCCodeEmitter &CE, raw_pwrite_stream &OS)
: MCWinCOFFStreamer(C, std::move(AB), CE, OS) {}
};
} // end anonymous namespace
namespace llvm {
MCWinCOFFStreamer
*createAArch64WinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool IncrementalLinkerCompatible) {
auto *S = new AArch64WinCOFFStreamer(Context, MAB, *Emitter, OS);
MCWinCOFFStreamer *
createAArch64WinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
bool RelaxAll, bool IncrementalLinkerCompatible) {
auto *S = new AArch64WinCOFFStreamer(Context, std::move(MAB), *Emitter, OS);
S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
return S;
}

View File

@ -15,6 +15,7 @@
#define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64WINCOFFSTREAMER_H
#include "AArch64TargetStreamer.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCWinCOFFStreamer.h"
namespace {
@ -33,11 +34,11 @@ public:
namespace llvm {
MCWinCOFFStreamer
*createAArch64WinCOFFStreamer(MCContext &Context, MCAsmBackend &TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool IncrementalLinkerCompatible);
MCWinCOFFStreamer *
createAArch64WinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
bool RelaxAll, bool IncrementalLinkerCompatible);
} // end llvm namespace
#endif

View File

@ -10,13 +10,15 @@
#include "AMDGPUELFStreamer.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
using namespace llvm;
AMDGPUELFStreamer::AMDGPUELFStreamer(const Triple &T, MCContext &Context,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter)
: MCELFStreamer(Context, MAB, OS, Emitter) {
: MCELFStreamer(Context, std::move(MAB), OS, Emitter) {
unsigned Arch = ELF::EF_AMDGPU_ARCH_NONE;
switch (T.getArch()) {
case Triple::r600:
@ -36,10 +38,8 @@ AMDGPUELFStreamer::AMDGPUELFStreamer(const Triple &T, MCContext &Context,
MCA.setELFHeaderEFlags(EFlags);
}
MCELFStreamer *llvm::createAMDGPUELFStreamer(const Triple &T, MCContext &Context,
MCAsmBackend &MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll) {
return new AMDGPUELFStreamer(T, Context, MAB, OS, Emitter);
MCELFStreamer *llvm::createAMDGPUELFStreamer(
const Triple &T, MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll) {
return new AMDGPUELFStreamer(T, Context, std::move(MAB), OS, Emitter);
}

View File

@ -25,12 +25,14 @@ class MCSubtargetInfo;
class AMDGPUELFStreamer : public MCELFStreamer {
public:
AMDGPUELFStreamer(const Triple &T, MCContext &Context, MCAsmBackend &MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
AMDGPUELFStreamer(const Triple &T, MCContext &Context,
std::unique_ptr<MCAsmBackend> MAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter);
};
MCELFStreamer *createAMDGPUELFStreamer(const Triple &T, MCContext &Context,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll);
} // namespace llvm.

View File

@ -18,6 +18,7 @@
#include "AMDGPUTargetStreamer.h"
#include "InstPrinter/AMDGPUInstPrinter.h"
#include "SIDefines.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
@ -78,9 +79,11 @@ static MCTargetStreamer * createAMDGPUObjectTargetStreamer(
}
static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
return createAMDGPUELFStreamer(T, Context, MAB, OS, Emitter, RelaxAll);
return createAMDGPUELFStreamer(T, Context, std::move(MAB), OS, Emitter,
RelaxAll);
}
extern "C" void LLVMInitializeAMDGPUTargetMC() {

View File

@ -440,9 +440,9 @@ class ARMELFStreamer : public MCELFStreamer {
public:
friend class ARMTargetELFStreamer;
ARMELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool IsThumb)
: MCELFStreamer(Context, TAB, OS, Emitter), IsThumb(IsThumb) {
ARMELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool IsThumb)
: MCELFStreamer(Context, std::move(TAB), OS, Emitter), IsThumb(IsThumb) {
EHReset();
}
@ -1485,19 +1485,21 @@ MCTargetStreamer *createARMObjectTargetStreamer(MCStreamer &S,
return new ARMTargetStreamer(S);
}
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MCELFStreamer *createARMELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool IsThumb) {
ARMELFStreamer *S = new ARMELFStreamer(Context, TAB, OS, Emitter, IsThumb);
// FIXME: This should eventually end up somewhere else where more
// intelligent flag decisions can be made. For now we are just maintaining
// the status quo for ARM and setting EF_ARM_EABI_VER5 as the default.
S->getAssembler().setELFHeaderEFlags(ELF::EF_ARM_EABI_VER5);
ARMELFStreamer *S =
new ARMELFStreamer(Context, std::move(TAB), OS, Emitter, IsThumb);
// FIXME: This should eventually end up somewhere else where more
// intelligent flag decisions can be made. For now we are just maintaining
// the status quo for ARM and setting EF_ARM_EABI_VER5 as the default.
S->getAssembler().setELFHeaderEFlags(ELF::EF_ARM_EABI_VER5);
if (RelaxAll)
S->getAssembler().setRelaxAll(true);
return S;
if (RelaxAll)
S->getAssembler().setRelaxAll(true);
return S;
}
} // end namespace llvm

View File

@ -16,6 +16,7 @@
#include "ARMMCAsmInfo.h"
#include "InstPrinter/ARMInstPrinter.h"
#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCInstrAnalysis.h"
#include "llvm/MC/MCInstrInfo.h"
@ -198,18 +199,21 @@ static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI,
}
static MCStreamer *createELFStreamer(const Triple &T, MCContext &Ctx,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
return createARMELFStreamer(Ctx, MAB, OS, Emitter, false,
(T.getArch() == Triple::thumb ||
T.getArch() == Triple::thumbeb));
return createARMELFStreamer(
Ctx, std::move(MAB), OS, Emitter, false,
(T.getArch() == Triple::thumb || T.getArch() == Triple::thumbeb));
}
static MCStreamer *createARMMachOStreamer(MCContext &Ctx, MCAsmBackend &MAB,
static MCStreamer *createARMMachOStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool DWARFMustBeAtTheEnd) {
return createMachOStreamer(Ctx, MAB, OS, Emitter, false, DWARFMustBeAtTheEnd);
return createMachOStreamer(Ctx, std::move(MAB), OS, Emitter, false,
DWARFMustBeAtTheEnd);
}
static MCInstPrinter *createARMMCInstPrinter(const Triple &T,

View File

@ -93,7 +93,8 @@ MCAsmBackend *createThumbBEAsmBackend(const Target &T,
// Construct a PE/COFF machine code streamer which will generate a PE/COFF
// object file.
MCStreamer *createARMWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
MCStreamer *createARMWinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll,
bool IncrementalLinkerCompatible);

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "ARMMCTargetDesc.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCWinCOFFStreamer.h"
using namespace llvm;
@ -15,9 +16,9 @@ using namespace llvm;
namespace {
class ARMWinCOFFStreamer : public MCWinCOFFStreamer {
public:
ARMWinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter &CE,
raw_pwrite_stream &OS)
: MCWinCOFFStreamer(C, AB, CE, OS) {}
ARMWinCOFFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> AB,
MCCodeEmitter &CE, raw_pwrite_stream &OS)
: MCWinCOFFStreamer(C, std::move(AB), CE, OS) {}
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Symbol) override;
@ -37,10 +38,13 @@ void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) {
}
}
MCStreamer *llvm::createARMWinCOFFStreamer(
MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll, bool IncrementalLinkerCompatible) {
auto *S = new ARMWinCOFFStreamer(Context, MAB, *Emitter, OS);
MCStreamer *llvm::createARMWinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll,
bool IncrementalLinkerCompatible) {
auto *S = new ARMWinCOFFStreamer(Context, std::move(MAB), *Emitter, OS);
S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
return S;
}

View File

@ -49,11 +49,11 @@ static MCSubtargetInfo *createBPFMCSubtargetInfo(const Triple &TT,
return createBPFMCSubtargetInfoImpl(TT, CPU, FS);
}
static MCStreamer *createBPFMCStreamer(const Triple &T,
MCContext &Ctx, MCAsmBackend &MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
bool RelaxAll) {
return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
static MCStreamer *createBPFMCStreamer(const Triple &T, MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
return createELFStreamer(Ctx, std::move(MAB), OS, Emitter, RelaxAll);
}
static MCInstPrinter *createBPFMCInstPrinter(const Triple &T,

View File

@ -18,6 +18,7 @@
#include "MCTargetDesc/HexagonMCShuffler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@ -43,6 +44,21 @@ static cl::opt<unsigned> GPSize
cl::Prefix,
cl::init(8));
HexagonMCELFStreamer::HexagonMCELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter)
: MCELFStreamer(Context, std::move(TAB), OS, Emitter),
MCII(createHexagonMCInstrInfo()) {}
HexagonMCELFStreamer::HexagonMCELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
MCAssembler *Assembler)
: MCELFStreamer(Context, std::move(TAB), OS, Emitter),
MCII(createHexagonMCInstrInfo()) {}
void HexagonMCELFStreamer::EmitInstruction(const MCInst &MCB,
const MCSubtargetInfo &STI, bool) {
assert(MCB.getOpcode() == Hexagon::BUNDLE);
@ -149,10 +165,10 @@ void HexagonMCELFStreamer::HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol,
namespace llvm {
MCStreamer *createHexagonELFStreamer(Triple const &TT, MCContext &Context,
MCAsmBackend &MAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE) {
return new HexagonMCELFStreamer(Context, MAB, OS, CE);
MCStreamer *createHexagonELFStreamer(Triple const &TT, MCContext &Context,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE) {
return new HexagonMCELFStreamer(Context, std::move(MAB), OS, CE);
}
} // end namespace llvm

View File

@ -22,17 +22,12 @@ class HexagonMCELFStreamer : public MCELFStreamer {
std::unique_ptr<MCInstrInfo> MCII;
public:
HexagonMCELFStreamer(MCContext &Context, MCAsmBackend &TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
: MCELFStreamer(Context, TAB, OS, Emitter),
MCII(createHexagonMCInstrInfo()) {}
HexagonMCELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
HexagonMCELFStreamer(MCContext &Context,
MCAsmBackend &TAB,
HexagonMCELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
MCAssembler *Assembler) :
MCELFStreamer(Context, TAB, OS, Emitter),
MCII (createHexagonMCInstrInfo()) {}
MCAssembler *Assembler);
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
bool) override;
@ -45,8 +40,8 @@ public:
};
MCStreamer *createHexagonELFStreamer(Triple const &TT, MCContext &Context,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
MCCodeEmitter *CE);
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *CE);
} // end namespace llvm

View File

@ -20,6 +20,7 @@
#include "MCTargetDesc/HexagonMCInstrInfo.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCELFStreamer.h"
@ -224,13 +225,11 @@ createMCAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS,
return new HexagonTargetAsmStreamer(S, OS, IsVerboseAsm, *IP);
}
static MCStreamer *createMCStreamer(Triple const &T,
MCContext &Context,
MCAsmBackend &MAB,
static MCStreamer *createMCStreamer(Triple const &T, MCContext &Context,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll) {
return createHexagonELFStreamer(T, Context, MAB, OS, Emitter);
MCCodeEmitter *Emitter, bool RelaxAll) {
return createHexagonELFStreamer(T, Context, std::move(MAB), OS, Emitter);
}
static MCTargetStreamer *

View File

@ -60,12 +60,13 @@ createLanaiMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
}
static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
if (!T.isOSBinFormatELF())
llvm_unreachable("OS not supported");
return createELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
return createELFStreamer(Context, std::move(MAB), OS, Emitter, RelaxAll);
}
static MCInstPrinter *createLanaiMCInstPrinter(const Triple & /*T*/,

View File

@ -11,6 +11,7 @@
#include "MipsOptionRecord.h"
#include "MipsTargetStreamer.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
@ -19,6 +20,15 @@
using namespace llvm;
MipsELFStreamer::MipsELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
: MCELFStreamer(Context, std::move(MAB), OS, Emitter) {
RegInfoRecord = new MipsRegInfoRecord(this, Context);
MipsOptionRecords.push_back(
std::unique_ptr<MipsRegInfoRecord>(RegInfoRecord));
}
void MipsELFStreamer::EmitInstruction(const MCInst &Inst,
const MCSubtargetInfo &STI, bool) {
MCELFStreamer::EmitInstruction(Inst, STI);
@ -78,9 +88,9 @@ void MipsELFStreamer::EmitMipsOptionRecords() {
}
MCELFStreamer *llvm::createMipsELFStreamer(MCContext &Context,
MCAsmBackend &MAB,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll) {
return new MipsELFStreamer(Context, MAB, OS, Emitter);
return new MipsELFStreamer(Context, std::move(MAB), OS, Emitter);
}

View File

@ -33,13 +33,8 @@ class MipsELFStreamer : public MCELFStreamer {
SmallVector<MCSymbol*, 4> Labels;
public:
MipsELFStreamer(MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter)
: MCELFStreamer(Context, MAB, OS, Emitter) {
RegInfoRecord = new MipsRegInfoRecord(this, Context);
MipsOptionRecords.push_back(
std::unique_ptr<MipsRegInfoRecord>(RegInfoRecord));
}
MipsELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
/// Overriding this function allows us to add arbitrary behaviour before the
/// \p Inst is actually emitted. For example, we can inspect the operands and
@ -69,7 +64,8 @@ public:
void createPendingLabelRelocs();
};
MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
MCELFStreamer *createMipsELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll);
} // end namespace llvm

View File

@ -22,7 +22,8 @@ bool isBasePlusOffsetMemoryAccess(unsigned Opcode, unsigned *AddrIdx,
bool baseRegNeedsLoadStoreMask(unsigned Reg);
// This function creates an MCELFStreamer for Mips NaCl.
MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll);
}

View File

@ -91,13 +91,15 @@ static MCInstPrinter *createMipsMCInstPrinter(const Triple &T,
}
static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
std::unique_ptr<MCAsmBackend> &&MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
MCStreamer *S;
if (!T.isOSNaCl())
S = createMipsELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
S = createMipsELFStreamer(Context, std::move(MAB), OS, Emitter, RelaxAll);
else
S = createMipsNaClELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
S = createMipsNaClELFStreamer(Context, std::move(MAB), OS, Emitter,
RelaxAll);
return S;
}

View File

@ -20,6 +20,7 @@
#include "Mips.h"
#include "MipsELFStreamer.h"
#include "MipsMCNaCl.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCInst.h"
@ -40,9 +41,9 @@ const unsigned LoadStoreStackMaskReg = Mips::T7;
class MipsNaClELFStreamer : public MipsELFStreamer {
public:
MipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MipsNaClELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
: MipsELFStreamer(Context, TAB, OS, Emitter) {}
: MipsELFStreamer(Context, std::move(TAB), OS, Emitter) {}
~MipsNaClELFStreamer() override = default;
@ -255,11 +256,13 @@ bool baseRegNeedsLoadStoreMask(unsigned Reg) {
return Reg != Mips::SP && Reg != Mips::T8;
}
MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll) {
MipsNaClELFStreamer *S = new MipsNaClELFStreamer(Context, TAB, OS, Emitter);
MipsNaClELFStreamer *S =
new MipsNaClELFStreamer(Context, std::move(TAB), OS, Emitter);
if (RelaxAll)
S->getAssembler().setRelaxAll(true);

View File

@ -81,9 +81,11 @@ MCAsmBackend *createX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI,
/// PE/COFF format object files.
///
/// Takes ownership of \p AB and \p CE.
MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
MCStreamer *createX86WinCOFFStreamer(MCContext &C,
std::unique_ptr<MCAsmBackend> &&AB,
raw_pwrite_stream &OS, MCCodeEmitter *CE,
bool RelaxAll, bool IncrementalLinkerCompatible);
bool RelaxAll,
bool IncrementalLinkerCompatible);
/// Construct an X86 Mach-O object writer.
std::unique_ptr<MCObjectWriter> createX86MachObjectWriter(raw_pwrite_stream &OS,

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "X86MCTargetDesc.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCWin64EH.h"
#include "llvm/MC/MCWinCOFFStreamer.h"
@ -17,9 +18,9 @@ namespace {
class X86WinCOFFStreamer : public MCWinCOFFStreamer {
Win64EH::UnwindEmitter EHStreamer;
public:
X86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter *CE,
raw_pwrite_stream &OS)
: MCWinCOFFStreamer(C, AB, *CE, OS) {}
X86WinCOFFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> AB,
MCCodeEmitter *CE, raw_pwrite_stream &OS)
: MCWinCOFFStreamer(C, std::move(AB), *CE, OS) {}
void EmitWinEHHandlerData(SMLoc Loc) override;
void EmitWindowsUnwindTables() override;
@ -48,11 +49,12 @@ void X86WinCOFFStreamer::FinishImpl() {
}
}
MCStreamer *llvm::createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
MCStreamer *llvm::createX86WinCOFFStreamer(MCContext &C,
std::unique_ptr<MCAsmBackend> &&AB,
raw_pwrite_stream &OS,
MCCodeEmitter *CE, bool RelaxAll,
bool IncrementalLinkerCompatible) {
X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, AB, CE, OS);
X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, std::move(AB), CE, OS);
S->getAssembler().setRelaxAll(RelaxAll);
S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
return S;

View File

@ -623,8 +623,8 @@ bool DwarfStreamer::init(Triple TheTriple, StringRef OutputFilename) {
MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
MS = TheTarget->createMCObjectStreamer(
TheTriple, *MC, *MAB, *OutFile, MCE, *MSTI, MCOptions.MCRelaxAll,
MCOptions.MCIncrementalLinkerCompatible,
TheTriple, *MC, std::unique_ptr<MCAsmBackend>(MAB), *OutFile, MCE, *MSTI,
MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ false);
if (!MS)
return error("no object streamer for target " + TripleName, Context);

View File

@ -20,6 +20,7 @@
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstrInfo.h"
@ -706,8 +707,8 @@ int main(int argc, char **argv) {
MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
std::unique_ptr<MCStreamer> MS(TheTarget->createMCObjectStreamer(
TheTriple, MC, *MAB, OutFile, MCE, *MSTI, MCOptions.MCRelaxAll,
MCOptions.MCIncrementalLinkerCompatible,
TheTriple, MC, std::unique_ptr<MCAsmBackend>(MAB), OutFile, MCE, *MSTI,
MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ false));
if (!MS)
return error("no object streamer for target " + TripleName, Context);

View File

@ -591,8 +591,8 @@ int main(int argc, char **argv) {
MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU,
MCOptions);
Str.reset(TheTarget->createMCObjectStreamer(
TheTriple, Ctx, *MAB, *OS, CE, *STI, MCOptions.MCRelaxAll,
MCOptions.MCIncrementalLinkerCompatible,
TheTriple, Ctx, std::unique_ptr<MCAsmBackend>(MAB), *OS, CE, *STI,
MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ false));
if (NoExecStack)
Str->InitSections(true);

View File

@ -181,8 +181,8 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
MS = TheTarget->createMCObjectStreamer(
TheTriple, *MC, *MAB, *Stream, MCE, *MSTI, MCOptions.MCRelaxAll,
MCOptions.MCIncrementalLinkerCompatible,
TheTriple, *MC, std::unique_ptr<MCAsmBackend>(MAB), *Stream, MCE, *MSTI,
MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ false);
if (!MS)
return make_error<StringError>("no object streamer for target " +