llvm.org GIT mirror llvm / 445025a
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315410 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 1 year, 11 months ago
39 changed file(s) with 254 addition(s) and 187 deletion(s). Raw diff Collapse all Expand all
2222
2323 class MCELFStreamer : public MCObjectStreamer {
2424 public:
25 MCELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
26 MCCodeEmitter *Emitter)
27 : MCObjectStreamer(Context, TAB, OS, Emitter) {}
25 MCELFStreamer(MCContext &Context, std::unique_ptr TAB,
26 raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
2827
2928 ~MCELFStreamer() override = default;
3029
8988 SmallVector BundleGroups;
9089 };
9190
92 MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
91 MCELFStreamer *createARMELFStreamer(MCContext &Context,
92 std::unique_ptr TAB,
9393 raw_pwrite_stream &OS,
9494 MCCodeEmitter *Emitter, bool RelaxAll,
9595 bool IsThumb);
3434 /// implementation.
3535 class MCObjectStreamer : public MCStreamer {
3636 std::unique_ptr ObjectWriter;
37 std::unique_ptr TAB;
3738 std::unique_ptr Assembler;
3839 MCSection::iterator CurInsertionPoint;
3940 bool EmitEHFrame;
4647 MCSymbol *EmitCFILabel() override;
4748
4849 protected:
49 MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
50 MCCodeEmitter *Emitter);
50 MCObjectStreamer(MCContext &Context, std::unique_ptr TAB,
51 raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
5152 ~MCObjectStreamer() override;
5253
5354 public:
2525
2626 class MCWasmStreamer : public MCObjectStreamer {
2727 public:
28 MCWasmStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
29 MCCodeEmitter *Emitter)
30 : MCObjectStreamer(Context, TAB, OS, Emitter), SeenIdent(false) {}
28 MCWasmStreamer(MCContext &Context, std::unique_ptr TAB,
29 raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
30 : MCObjectStreamer(Context, std::move(TAB), OS, Emitter),
31 SeenIdent(false) {}
3132
3233 ~MCWasmStreamer() override;
3334
2626
2727 class MCWinCOFFStreamer : public MCObjectStreamer {
2828 public:
29 MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB, MCCodeEmitter &CE,
30 raw_pwrite_stream &OS);
29 MCWinCOFFStreamer(MCContext &Context, std::unique_ptr MAB,
30 MCCodeEmitter &CE, raw_pwrite_stream &OS);
3131
3232 /// state management
3333 void reset() override {
6666 MCAsmBackend *TAB, bool ShowInst);
6767
6868 /// Takes ownership of \p TAB and \p CE.
69 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
69 MCStreamer *createELFStreamer(MCContext &Ctx,
70 std::unique_ptr &&TAB,
7071 raw_pwrite_stream &OS, MCCodeEmitter *CE,
7172 bool RelaxAll);
72 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
73 MCStreamer *createMachOStreamer(MCContext &Ctx,
74 std::unique_ptr &&TAB,
7375 raw_pwrite_stream &OS, MCCodeEmitter *CE,
7476 bool RelaxAll, bool DWARFMustBeAtTheEnd,
7577 bool LabelSections = false);
76 MCStreamer *createWasmStreamer(MCContext &Ctx, MCAsmBackend &TAB,
78 MCStreamer *createWasmStreamer(MCContext &Ctx,
79 std::unique_ptr &&TAB,
7780 raw_pwrite_stream &OS, MCCodeEmitter *CE,
7881 bool RelaxAll);
7982
134137 const MCRegisterInfo &MRI,
135138 MCContext &Ctx);
136139 using ELFStreamerCtorTy = MCStreamer *(*)(const Triple &T, MCContext &Ctx,
137 MCAsmBackend &TAB,
140 std::unique_ptr &&TAB,
138141 raw_pwrite_stream &OS,
139142 MCCodeEmitter *Emitter,
140143 bool RelaxAll);
141 using MachOStreamerCtorTy = MCStreamer *(*)(MCContext &Ctx, MCAsmBackend &TAB,
142 raw_pwrite_stream &OS,
143 MCCodeEmitter *Emitter,
144 bool RelaxAll,
145 bool DWARFMustBeAtTheEnd);
146 using COFFStreamerCtorTy = MCStreamer *(*)(MCContext &Ctx, MCAsmBackend &TAB,
147 raw_pwrite_stream &OS,
148 MCCodeEmitter *Emitter,
149 bool RelaxAll,
150 bool IncrementalLinkerCompatible);
151 using WasmStreamerCtorTy = MCStreamer *(*)(const Triple &T, MCContext &Ctx,
152 MCAsmBackend &TAB,
153 raw_pwrite_stream &OS,
154 MCCodeEmitter *Emitter,
155 bool RelaxAll);
144 using MachOStreamerCtorTy =
145 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr &&TAB,
146 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
147 bool RelaxAll, bool DWARFMustBeAtTheEnd);
148 using COFFStreamerCtorTy =
149 MCStreamer *(*)(MCContext &Ctx, std::unique_ptr &&TAB,
150 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
151 bool RelaxAll, bool IncrementalLinkerCompatible);
152 using WasmStreamerCtorTy = MCStreamer
153 *(*)(const Triple &T, MCContext &Ctx, std::unique_ptr &&TAB,
154 raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll);
156155 using NullTargetStreamerCtorTy = MCTargetStreamer *(*)(MCStreamer &S);
157156 using AsmTargetStreamerCtorTy = MCTargetStreamer *(*)(
158157 MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint,
434433 /// \param Emitter The target independent assembler object.Takes ownership.
435434 /// \param RelaxAll Relax all fixups?
436435 MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
437 MCAsmBackend &TAB, raw_pwrite_stream &OS,
436 std::unique_ptr &&TAB,
437 raw_pwrite_stream &OS,
438438 MCCodeEmitter *Emitter,
439439 const MCSubtargetInfo &STI, bool RelaxAll,
440440 bool IncrementalLinkerCompatible,
445445 llvm_unreachable("Unknown object format");
446446 case Triple::COFF:
447447 assert(T.isOSWindows() && "only Windows COFF is supported");
448 S = COFFStreamerCtorFn(Ctx, TAB, OS, Emitter, RelaxAll,
448 S = COFFStreamerCtorFn(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
449449 IncrementalLinkerCompatible);
450450 break;
451451 case Triple::MachO:
452452 if (MachOStreamerCtorFn)
453 S = MachOStreamerCtorFn(Ctx, TAB, OS, Emitter, RelaxAll,
453 S = MachOStreamerCtorFn(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
454454 DWARFMustBeAtTheEnd);
455455 else
456 S = createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
456 S = createMachOStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
457457 DWARFMustBeAtTheEnd);
458458 break;
459459 case Triple::ELF:
460460 if (ELFStreamerCtorFn)
461 S = ELFStreamerCtorFn(T, Ctx, TAB, OS, Emitter, RelaxAll);
461 S = ELFStreamerCtorFn(T, Ctx, std::move(TAB), OS, Emitter, RelaxAll);
462462 else
463 S = createELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
463 S = createELFStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll);
464464 break;
465465 case Triple::Wasm:
466466 if (WasmStreamerCtorFn)
467 S = WasmStreamerCtorFn(T, Ctx, TAB, OS, Emitter, RelaxAll);
467 S = WasmStreamerCtorFn(T, Ctx, std::move(TAB), OS, Emitter, RelaxAll);
468468 else
469 S = createWasmStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
469 S = createWasmStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll);
470470 break;
471471 }
472472 if (ObjectTargetStreamerCtorFn)
1919 #include "llvm/IR/IRPrintingPasses.h"
2020 #include "llvm/IR/LegacyPassManager.h"
2121 #include "llvm/IR/Verifier.h"
22 #include "llvm/MC/MCAsmBackend.h"
2223 #include "llvm/MC/MCAsmInfo.h"
2324 #include "llvm/MC/MCContext.h"
2425 #include "llvm/MC/MCInstrInfo.h"
162163
163164 Triple T(getTargetTriple().str());
164165 AsmStreamer.reset(getTarget().createMCObjectStreamer(
165 T, Context, *MAB, Out, MCE, STI, Options.MCOptions.MCRelaxAll,
166 T, Context, std::unique_ptr(MAB), Out, MCE, STI,
167 Options.MCOptions.MCRelaxAll,
166168 Options.MCOptions.MCIncrementalLinkerCompatible,
167169 /*DWARFMustBeAtTheEnd*/ true));
168170 break;
237239 const Triple &T = getTargetTriple();
238240 const MCSubtargetInfo &STI = *getMCSubtargetInfo();
239241 std::unique_ptr AsmStreamer(getTarget().createMCObjectStreamer(
240 T, *Ctx, *MAB, Out, MCE, STI, Options.MCOptions.MCRelaxAll,
242 T, *Ctx, std::unique_ptr(MAB), Out, MCE, STI,
243 Options.MCOptions.MCRelaxAll,
241244 Options.MCOptions.MCIncrementalLinkerCompatible,
242245 /*DWARFMustBeAtTheEnd*/ true));
243246
3737 #include
3838
3939 using namespace llvm;
40
41 MCELFStreamer::MCELFStreamer(MCContext &Context,
42 std::unique_ptr TAB,
43 raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
44 : MCObjectStreamer(Context, std::move(TAB), OS, Emitter) {}
4045
4146 bool MCELFStreamer::isBundleLocked() const {
4247 return getCurrentSectionOnly()->isBundleLocked();
638643 llvm_unreachable("ELF doesn't support this directive");
639644 }
640645
641 MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
646 MCStreamer *llvm::createELFStreamer(MCContext &Context,
647 std::unique_ptr &&MAB,
642648 raw_pwrite_stream &OS, MCCodeEmitter *CE,
643649 bool RelaxAll) {
644 MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
650 MCELFStreamer *S = new MCELFStreamer(Context, std::move(MAB), OS, CE);
645651 if (RelaxAll)
646652 S->getAssembler().setRelaxAll(true);
647653 return S;
6161 void EmitDataRegionEnd();
6262
6363 public:
64 MCMachOStreamer(MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS,
65 MCCodeEmitter *Emitter, bool DWARFMustBeAtTheEnd, bool label)
66 : MCObjectStreamer(Context, MAB, OS, Emitter), LabelSections(label),
67 DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd), CreatedADWARFSection(false) {}
64 MCMachOStreamer(MCContext &Context, std::unique_ptr MAB,
65 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
66 bool DWARFMustBeAtTheEnd, bool label)
67 : MCObjectStreamer(Context, std::move(MAB), OS, Emitter),
68 LabelSections(label), DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd),
69 CreatedADWARFSection(false) {}
6870
6971 /// state management
7072 void reset() override {
482484 this->MCObjectStreamer::FinishImpl();
483485 }
484486
485 MCStreamer *llvm::createMachOStreamer(MCContext &Context, MCAsmBackend &MAB,
487 MCStreamer *llvm::createMachOStreamer(MCContext &Context,
488 std::unique_ptr &&MAB,
486489 raw_pwrite_stream &OS, MCCodeEmitter *CE,
487490 bool RelaxAll, bool DWARFMustBeAtTheEnd,
488491 bool LabelSections) {
489 MCMachOStreamer *S = new MCMachOStreamer(Context, MAB, OS, CE,
492 MCMachOStreamer *S = new MCMachOStreamer(Context, std::move(MAB), OS, CE,
490493 DWARFMustBeAtTheEnd, LabelSections);
491494 const Triple &TT = Context.getObjectFileInfo()->getTargetTriple();
492495 if (TT.isOSDarwin()) {
2424 #include "llvm/Support/TargetRegistry.h"
2525 using namespace llvm;
2626
27 MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
27 MCObjectStreamer::MCObjectStreamer(MCContext &Context,
28 std::unique_ptr TAB,
2829 raw_pwrite_stream &OS,
2930 MCCodeEmitter *Emitter_)
30 : MCStreamer(Context), ObjectWriter(TAB.createObjectWriter(OS)),
31 Assembler(llvm::make_unique(Context, TAB, *Emitter_,
32 *ObjectWriter)),
31 : MCStreamer(Context), ObjectWriter(TAB->createObjectWriter(OS)),
32 TAB(std::move(TAB)), Assembler(llvm::make_unique(
33 Context, *this->TAB, *Emitter_, *ObjectWriter)),
3334 EmitEHFrame(true), EmitDebugFrame(false) {}
3435
3536 MCObjectStreamer::~MCObjectStreamer() {
36 delete &Assembler->getBackend();
3737 delete &Assembler->getEmitter();
3838 }
3939
199199 this->MCObjectStreamer::FinishImpl();
200200 }
201201
202 MCStreamer *llvm::createWasmStreamer(MCContext &Context, MCAsmBackend &MAB,
202 MCStreamer *llvm::createWasmStreamer(MCContext &Context,
203 std::unique_ptr &&MAB,
203204 raw_pwrite_stream &OS, MCCodeEmitter *CE,
204205 bool RelaxAll) {
205 MCWasmStreamer *S = new MCWasmStreamer(Context, MAB, OS, CE);
206 MCWasmStreamer *S = new MCWasmStreamer(Context, std::move(MAB), OS, CE);
206207 if (RelaxAll)
207208 S->getAssembler().setRelaxAll(true);
208209 return S;
4040
4141 #define DEBUG_TYPE "WinCOFFStreamer"
4242
43 MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
43 MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context,
44 std::unique_ptr MAB,
4445 MCCodeEmitter &CE, raw_pwrite_stream &OS)
45 : MCObjectStreamer(Context, MAB, OS, &CE), CurSymbol(nullptr) {}
46 : MCObjectStreamer(Context, std::move(MAB), OS, &CE), CurSymbol(nullptr) {}
4647
4748 void MCWinCOFFStreamer::EmitInstToData(const MCInst &Inst,
4849 const MCSubtargetInfo &STI) {
8585 public:
8686 friend class AArch64TargetELFStreamer;
8787
88 AArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
88 AArch64ELFStreamer(MCContext &Context, std::unique_ptr TAB,
8989 raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
90 : MCELFStreamer(Context, TAB, OS, Emitter), MappingSymbolCounter(0),
91 LastEMS(EMS_None) {}
90 : MCELFStreamer(Context, std::move(TAB), OS, Emitter),
91 MappingSymbolCounter(0), LastEMS(EMS_None) {}
9292
9393 void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
9494 // We have to keep track of the mapping symbol state of any sections we
197197 return new AArch64TargetAsmStreamer(S, OS);
198198 }
199199
200 MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
200 MCELFStreamer *createAArch64ELFStreamer(MCContext &Context,
201 std::unique_ptr TAB,
201202 raw_pwrite_stream &OS,
202203 MCCodeEmitter *Emitter, bool RelaxAll) {
203 AArch64ELFStreamer *S = new AArch64ELFStreamer(Context, TAB, OS, Emitter);
204 AArch64ELFStreamer *S =
205 new AArch64ELFStreamer(Context, std::move(TAB), OS, Emitter);
204206 if (RelaxAll)
205207 S->getAssembler().setRelaxAll(true);
206208 return S;
1717
1818 namespace llvm {
1919
20 MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
20 MCELFStreamer *createAArch64ELFStreamer(MCContext &Context,
21 std::unique_ptr TAB,
2122 raw_pwrite_stream &OS,
2223 MCCodeEmitter *Emitter, bool RelaxAll);
2324 }
9999 }
100100
101101 static MCStreamer *createELFStreamer(const Triple &T, MCContext &Ctx,
102 MCAsmBackend &TAB, raw_pwrite_stream &OS,
102 std::unique_ptr &&TAB,
103 raw_pwrite_stream &OS,
103104 MCCodeEmitter *Emitter, bool RelaxAll) {
104 return createAArch64ELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
105 return createAArch64ELFStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll);
105106 }
106107
107 static MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
108 static MCStreamer *createMachOStreamer(MCContext &Ctx,
109 std::unique_ptr &&TAB,
108110 raw_pwrite_stream &OS,
109111 MCCodeEmitter *Emitter, bool RelaxAll,
110112 bool DWARFMustBeAtTheEnd) {
111 return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
113 return createMachOStreamer(Ctx, std::move(TAB), OS, Emitter, RelaxAll,
112114 DWARFMustBeAtTheEnd,
113115 /*LabelSections*/ true);
114116 }
115117
116 static MCStreamer *createWinCOFFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
118 static MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
119 std::unique_ptr &&TAB,
117120 raw_pwrite_stream &OS,
118121 MCCodeEmitter *Emitter, bool RelaxAll,
119122 bool IncrementalLinkerCompatible) {
120 return createAArch64WinCOFFStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
121 IncrementalLinkerCompatible);
123 return createAArch64WinCOFFStreamer(Ctx, std::move(TAB), OS, Emitter,
124 RelaxAll, IncrementalLinkerCompatible);
122125 }
123126
124127 static MCInstrAnalysis *createAArch64InstrAnalysis(const MCInstrInfo *Info) {
1616 public:
1717 friend class AArch64TargetWinCOFFStreamer;
1818
19 AArch64WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter &CE,
20 raw_pwrite_stream &OS)
21 : MCWinCOFFStreamer(C, AB, CE, OS) {}
19 AArch64WinCOFFStreamer(MCContext &C, std::unique_ptr AB,
20 MCCodeEmitter &CE, raw_pwrite_stream &OS)
21 : MCWinCOFFStreamer(C, std::move(AB), CE, OS) {}
2222 };
2323 } // end anonymous namespace
2424
2525 namespace llvm {
26 MCWinCOFFStreamer
27 *createAArch64WinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
28 raw_pwrite_stream &OS,
29 MCCodeEmitter *Emitter, bool RelaxAll,
30 bool IncrementalLinkerCompatible) {
31 auto *S = new AArch64WinCOFFStreamer(Context, MAB, *Emitter, OS);
26 MCWinCOFFStreamer *
27 createAArch64WinCOFFStreamer(MCContext &Context,
28 std::unique_ptr MAB,
29 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
30 bool RelaxAll, bool IncrementalLinkerCompatible) {
31 auto *S = new AArch64WinCOFFStreamer(Context, std::move(MAB), *Emitter, OS);
3232 S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
3333 return S;
3434 }
1414 #define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64WINCOFFSTREAMER_H
1515
1616 #include "AArch64TargetStreamer.h"
17 #include "llvm/MC/MCAsmBackend.h"
1718 #include "llvm/MC/MCWinCOFFStreamer.h"
1819
1920 namespace {
3233
3334 namespace llvm {
3435
35 MCWinCOFFStreamer
36 *createAArch64WinCOFFStreamer(MCContext &Context, MCAsmBackend &TAB,
37 raw_pwrite_stream &OS,
38 MCCodeEmitter *Emitter, bool RelaxAll,
39 bool IncrementalLinkerCompatible);
36 MCWinCOFFStreamer *
37 createAArch64WinCOFFStreamer(MCContext &Context,
38 std::unique_ptr TAB,
39 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
40 bool RelaxAll, bool IncrementalLinkerCompatible);
4041 } // end llvm namespace
4142
4243 #endif
99 #include "AMDGPUELFStreamer.h"
1010 #include "Utils/AMDGPUBaseInfo.h"
1111 #include "llvm/BinaryFormat/ELF.h"
12 #include "llvm/MC/MCAsmBackend.h"
1213
1314 using namespace llvm;
1415
1516 AMDGPUELFStreamer::AMDGPUELFStreamer(const Triple &T, MCContext &Context,
16 MCAsmBackend &MAB, raw_pwrite_stream &OS,
17 std::unique_ptr MAB,
18 raw_pwrite_stream &OS,
1719 MCCodeEmitter *Emitter)
18 : MCELFStreamer(Context, MAB, OS, Emitter) {
20 : MCELFStreamer(Context, std::move(MAB), OS, Emitter) {
1921 unsigned Arch = ELF::EF_AMDGPU_ARCH_NONE;
2022 switch (T.getArch()) {
2123 case Triple::r600:
3537 MCA.setELFHeaderEFlags(EFlags);
3638 }
3739
38 MCELFStreamer *llvm::createAMDGPUELFStreamer(const Triple &T, MCContext &Context,
39 MCAsmBackend &MAB,
40 raw_pwrite_stream &OS,
41 MCCodeEmitter *Emitter,
42 bool RelaxAll) {
43 return new AMDGPUELFStreamer(T, Context, MAB, OS, Emitter);
40 MCELFStreamer *llvm::createAMDGPUELFStreamer(
41 const Triple &T, MCContext &Context, std::unique_ptr MAB,
42 raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll) {
43 return new AMDGPUELFStreamer(T, Context, std::move(MAB), OS, Emitter);
4444 }
2424
2525 class AMDGPUELFStreamer : public MCELFStreamer {
2626 public:
27 AMDGPUELFStreamer(const Triple &T, MCContext &Context, MCAsmBackend &MAB,
28 raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
27 AMDGPUELFStreamer(const Triple &T, MCContext &Context,
28 std::unique_ptr MAB, raw_pwrite_stream &OS,
29 MCCodeEmitter *Emitter);
2930 };
3031
3132 MCELFStreamer *createAMDGPUELFStreamer(const Triple &T, MCContext &Context,
32 MCAsmBackend &MAB, raw_pwrite_stream &OS,
33 std::unique_ptr MAB,
34 raw_pwrite_stream &OS,
3335 MCCodeEmitter *Emitter, bool RelaxAll);
3436 } // namespace llvm.
3537
1717 #include "AMDGPUTargetStreamer.h"
1818 #include "InstPrinter/AMDGPUInstPrinter.h"
1919 #include "SIDefines.h"
20 #include "llvm/MC/MCAsmBackend.h"
2021 #include "llvm/MC/MCContext.h"
2122 #include "llvm/MC/MCInstrInfo.h"
2223 #include "llvm/MC/MCRegisterInfo.h"
7778 }
7879
7980 static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
80 MCAsmBackend &MAB, raw_pwrite_stream &OS,
81 std::unique_ptr &&MAB,
82 raw_pwrite_stream &OS,
8183 MCCodeEmitter *Emitter, bool RelaxAll) {
82 return createAMDGPUELFStreamer(T, Context, MAB, OS, Emitter, RelaxAll);
84 return createAMDGPUELFStreamer(T, Context, std::move(MAB), OS, Emitter,
85 RelaxAll);
8386 }
8487
8588 extern "C" void LLVMInitializeAMDGPUTargetMC() {
439439 public:
440440 friend class ARMTargetELFStreamer;
441441
442 ARMELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
443 MCCodeEmitter *Emitter, bool IsThumb)
444 : MCELFStreamer(Context, TAB, OS, Emitter), IsThumb(IsThumb) {
442 ARMELFStreamer(MCContext &Context, std::unique_ptr TAB,
443 raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool IsThumb)
444 : MCELFStreamer(Context, std::move(TAB), OS, Emitter), IsThumb(IsThumb) {
445445 EHReset();
446446 }
447447
14841484 return new ARMTargetStreamer(S);
14851485 }
14861486
1487 MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
1487 MCELFStreamer *createARMELFStreamer(MCContext &Context,
1488 std::unique_ptr TAB,
14881489 raw_pwrite_stream &OS,
14891490 MCCodeEmitter *Emitter, bool RelaxAll,
14901491 bool IsThumb) {
1491 ARMELFStreamer *S = new ARMELFStreamer(Context, TAB, OS, Emitter, IsThumb);
1492 // FIXME: This should eventually end up somewhere else where more
1493 // intelligent flag decisions can be made. For now we are just maintaining
1494 // the status quo for ARM and setting EF_ARM_EABI_VER5 as the default.
1495 S->getAssembler().setELFHeaderEFlags(ELF::EF_ARM_EABI_VER5);
1496
1497 if (RelaxAll)
1498 S->getAssembler().setRelaxAll(true);
1499 return S;
1492 ARMELFStreamer *S =
1493 new ARMELFStreamer(Context, std::move(TAB), OS, Emitter, IsThumb);
1494 // FIXME: This should eventually end up somewhere else where more
1495 // intelligent flag decisions can be made. For now we are just maintaining
1496 // the status quo for ARM and setting EF_ARM_EABI_VER5 as the default.
1497 S->getAssembler().setELFHeaderEFlags(ELF::EF_ARM_EABI_VER5);
1498
1499 if (RelaxAll)
1500 S->getAssembler().setRelaxAll(true);
1501 return S;
15001502 }
15011503
15021504 } // end namespace llvm
1515 #include "ARMMCAsmInfo.h"
1616 #include "InstPrinter/ARMInstPrinter.h"
1717 #include "llvm/ADT/Triple.h"
18 #include "llvm/MC/MCAsmBackend.h"
1819 #include "llvm/MC/MCELFStreamer.h"
1920 #include "llvm/MC/MCInstrAnalysis.h"
2021 #include "llvm/MC/MCInstrInfo.h"
197198 }
198199
199200 static MCStreamer *createELFStreamer(const Triple &T, MCContext &Ctx,
200 MCAsmBackend &MAB, raw_pwrite_stream &OS,
201 std::unique_ptr &&MAB,
202 raw_pwrite_stream &OS,
201203 MCCodeEmitter *Emitter, bool RelaxAll) {
202 return createARMELFStreamer(Ctx, MAB, OS, Emitter, false,
203 (T.getArch() == Triple::thumb ||
204 T.getArch() == Triple::thumbeb));
205 }
206
207 static MCStreamer *createARMMachOStreamer(MCContext &Ctx, MCAsmBackend &MAB,
204 return createARMELFStreamer(
205 Ctx, std::move(MAB), OS, Emitter, false,
206 (T.getArch() == Triple::thumb || T.getArch() == Triple::thumbeb));
207 }
208
209 static MCStreamer *createARMMachOStreamer(MCContext &Ctx,
210 std::unique_ptr &&MAB,
208211 raw_pwrite_stream &OS,
209212 MCCodeEmitter *Emitter, bool RelaxAll,
210213 bool DWARFMustBeAtTheEnd) {
211 return createMachOStreamer(Ctx, MAB, OS, Emitter, false, DWARFMustBeAtTheEnd);
214 return createMachOStreamer(Ctx, std::move(MAB), OS, Emitter, false,
215 DWARFMustBeAtTheEnd);
212216 }
213217
214218 static MCInstPrinter *createARMMCInstPrinter(const Triple &T,
9292
9393 // Construct a PE/COFF machine code streamer which will generate a PE/COFF
9494 // object file.
95 MCStreamer *createARMWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
95 MCStreamer *createARMWinCOFFStreamer(MCContext &Context,
96 std::unique_ptr &&MAB,
9697 raw_pwrite_stream &OS,
9798 MCCodeEmitter *Emitter, bool RelaxAll,
9899 bool IncrementalLinkerCompatible);
77 //===----------------------------------------------------------------------===//
88
99 #include "ARMMCTargetDesc.h"
10 #include "llvm/MC/MCAsmBackend.h"
1011 #include "llvm/MC/MCWinCOFFStreamer.h"
1112
1213 using namespace llvm;
1415 namespace {
1516 class ARMWinCOFFStreamer : public MCWinCOFFStreamer {
1617 public:
17 ARMWinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter &CE,
18 raw_pwrite_stream &OS)
19 : MCWinCOFFStreamer(C, AB, CE, OS) {}
18 ARMWinCOFFStreamer(MCContext &C, std::unique_ptr AB,
19 MCCodeEmitter &CE, raw_pwrite_stream &OS)
20 : MCWinCOFFStreamer(C, std::move(AB), CE, OS) {}
2021
2122 void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
2223 void EmitThumbFunc(MCSymbol *Symbol) override;
3637 }
3738 }
3839
39 MCStreamer *llvm::createARMWinCOFFStreamer(
40 MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS,
41 MCCodeEmitter *Emitter, bool RelaxAll, bool IncrementalLinkerCompatible) {
42 auto *S = new ARMWinCOFFStreamer(Context, MAB, *Emitter, OS);
40 MCStreamer *llvm::createARMWinCOFFStreamer(MCContext &Context,
41 std::unique_ptr &&MAB,
42 raw_pwrite_stream &OS,
43 MCCodeEmitter *Emitter,
44 bool RelaxAll,
45 bool IncrementalLinkerCompatible) {
46 auto *S = new ARMWinCOFFStreamer(Context, std::move(MAB), *Emitter, OS);
4347 S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
4448 return S;
4549 }
4848 return createBPFMCSubtargetInfoImpl(TT, CPU, FS);
4949 }
5050
51 static MCStreamer *createBPFMCStreamer(const Triple &T,
52 MCContext &Ctx, MCAsmBackend &MAB,
53 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
54 bool RelaxAll) {
55 return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
51 static MCStreamer *createBPFMCStreamer(const Triple &T, MCContext &Ctx,
52 std::unique_ptr &&MAB,
53 raw_pwrite_stream &OS,
54 MCCodeEmitter *Emitter, bool RelaxAll) {
55 return createELFStreamer(Ctx, std::move(MAB), OS, Emitter, RelaxAll);
5656 }
5757
5858 static MCInstPrinter *createBPFMCInstPrinter(const Triple &T,
1717 #include "MCTargetDesc/HexagonMCShuffler.h"
1818 #include "llvm/ADT/StringRef.h"
1919 #include "llvm/BinaryFormat/ELF.h"
20 #include "llvm/MC/MCAsmBackend.h"
2021 #include "llvm/MC/MCAssembler.h"
2122 #include "llvm/MC/MCContext.h"
2223 #include "llvm/MC/MCExpr.h"
4142 cl::desc("Global Pointer Addressing Size. The default size is 8."),
4243 cl::Prefix,
4344 cl::init(8));
45
46 HexagonMCELFStreamer::HexagonMCELFStreamer(MCContext &Context,
47 std::unique_ptr TAB,
48 raw_pwrite_stream &OS,
49 MCCodeEmitter *Emitter)
50 : MCELFStreamer(Context, std::move(TAB), OS, Emitter),
51 MCII(createHexagonMCInstrInfo()) {}
52
53 HexagonMCELFStreamer::HexagonMCELFStreamer(MCContext &Context,
54 std::unique_ptr TAB,
55 raw_pwrite_stream &OS,
56 MCCodeEmitter *Emitter,
57 MCAssembler *Assembler)
58 : MCELFStreamer(Context, std::move(TAB), OS, Emitter),
59 MCII(createHexagonMCInstrInfo()) {}
4460
4561 void HexagonMCELFStreamer::EmitInstruction(const MCInst &MCB,
4662 const MCSubtargetInfo &STI, bool) {
148164
149165
150166 namespace llvm {
151 MCStreamer *createHexagonELFStreamer(Triple const &TT, MCContext &Context,
152 MCAsmBackend &MAB,
153 raw_pwrite_stream &OS, MCCodeEmitter *CE) {
154 return new HexagonMCELFStreamer(Context, MAB, OS, CE);
167 MCStreamer *createHexagonELFStreamer(Triple const &TT, MCContext &Context,
168 std::unique_ptr MAB,
169 raw_pwrite_stream &OS, MCCodeEmitter *CE) {
170 return new HexagonMCELFStreamer(Context, std::move(MAB), OS, CE);
155171 }
156172
157173 } // end namespace llvm
2121 std::unique_ptr MCII;
2222
2323 public:
24 HexagonMCELFStreamer(MCContext &Context, MCAsmBackend &TAB,
25 raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
26 : MCELFStreamer(Context, TAB, OS, Emitter),
27 MCII(createHexagonMCInstrInfo()) {}
24 HexagonMCELFStreamer(MCContext &Context, std::unique_ptr TAB,
25 raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
2826
29 HexagonMCELFStreamer(MCContext &Context,
30 MCAsmBackend &TAB,
27 HexagonMCELFStreamer(MCContext &Context, std::unique_ptr TAB,
3128 raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
32 MCAssembler *Assembler) :
33 MCELFStreamer(Context, TAB, OS, Emitter),
34 MCII (createHexagonMCInstrInfo()) {}
29 MCAssembler *Assembler);
3530
3631 void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
3732 bool) override;
4439 };
4540
4641 MCStreamer *createHexagonELFStreamer(Triple const &TT, MCContext &Context,
47 MCAsmBackend &MAB, raw_pwrite_stream &OS,
48 MCCodeEmitter *CE);
42 std::unique_ptr MAB,
43 raw_pwrite_stream &OS, MCCodeEmitter *CE);
4944
5045 } // end namespace llvm
5146
1919 #include "MCTargetDesc/HexagonMCInstrInfo.h"
2020 #include "llvm/ADT/StringRef.h"
2121 #include "llvm/BinaryFormat/ELF.h"
22 #include "llvm/MC/MCAsmBackend.h"
2223 #include "llvm/MC/MCContext.h"
2324 #include "llvm/MC/MCDwarf.h"
2425 #include "llvm/MC/MCELFStreamer.h"
223224 return new HexagonTargetAsmStreamer(S, OS, IsVerboseAsm, *IP);
224225 }
225226
226 static MCStreamer *createMCStreamer(Triple const &T,
227 MCContext &Context,
228 MCAsmBackend &MAB,
227 static MCStreamer *createMCStreamer(Triple const &T, MCContext &Context,
228 std::unique_ptr &&MAB,
229229 raw_pwrite_stream &OS,
230 MCCodeEmitter *Emitter,
231 bool RelaxAll) {
232 return createHexagonELFStreamer(T, Context, MAB, OS, Emitter);
230 MCCodeEmitter *Emitter, bool RelaxAll) {
231 return createHexagonELFStreamer(T, Context, std::move(MAB), OS, Emitter);
233232 }
234233
235234 static MCTargetStreamer *
5959 }
6060
6161 static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
62 MCAsmBackend &MAB, raw_pwrite_stream &OS,
62 std::unique_ptr &&MAB,
63 raw_pwrite_stream &OS,
6364 MCCodeEmitter *Emitter, bool RelaxAll) {
6465 if (!T.isOSBinFormatELF())
6566 llvm_unreachable("OS not supported");
6667
67 return createELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
68 return createELFStreamer(Context, std::move(MAB), OS, Emitter, RelaxAll);
6869 }
6970
7071 static MCInstPrinter *createLanaiMCInstPrinter(const Triple & /*T*/,
1010 #include "MipsOptionRecord.h"
1111 #include "MipsTargetStreamer.h"
1212 #include "llvm/BinaryFormat/ELF.h"
13 #include "llvm/MC/MCAsmBackend.h"
1314 #include "llvm/MC/MCAssembler.h"
1415 #include "llvm/MC/MCContext.h"
1516 #include "llvm/MC/MCInst.h"
1718 #include "llvm/Support/Casting.h"
1819
1920 using namespace llvm;
21
22 MipsELFStreamer::MipsELFStreamer(MCContext &Context,
23 std::unique_ptr MAB,
24 raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
25 : MCELFStreamer(Context, std::move(MAB), OS, Emitter) {
26 RegInfoRecord = new MipsRegInfoRecord(this, Context);
27 MipsOptionRecords.push_back(
28 std::unique_ptr(RegInfoRecord));
29 }
2030
2131 void MipsELFStreamer::EmitInstruction(const MCInst &Inst,
2232 const MCSubtargetInfo &STI, bool) {
7787 }
7888
7989 MCELFStreamer *llvm::createMipsELFStreamer(MCContext &Context,
80 MCAsmBackend &MAB,
90 std::unique_ptr MAB,
8191 raw_pwrite_stream &OS,
8292 MCCodeEmitter *Emitter,
8393 bool RelaxAll) {
84 return new MipsELFStreamer(Context, MAB, OS, Emitter);
94 return new MipsELFStreamer(Context, std::move(MAB), OS, Emitter);
8595 }
3232 SmallVector Labels;
3333
3434 public:
35 MipsELFStreamer(MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS,
36 MCCodeEmitter *Emitter)
37 : MCELFStreamer(Context, MAB, OS, Emitter) {
38 RegInfoRecord = new MipsRegInfoRecord(this, Context);
39 MipsOptionRecords.push_back(
40 std::unique_ptr(RegInfoRecord));
41 }
35 MipsELFStreamer(MCContext &Context, std::unique_ptr MAB,
36 raw_pwrite_stream &OS, MCCodeEmitter *Emitter);
4237
4338 /// Overriding this function allows us to add arbitrary behaviour before the
4439 /// \p Inst is actually emitted. For example, we can inspect the operands and
6863 void createPendingLabelRelocs();
6964 };
7065
71 MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
66 MCELFStreamer *createMipsELFStreamer(MCContext &Context,
67 std::unique_ptr MAB,
7268 raw_pwrite_stream &OS,
7369 MCCodeEmitter *Emitter, bool RelaxAll);
7470 } // end namespace llvm
2121 bool baseRegNeedsLoadStoreMask(unsigned Reg);
2222
2323 // This function creates an MCELFStreamer for Mips NaCl.
24 MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
24 MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context,
25 std::unique_ptr TAB,
2526 raw_pwrite_stream &OS,
2627 MCCodeEmitter *Emitter, bool RelaxAll);
2728 }
9090 }
9191
9292 static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
93 MCAsmBackend &MAB, raw_pwrite_stream &OS,
93 std::unique_ptr &&MAB,
94 raw_pwrite_stream &OS,
9495 MCCodeEmitter *Emitter, bool RelaxAll) {
9596 MCStreamer *S;
9697 if (!T.isOSNaCl())
97 S = createMipsELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
98 S = createMipsELFStreamer(Context, std::move(MAB), OS, Emitter, RelaxAll);
9899 else
99 S = createMipsNaClELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
100 S = createMipsNaClELFStreamer(Context, std::move(MAB), OS, Emitter,
101 RelaxAll);
100102 return S;
101103 }
102104
1919 #include "Mips.h"
2020 #include "MipsELFStreamer.h"
2121 #include "MipsMCNaCl.h"
22 #include "llvm/MC/MCAsmBackend.h"
2223 #include "llvm/MC/MCAssembler.h"
2324 #include "llvm/MC/MCELFStreamer.h"
2425 #include "llvm/MC/MCInst.h"
3940
4041 class MipsNaClELFStreamer : public MipsELFStreamer {
4142 public:
42 MipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
43 MipsNaClELFStreamer(MCContext &Context, std::unique_ptr TAB,
4344 raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
44 : MipsELFStreamer(Context, TAB, OS, Emitter) {}
45 : MipsELFStreamer(Context, std::move(TAB), OS, Emitter) {}
4546
4647 ~MipsNaClELFStreamer() override = default;
4748
254255 return Reg != Mips::SP && Reg != Mips::T8;
255256 }
256257
257 MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
258 MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context,
259 std::unique_ptr TAB,
258260 raw_pwrite_stream &OS,
259261 MCCodeEmitter *Emitter,
260262 bool RelaxAll) {
261 MipsNaClELFStreamer *S = new MipsNaClELFStreamer(Context, TAB, OS, Emitter);
263 MipsNaClELFStreamer *S =
264 new MipsNaClELFStreamer(Context, std::move(TAB), OS, Emitter);
262265 if (RelaxAll)
263266 S->getAssembler().setRelaxAll(true);
264267
8080 /// PE/COFF format object files.
8181 ///
8282 /// Takes ownership of \p AB and \p CE.
83 MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
83 MCStreamer *createX86WinCOFFStreamer(MCContext &C,
84 std::unique_ptr &&AB,
8485 raw_pwrite_stream &OS, MCCodeEmitter *CE,
85 bool RelaxAll, bool IncrementalLinkerCompatible);
86 bool RelaxAll,
87 bool IncrementalLinkerCompatible);
8688
8789 /// Construct an X86 Mach-O object writer.
8890 std::unique_ptr createX86MachObjectWriter(raw_pwrite_stream &OS,
77 //===----------------------------------------------------------------------===//
88
99 #include "X86MCTargetDesc.h"
10 #include "llvm/MC/MCAsmBackend.h"
1011 #include "llvm/MC/MCWin64EH.h"
1112 #include "llvm/MC/MCWinCOFFStreamer.h"
1213
1617 class X86WinCOFFStreamer : public MCWinCOFFStreamer {
1718 Win64EH::UnwindEmitter EHStreamer;
1819 public:
19 X86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter *CE,
20 raw_pwrite_stream &OS)
21 : MCWinCOFFStreamer(C, AB, *CE, OS) {}
20 X86WinCOFFStreamer(MCContext &C, std::unique_ptr AB,
21 MCCodeEmitter *CE, raw_pwrite_stream &OS)
22 : MCWinCOFFStreamer(C, std::move(AB), *CE, OS) {}
2223
2324 void EmitWinEHHandlerData(SMLoc Loc) override;
2425 void EmitWindowsUnwindTables() override;
4748 }
4849 }
4950
50 MCStreamer *llvm::createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
51 MCStreamer *llvm::createX86WinCOFFStreamer(MCContext &C,
52 std::unique_ptr &&AB,
5153 raw_pwrite_stream &OS,
5254 MCCodeEmitter *CE, bool RelaxAll,
5355 bool IncrementalLinkerCompatible) {
54 X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, AB, CE, OS);
56 X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, std::move(AB), CE, OS);
5557 S->getAssembler().setRelaxAll(RelaxAll);
5658 S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
5759 return S;
622622
623623 MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
624624 MS = TheTarget->createMCObjectStreamer(
625 TheTriple, *MC, *MAB, *OutFile, MCE, *MSTI, MCOptions.MCRelaxAll,
626 MCOptions.MCIncrementalLinkerCompatible,
625 TheTriple, *MC, std::unique_ptr(MAB), *OutFile, MCE, *MSTI,
626 MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
627627 /*DWARFMustBeAtTheEnd*/ false);
628628 if (!MS)
629629 return error("no object streamer for target " + TripleName, Context);
1919 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
2020 #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
2121 #include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
22 #include "llvm/MC/MCAsmBackend.h"
2223 #include "llvm/MC/MCAsmInfo.h"
2324 #include "llvm/MC/MCContext.h"
2425 #include "llvm/MC/MCInstrInfo.h"
705706
706707 MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
707708 std::unique_ptr MS(TheTarget->createMCObjectStreamer(
708 TheTriple, MC, *MAB, OutFile, MCE, *MSTI, MCOptions.MCRelaxAll,
709 MCOptions.MCIncrementalLinkerCompatible,
709 TheTriple, MC, std::unique_ptr(MAB), OutFile, MCE, *MSTI,
710 MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
710711 /*DWARFMustBeAtTheEnd*/ false));
711712 if (!MS)
712713 return error("no object streamer for target " + TripleName, Context);
590590 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU,
591591 MCOptions);
592592 Str.reset(TheTarget->createMCObjectStreamer(
593 TheTriple, Ctx, *MAB, *OS, CE, *STI, MCOptions.MCRelaxAll,
594 MCOptions.MCIncrementalLinkerCompatible,
593 TheTriple, Ctx, std::unique_ptr(MAB), *OS, CE, *STI,
594 MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
595595 /*DWARFMustBeAtTheEnd*/ false));
596596 if (NoExecStack)
597597 Str->InitSections(true);
180180
181181 MCTargetOptions MCOptions = InitMCTargetOptionsFromFlags();
182182 MS = TheTarget->createMCObjectStreamer(
183 TheTriple, *MC, *MAB, *Stream, MCE, *MSTI, MCOptions.MCRelaxAll,
184 MCOptions.MCIncrementalLinkerCompatible,
183 TheTriple, *MC, std::unique_ptr(MAB), *Stream, MCE, *MSTI,
184 MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
185185 /*DWARFMustBeAtTheEnd*/ false);
186186 if (!MS)
187187 return make_error("no object streamer for target " +