diff options
Diffstat (limited to 'gnu/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp')
| -rw-r--r-- | gnu/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | 109 |
1 files changed, 58 insertions, 51 deletions
diff --git a/gnu/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/gnu/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp index 93f4006cee8..d465da1a7bb 100644 --- a/gnu/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ b/gnu/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp @@ -92,9 +92,9 @@ class ARMTargetAsmStreamer : public ARMTargetStreamer { void emitTextAttribute(unsigned Attribute, StringRef String) override; void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue) override; - void emitArch(unsigned Arch) override; + void emitArch(ARM::ArchKind Arch) override; void emitArchExtension(unsigned ArchExt) override; - void emitObjectArch(unsigned Arch) override; + void emitObjectArch(ARM::ArchKind Arch) override; void emitFPU(unsigned FPU) override; void emitInst(uint32_t Inst, char Suffix = '\0') override; void finishAttributeSection() override; @@ -218,7 +218,7 @@ void ARMTargetAsmStreamer::emitIntTextAttribute(unsigned Attribute, OS << "\n"; } -void ARMTargetAsmStreamer::emitArch(unsigned Arch) { +void ARMTargetAsmStreamer::emitArch(ARM::ArchKind Arch) { OS << "\t.arch\t" << ARM::getArchName(Arch) << "\n"; } @@ -226,7 +226,7 @@ void ARMTargetAsmStreamer::emitArchExtension(unsigned ArchExt) { OS << "\t.arch_extension\t" << ARM::getArchExtName(ArchExt) << "\n"; } -void ARMTargetAsmStreamer::emitObjectArch(unsigned Arch) { +void ARMTargetAsmStreamer::emitObjectArch(ARM::ArchKind Arch) { OS << "\t.object_arch\t" << ARM::getArchName(Arch) << '\n'; } @@ -303,8 +303,8 @@ private: StringRef CurrentVendor; unsigned FPU = ARM::FK_INVALID; - unsigned Arch = ARM::AK_INVALID; - unsigned EmittedArch = ARM::AK_INVALID; + ARM::ArchKind Arch = ARM::ArchKind::INVALID; + ARM::ArchKind EmittedArch = ARM::ArchKind::INVALID; SmallVector<AttributeItem, 64> Contents; MCSection *AttributeSection = nullptr; @@ -404,8 +404,8 @@ private: void emitTextAttribute(unsigned Attribute, StringRef String) override; void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue) override; - void emitArch(unsigned Arch) override; - void emitObjectArch(unsigned Arch) override; + void emitArch(ARM::ArchKind Arch) override; + void emitObjectArch(ARM::ArchKind Arch) override; void emitFPU(unsigned FPU) override; void emitInst(uint32_t Inst, char Suffix = '\0') override; void finishAttributeSection() override; @@ -440,9 +440,11 @@ 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, std::unique_ptr<MCCodeEmitter> Emitter, + bool IsThumb) + : MCELFStreamer(Context, std::move(TAB), OS, std::move(Emitter)), + IsThumb(IsThumb) { EHReset(); } @@ -776,11 +778,11 @@ void ARMTargetELFStreamer::emitIntTextAttribute(unsigned Attribute, /* OverwriteExisting= */ true); } -void ARMTargetELFStreamer::emitArch(unsigned Value) { +void ARMTargetELFStreamer::emitArch(ARM::ArchKind Value) { Arch = Value; } -void ARMTargetELFStreamer::emitObjectArch(unsigned Value) { +void ARMTargetELFStreamer::emitObjectArch(ARM::ArchKind Value) { EmittedArch = Value; } @@ -791,7 +793,7 @@ void ARMTargetELFStreamer::emitArchDefaultAttributes() { ARM::getCPUAttr(Arch), false); - if (EmittedArch == ARM::AK_INVALID) + if (EmittedArch == ARM::ArchKind::INVALID) setAttributeItem(CPU_arch, ARM::getArchAttr(Arch), false); @@ -801,58 +803,59 @@ void ARMTargetELFStreamer::emitArchDefaultAttributes() { false); switch (Arch) { - case ARM::AK_ARMV2: - case ARM::AK_ARMV2A: - case ARM::AK_ARMV3: - case ARM::AK_ARMV3M: - case ARM::AK_ARMV4: + case ARM::ArchKind::ARMV2: + case ARM::ArchKind::ARMV2A: + case ARM::ArchKind::ARMV3: + case ARM::ArchKind::ARMV3M: + case ARM::ArchKind::ARMV4: setAttributeItem(ARM_ISA_use, Allowed, false); break; - case ARM::AK_ARMV4T: - case ARM::AK_ARMV5T: - case ARM::AK_ARMV5TE: - case ARM::AK_ARMV6: + case ARM::ArchKind::ARMV4T: + case ARM::ArchKind::ARMV5T: + case ARM::ArchKind::ARMV5TE: + case ARM::ArchKind::ARMV6: setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, Allowed, false); break; - case ARM::AK_ARMV6T2: + case ARM::ArchKind::ARMV6T2: setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, AllowThumb32, false); break; - case ARM::AK_ARMV6K: - case ARM::AK_ARMV6KZ: + case ARM::ArchKind::ARMV6K: + case ARM::ArchKind::ARMV6KZ: setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, Allowed, false); setAttributeItem(Virtualization_use, AllowTZ, false); break; - case ARM::AK_ARMV6M: + case ARM::ArchKind::ARMV6M: setAttributeItem(THUMB_ISA_use, Allowed, false); break; - case ARM::AK_ARMV7A: + case ARM::ArchKind::ARMV7A: setAttributeItem(CPU_arch_profile, ApplicationProfile, false); setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, AllowThumb32, false); break; - case ARM::AK_ARMV7R: + case ARM::ArchKind::ARMV7R: setAttributeItem(CPU_arch_profile, RealTimeProfile, false); setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, AllowThumb32, false); break; - case ARM::AK_ARMV7M: + case ARM::ArchKind::ARMV7EM: + case ARM::ArchKind::ARMV7M: setAttributeItem(CPU_arch_profile, MicroControllerProfile, false); setAttributeItem(THUMB_ISA_use, AllowThumb32, false); break; - case ARM::AK_ARMV8A: - case ARM::AK_ARMV8_1A: - case ARM::AK_ARMV8_2A: + case ARM::ArchKind::ARMV8A: + case ARM::ArchKind::ARMV8_1A: + case ARM::ArchKind::ARMV8_2A: setAttributeItem(CPU_arch_profile, ApplicationProfile, false); setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, AllowThumb32, false); @@ -860,26 +863,26 @@ void ARMTargetELFStreamer::emitArchDefaultAttributes() { setAttributeItem(Virtualization_use, AllowTZVirtualization, false); break; - case ARM::AK_ARMV8MBaseline: - case ARM::AK_ARMV8MMainline: + case ARM::ArchKind::ARMV8MBaseline: + case ARM::ArchKind::ARMV8MMainline: setAttributeItem(THUMB_ISA_use, AllowThumbDerived, false); setAttributeItem(CPU_arch_profile, MicroControllerProfile, false); break; - case ARM::AK_IWMMXT: + case ARM::ArchKind::IWMMXT: setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, Allowed, false); setAttributeItem(WMMX_arch, AllowWMMXv1, false); break; - case ARM::AK_IWMMXT2: + case ARM::ArchKind::IWMMXT2: setAttributeItem(ARM_ISA_use, Allowed, false); setAttributeItem(THUMB_ISA_use, Allowed, false); setAttributeItem(WMMX_arch, AllowWMMXv2, false); break; default: - report_fatal_error("Unknown Arch: " + Twine(Arch)); + report_fatal_error("Unknown Arch: " + Twine(ARM::getArchName(Arch))); break; } } @@ -1057,7 +1060,7 @@ void ARMTargetELFStreamer::finishAttributeSection() { if (FPU != ARM::FK_INVALID) emitFPUDefaultAttributes(); - if (Arch != ARM::AK_INVALID) + if (Arch != ARM::ArchKind::INVALID) emitArchDefaultAttributes(); if (Contents.empty()) @@ -1169,6 +1172,8 @@ void ARMELFStreamer::reset() { ATS.reset(); MappingSymbolCounter = 0; MCELFStreamer::reset(); + LastMappingSymbols.clear(); + LastEMSInfo.reset(); // MCELFStreamer clear's the assembler's e_flags. However, for // arm we manually set the ABI version on streamer creation, so // do the same here @@ -1485,19 +1490,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); - - if (RelaxAll) - S->getAssembler().setRelaxAll(true); - return S; + std::unique_ptr<MCCodeEmitter> Emitter, + bool RelaxAll, bool IsThumb) { + ARMELFStreamer *S = new ARMELFStreamer(Context, std::move(TAB), OS, + std::move(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; } } // end namespace llvm |
