62 "Invalid personality index");
63 return (
Twine(
"__aeabi_unwind_cpp_pr") +
Twine(Index)).str();
82 int64_t
Offset = 0)
override;
86 bool isVector)
override;
122ARMTargetAsmStreamer::ARMTargetAsmStreamer(
MCStreamer &S,
126 IsVerboseAsm(S.isVerboseAsm()) {}
128void ARMTargetAsmStreamer::emitFnStart() {
OS <<
"\t.fnstart\n"; }
129void ARMTargetAsmStreamer::emitFnEnd() {
OS <<
"\t.fnend\n"; }
130void ARMTargetAsmStreamer::emitCantUnwind() {
OS <<
"\t.cantunwind\n"; }
132void ARMTargetAsmStreamer::emitPersonality(
const MCSymbol *Personality) {
133 OS <<
"\t.personality " << Personality->
getName() <<
'\n';
136void ARMTargetAsmStreamer::emitPersonalityIndex(
unsigned Index) {
137 OS <<
"\t.personalityindex " <<
Index <<
'\n';
140void ARMTargetAsmStreamer::emitHandlerData() {
OS <<
"\t.handlerdata\n"; }
145 InstPrinter.printRegName(
OS, FpReg);
147 InstPrinter.printRegName(
OS, SpReg);
154 assert((Reg != ARM::SP && Reg != ARM::PC) &&
155 "the operand of .movsp cannot be either sp or pc");
158 InstPrinter.printRegName(
OS, Reg);
164void ARMTargetAsmStreamer::emitPad(int64_t
Offset) {
165 OS <<
"\t.pad\t#" <<
Offset <<
'\n';
168void ARMTargetAsmStreamer::emitRegSave(
170 assert(RegList.
size() &&
"RegList should not be empty");
176 InstPrinter.printRegName(
OS, RegList[0]);
178 for (
unsigned i = 1, e = RegList.
size(); i != e; ++i) {
180 InstPrinter.printRegName(
OS, RegList[i]);
186void ARMTargetAsmStreamer::switchVendor(
StringRef Vendor) {}
188void ARMTargetAsmStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
199void ARMTargetAsmStreamer::emitTextAttribute(
unsigned Attribute,
206 OS <<
"\t.eabi_attribute\t" <<
Attribute <<
", \"";
223void ARMTargetAsmStreamer::emitIntTextAttribute(
unsigned Attribute,
229 OS <<
"\t.eabi_attribute\t" <<
Attribute <<
", " << IntValue;
230 if (!StringValue.
empty())
231 OS <<
", \"" << StringValue <<
"\"";
245void ARMTargetAsmStreamer::emitArchExtension(
uint64_t ArchExt) {
249void ARMTargetAsmStreamer::emitObjectArch(
ARM::ArchKind Arch) {
257void ARMTargetAsmStreamer::finishAttributeSection() {}
259void ARMTargetAsmStreamer::annotateTLSDescriptorSequence(
264void ARMTargetAsmStreamer::emitThumbFunc(
MCSymbol *Symbol) {
265 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
266 OS <<
"\t.thumb_func";
276 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
278 OS <<
"\t.thumb_set\t";
285void ARMTargetAsmStreamer::emitInst(
uint32_t Inst,
char Suffix) {
292void ARMTargetAsmStreamer::emitUnwindRaw(int64_t
Offset,
300void ARMTargetAsmStreamer::emitARMWinCFIAllocStack(
unsigned Size,
bool Wide) {
302 OS <<
"\t.seh_stackalloc_w\t" <<
Size <<
"\n";
304 OS <<
"\t.seh_stackalloc\t" <<
Size <<
"\n";
315void ARMTargetAsmStreamer::emitARMWinCFISaveRegMask(
unsigned Mask,
bool Wide) {
317 OS <<
"\t.seh_save_regs_w\t";
319 OS <<
"\t.seh_save_regs\t";
323 for (
int I = 0;
I <= 12;
I++) {
324 if (Mask & (1 <<
I)) {
336 if (Mask & (1 << 14))
341void ARMTargetAsmStreamer::emitARMWinCFISaveSP(
unsigned Reg) {
342 OS <<
"\t.seh_save_sp\tr" <<
Reg <<
"\n";
345void ARMTargetAsmStreamer::emitARMWinCFISaveFRegs(
unsigned First,
348 OS <<
"\t.seh_save_fregs\t{d" <<
First <<
"-d" <<
Last <<
"}\n";
350 OS <<
"\t.seh_save_fregs\t{d" <<
First <<
"}\n";
353void ARMTargetAsmStreamer::emitARMWinCFISaveLR(
unsigned Offset) {
354 OS <<
"\t.seh_save_lr\t" <<
Offset <<
"\n";
357void ARMTargetAsmStreamer::emitARMWinCFIPrologEnd(
bool Fragment) {
359 OS <<
"\t.seh_endprologue_fragment\n";
361 OS <<
"\t.seh_endprologue\n";
364void ARMTargetAsmStreamer::emitARMWinCFINop(
bool Wide) {
366 OS <<
"\t.seh_nop_w\n";
368 OS <<
"\t.seh_nop\n";
371void ARMTargetAsmStreamer::emitARMWinCFIEpilogStart(
unsigned Condition) {
373 OS <<
"\t.seh_startepilogue\n";
375 OS <<
"\t.seh_startepilogue_cond\t"
379void ARMTargetAsmStreamer::emitARMWinCFIEpilogEnd() {
380 OS <<
"\t.seh_endepilogue\n";
383void ARMTargetAsmStreamer::emitARMWinCFICustom(
unsigned Opcode) {
385 for (
I = 3;
I > 0;
I--)
386 if (Opcode & (0xffu << (8 *
I)))
389 OS <<
"\t.seh_custom\t";
391 OS << LS << ((Opcode >> (8 *
I)) & 0xff);
404 void emitArchDefaultAttributes();
405 void emitFPUDefaultAttributes();
416 int64_t
Offset = 0)
override;
420 bool isVector)
override;
441 void reset()
override;
464 friend class ARMTargetELFStreamer;
466 ARMELFStreamer(
MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
467 std::unique_ptr<MCObjectWriter> OW,
468 std::unique_ptr<MCCodeEmitter>
Emitter,
bool IsThumb,
472 IsThumb(IsThumb), IsAndroid(IsAndroid) {
476 ~ARMELFStreamer()
override =
default;
481 void emitCantUnwind();
482 void emitPersonality(
const MCSymbol *Per);
483 void emitPersonalityIndex(
unsigned index);
484 void emitHandlerData();
487 void emitPad(int64_t
Offset);
491 SMLoc Loc)
override {
492 emitDataMappingSymbol();
499 auto LastMappingSymbol = LastMappingSymbols.find(Section);
500 if (LastMappingSymbol != LastMappingSymbols.end()) {
501 LastEMSInfo = std::move(LastMappingSymbol->second);
504 LastEMSInfo.reset(
new ElfMappingSymbolInfo);
513 EmitThumbMappingSymbol();
515 EmitARMMappingSymbol();
520 void emitInst(
uint32_t Inst,
char Suffix) {
530 EmitARMMappingSymbol();
532 const unsigned I = LittleEndian ? (
Size -
II - 1) :
II;
539 Size = (Suffix ==
'n' ? 2 : 4);
542 EmitThumbMappingSymbol();
546 const unsigned I0 = LittleEndian ?
II + 0 :
II + 1;
547 const unsigned I1 = LittleEndian ?
II + 1 :
II + 0;
564 emitDataMappingSymbol();
568 void FlushPendingMappingSymbol() {
569 if (!LastEMSInfo->hasInfo())
571 ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
572 emitMappingSymbol(
"$d", *EMS->F, EMS->Offset);
588 emitDataMappingSymbol();
625 unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
634 enum ElfMappingSymbol {
641 struct ElfMappingSymbolInfo {
646 bool hasInfo() {
return F !=
nullptr; }
649 ElfMappingSymbol State = EMS_None;
652 void emitDataMappingSymbol() {
653 if (LastEMSInfo->State == EMS_Data)
655 else if (LastEMSInfo->State == EMS_None) {
658 ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
663 EMS->Offset =
DF->getContents().size();
664 LastEMSInfo->State = EMS_Data;
667 EmitMappingSymbol(
"$d");
668 LastEMSInfo->State = EMS_Data;
671 void EmitThumbMappingSymbol() {
672 if (LastEMSInfo->State == EMS_Thumb)
674 FlushPendingMappingSymbol();
675 EmitMappingSymbol(
"$t");
676 LastEMSInfo->State = EMS_Thumb;
679 void EmitARMMappingSymbol() {
680 if (LastEMSInfo->State == EMS_ARM)
682 FlushPendingMappingSymbol();
683 EmitMappingSymbol(
"$a");
684 LastEMSInfo->State = EMS_ARM;
706 void reset()
override;
709 void FlushPendingOffset();
710 void FlushUnwindOpcodes(
bool NoHandlerData);
712 void SwitchToEHSection(
StringRef Prefix,
unsigned Type,
unsigned Flags,
714 void SwitchToExTabSection(
const MCSymbol &FnStart);
715 void SwitchToExIdxSection(
const MCSymbol &FnStart);
725 std::unique_ptr<ElfMappingSymbolInfo> LastEMSInfo;
731 unsigned PersonalityIndex;
735 int64_t PendingOffset;
744ARMELFStreamer &ARMTargetELFStreamer::getStreamer() {
745 return static_cast<ARMELFStreamer &
>(Streamer);
748void ARMTargetELFStreamer::emitFnStart() { getStreamer().emitFnStart(); }
749void ARMTargetELFStreamer::emitFnEnd() { getStreamer().emitFnEnd(); }
750void ARMTargetELFStreamer::emitCantUnwind() { getStreamer().emitCantUnwind(); }
752void ARMTargetELFStreamer::emitPersonality(
const MCSymbol *Personality) {
753 getStreamer().emitPersonality(Personality);
756void ARMTargetELFStreamer::emitPersonalityIndex(
unsigned Index) {
757 getStreamer().emitPersonalityIndex(Index);
760void ARMTargetELFStreamer::emitHandlerData() {
761 getStreamer().emitHandlerData();
766 getStreamer().emitSetFP(FpReg, SpReg,
Offset);
770 getStreamer().emitMovSP(Reg,
Offset);
773void ARMTargetELFStreamer::emitPad(int64_t
Offset) {
774 getStreamer().emitPad(
Offset);
777void ARMTargetELFStreamer::emitRegSave(
779 getStreamer().emitRegSave(RegList, isVector);
782void ARMTargetELFStreamer::emitUnwindRaw(int64_t
Offset,
784 getStreamer().emitUnwindRaw(
Offset, Opcodes);
787void ARMTargetELFStreamer::switchVendor(
StringRef Vendor) {
788 assert(!Vendor.
empty() &&
"Vendor cannot be empty.");
790 if (CurrentVendor == Vendor)
793 if (!CurrentVendor.empty())
794 finishAttributeSection();
796 assert(getStreamer().Contents.empty() &&
797 ".ARM.attributes should be flushed before changing vendor");
798 CurrentVendor = Vendor;
802void ARMTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
807void ARMTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
813void ARMTargetELFStreamer::emitIntTextAttribute(
unsigned Attribute,
816 getStreamer().setAttributeItems(
Attribute, IntValue, StringValue,
828void ARMTargetELFStreamer::emitArchDefaultAttributes() {
829 using namespace ARMBuildAttrs;
830 ARMELFStreamer &S = getStreamer();
834 if (EmittedArch == ARM::ArchKind::INVALID)
840 case ARM::ArchKind::ARMV4:
841 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
844 case ARM::ArchKind::ARMV4T:
845 case ARM::ArchKind::ARMV5T:
846 case ARM::ArchKind::XSCALE:
847 case ARM::ArchKind::ARMV5TE:
848 case ARM::ArchKind::ARMV6:
849 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
850 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
853 case ARM::ArchKind::ARMV6T2:
854 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
855 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
858 case ARM::ArchKind::ARMV6K:
859 case ARM::ArchKind::ARMV6KZ:
860 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
861 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
862 S.setAttributeItem(Virtualization_use, AllowTZ,
false);
865 case ARM::ArchKind::ARMV6M:
866 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
869 case ARM::ArchKind::ARMV7A:
870 S.setAttributeItem(CPU_arch_profile, ApplicationProfile,
false);
871 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
872 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
875 case ARM::ArchKind::ARMV7R:
876 S.setAttributeItem(CPU_arch_profile, RealTimeProfile,
false);
877 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
878 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
881 case ARM::ArchKind::ARMV7EM:
882 case ARM::ArchKind::ARMV7M:
883 S.setAttributeItem(CPU_arch_profile, MicroControllerProfile,
false);
884 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
887 case ARM::ArchKind::ARMV8A:
888 case ARM::ArchKind::ARMV8_1A:
889 case ARM::ArchKind::ARMV8_2A:
890 case ARM::ArchKind::ARMV8_3A:
891 case ARM::ArchKind::ARMV8_4A:
892 case ARM::ArchKind::ARMV8_5A:
893 case ARM::ArchKind::ARMV8_6A:
894 case ARM::ArchKind::ARMV8_7A:
895 case ARM::ArchKind::ARMV8_8A:
896 case ARM::ArchKind::ARMV8_9A:
897 case ARM::ArchKind::ARMV9A:
898 case ARM::ArchKind::ARMV9_1A:
899 case ARM::ArchKind::ARMV9_2A:
900 case ARM::ArchKind::ARMV9_3A:
901 case ARM::ArchKind::ARMV9_4A:
902 case ARM::ArchKind::ARMV9_5A:
903 case ARM::ArchKind::ARMV9_6A:
904 S.setAttributeItem(CPU_arch_profile, ApplicationProfile,
false);
905 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
906 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
907 S.setAttributeItem(MPextension_use, Allowed,
false);
908 S.setAttributeItem(Virtualization_use, AllowTZVirtualization,
false);
911 case ARM::ArchKind::ARMV8MBaseline:
912 case ARM::ArchKind::ARMV8MMainline:
913 S.setAttributeItem(THUMB_ISA_use, AllowThumbDerived,
false);
914 S.setAttributeItem(CPU_arch_profile, MicroControllerProfile,
false);
917 case ARM::ArchKind::IWMMXT:
918 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
919 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
920 S.setAttributeItem(WMMX_arch, AllowWMMXv1,
false);
923 case ARM::ArchKind::IWMMXT2:
924 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
925 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
926 S.setAttributeItem(WMMX_arch, AllowWMMXv2,
false);
937void ARMTargetELFStreamer::emitFPUDefaultAttributes() {
938 ARMELFStreamer &S = getStreamer();
952 case ARM::FK_VFPV3_FP16:
959 case ARM::FK_VFPV3_D16:
964 case ARM::FK_VFPV3_D16_FP16:
971 case ARM::FK_VFPV3XD:
975 case ARM::FK_VFPV3XD_FP16:
989 case ARM::FK_FPV4_SP_D16:
990 case ARM::FK_VFPV4_D16:
995 case ARM::FK_FP_ARMV8:
1002 case ARM::FK_FPV5_SP_D16:
1003 case ARM::FK_FPV5_D16:
1006 case ARM::FK_FP_ARMV8_FULLFP16_SP_D16:
1007 case ARM::FK_FP_ARMV8_FULLFP16_D16:
1020 case ARM::FK_NEON_FP16:
1030 case ARM::FK_NEON_VFPV4:
1038 case ARM::FK_NEON_FP_ARMV8:
1039 case ARM::FK_CRYPTO_NEON_FP_ARMV8:
1046 case ARM::FK_SOFTVFP:
1056void ARMTargetELFStreamer::finishAttributeSection() {
1057 ARMELFStreamer &S = getStreamer();
1059 if (FPU != ARM::FK_INVALID)
1060 emitFPUDefaultAttributes();
1062 if (Arch != ARM::ArchKind::INVALID)
1063 emitArchDefaultAttributes();
1065 if (S.Contents.empty())
1086 S.emitAttributesSection(CurrentVendor,
".ARM.attributes",
1089 FPU = ARM::FK_INVALID;
1092void ARMTargetELFStreamer::emitLabel(
MCSymbol *Symbol) {
1093 ARMELFStreamer &Streamer = getStreamer();
1094 if (!Streamer.IsThumb)
1097 Streamer.getAssembler().registerSymbol(*Symbol);
1098 unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
1100 emitThumbFunc(Symbol);
1103void ARMTargetELFStreamer::annotateTLSDescriptorSequence(
1108void ARMTargetELFStreamer::emitThumbFunc(
MCSymbol *Symbol) {
1109 getStreamer().getAssembler().setIsThumbFunc(Symbol);
1116 if (!
Sym.isDefined()) {
1117 getStreamer().emitAssignment(Symbol,
Value);
1122 emitThumbFunc(Symbol);
1123 getStreamer().emitAssignment(Symbol,
Value);
1126void ARMTargetELFStreamer::emitInst(
uint32_t Inst,
char Suffix) {
1127 getStreamer().emitInst(Inst, Suffix);
1130void ARMTargetELFStreamer::reset() { AttributeSection =
nullptr; }
1132void ARMTargetELFStreamer::finish() {
1133 ARMTargetStreamer::finish();
1134 finishAttributeSection();
1141 MCContext &Ctx = getStreamer().getContext();
1142 auto &
Asm = getStreamer().getAssembler();
1148 for (
auto &
F : *Text)
1149 if (
auto *
DF = dyn_cast<MCDataFragment>(&
F))
1150 if (!
DF->getContents().empty())
1156void ARMELFStreamer::reset() {
1161 LastMappingSymbols.clear();
1162 LastEMSInfo.reset();
1169inline void ARMELFStreamer::SwitchToEHSection(
StringRef Prefix,
1180 if (FnSecName !=
".text") {
1181 EHSecName += FnSecName;
1189 EHSecName,
Type, Flags, 0, Group,
true,
1193 assert(EHSection &&
"Failed to get the required EH section");
1196 switchSection(EHSection);
1197 emitValueToAlignment(
Align(4), 0, 1, 0);
1200inline void ARMELFStreamer::SwitchToExTabSection(
const MCSymbol &FnStart) {
1205inline void ARMELFStreamer::SwitchToExIdxSection(
const MCSymbol &FnStart) {
1217void ARMELFStreamer::EHReset() {
1220 Personality =
nullptr;
1230 UnwindOpAsm.Reset();
1233void ARMELFStreamer::emitFnStart() {
1234 assert(FnStart ==
nullptr);
1235 FnStart = getContext().createTempSymbol();
1239void ARMELFStreamer::emitFnEnd() {
1240 assert(FnStart &&
".fnstart must precedes .fnend");
1243 if (!ExTab && !CantUnwind)
1244 FlushUnwindOpcodes(
true);
1247 SwitchToExIdxSection(*FnStart);
1262 emitValue(FnStartRef, 4);
1272 emitValue(ExTabEntryRef, 4);
1278 "Compact model must use __aeabi_unwind_cpp_pr0 as personality");
1280 "Unwind opcode size for __aeabi_unwind_cpp_pr0 must be equal to 4");
1285 emitIntValue(Intval, Opcodes.
size());
1295void ARMELFStreamer::emitCantUnwind() { CantUnwind =
true; }
1299 const MCSymbol *PersonalitySym = getContext().getOrCreateSymbol(
Name);
1304 visitUsedExpr(*PersonalityRef);
1311void ARMELFStreamer::FlushPendingOffset() {
1312 if (PendingOffset != 0) {
1313 UnwindOpAsm.EmitSPOffset(-PendingOffset);
1318void ARMELFStreamer::FlushUnwindOpcodes(
bool NoHandlerData) {
1322 int64_t LastRegSaveSPOffset = SPOffset - PendingOffset;
1323 UnwindOpAsm.EmitSPOffset(LastRegSaveSPOffset - FPOffset);
1324 UnwindOpAsm.EmitSetSP(
MRI->getEncodingValue(
FPReg));
1326 FlushPendingOffset();
1330 UnwindOpAsm.Finalize(PersonalityIndex, Opcodes);
1339 SwitchToExTabSection(*FnStart);
1343 ExTab = getContext().createTempSymbol();
1353 emitValue(PersonalityRef, 4);
1358 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
1359 for (
unsigned I = 0;
I != Opcodes.
size();
I += 4) {
1361 Opcodes[
I + 1] << 8 |
1362 Opcodes[
I + 2] << 16 |
1363 Opcodes[
I + 3] << 24;
1374 if (NoHandlerData && !Personality)
1378void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(
false); }
1380void ARMELFStreamer::emitPersonality(
const MCSymbol *Per) {
1382 UnwindOpAsm.setPersonality(Per);
1385void ARMELFStreamer::emitPersonalityIndex(
unsigned Index) {
1387 PersonalityIndex =
Index;
1392 assert((NewSPReg == ARM::SP || NewSPReg ==
FPReg) &&
1393 "the operand of .setfp directive should be either $sp or $fp");
1398 if (NewSPReg == ARM::SP)
1399 FPOffset = SPOffset +
Offset;
1405 assert((Reg != ARM::SP && Reg != ARM::PC) &&
1406 "the operand of .movsp cannot be either sp or pc");
1407 assert(
FPReg == ARM::SP &&
"current FP must be SP");
1409 FlushPendingOffset();
1412 FPOffset = SPOffset +
Offset;
1415 UnwindOpAsm.EmitSetSP(
MRI->getEncodingValue(
FPReg));
1418void ARMELFStreamer::emitPad(int64_t
Offset) {
1427static std::pair<unsigned, unsigned>
1435 if (Reg == ARM::RA_AUTH_CODE)
1437 unsigned RegEnc =
MRI.getEncodingValue(Reg);
1438 assert(RegEnc < (IsVector ? 32U : 16U) &&
"Register out of range");
1439 unsigned Bit = (1u << RegEnc);
1440 if ((Mask & Bit) == 0) {
1448 return {
Idx, Count};
1454 unsigned Idx, Count;
1471 SPOffset -= Count * (IsVector ? 8 : 4);
1474 FlushPendingOffset();
1476 UnwindOpAsm.EmitVFPRegSave(Mask);
1478 UnwindOpAsm.EmitRegSave(Mask);
1479 }
else if (
Idx > 0 && RegList[
Idx - 1] == ARM::RA_AUTH_CODE) {
1482 FlushPendingOffset();
1483 UnwindOpAsm.EmitRegSave(0);
1488void ARMELFStreamer::emitUnwindRaw(int64_t
Offset,
1490 FlushPendingOffset();
1491 SPOffset = SPOffset -
Offset;
1492 UnwindOpAsm.EmitRaw(Opcodes);
1500 return new ARMTargetAsmStreamer(S,
OS, *InstPrint);
1508 return new ARMTargetELFStreamer(S);
1512 std::unique_ptr<MCAsmBackend> TAB,
1513 std::unique_ptr<MCObjectWriter> OW,
1514 std::unique_ptr<MCCodeEmitter>
Emitter,
1515 bool IsThumb,
bool IsAndroid) {
1517 new ARMELFStreamer(Context, std::move(TAB), std::move(OW),
1518 std::move(
Emitter), IsThumb, IsAndroid);
unsigned const MachineRegisterInfo * MRI
static std::pair< unsigned, unsigned > collectHWRegs(const MCRegisterInfo &MRI, unsigned Idx, const SmallVectorImpl< MCRegister > &RegList, bool IsVector, uint32_t &Mask_)
static std::string GetAEABIUnwindPersonalityName(unsigned Index)
dxil DXContainer Global Emitter
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
This file defines the DenseMap class.
uint64_t IntrinsicInst * II
static constexpr MCPhysReg FPReg
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file defines the SmallVector class.
virtual void emitUnwindRaw(int64_t StackOffset, const SmallVectorImpl< uint8_t > &Opcodes)
virtual void reset()
Reset any state between object emissions, i.e.
virtual void emitSetFP(MCRegister FpReg, MCRegister SpReg, int64_t Offset=0)
virtual void annotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE)
virtual void finishAttributeSection()
virtual void emitMovSP(MCRegister Reg, int64_t Offset=0)
virtual void emitARMWinCFISaveSP(unsigned Reg)
virtual void emitPersonalityIndex(unsigned Index)
virtual void emitInst(uint32_t Inst, char Suffix='\0')
virtual void emitARMWinCFISaveLR(unsigned Offset)
virtual void emitArchExtension(uint64_t ArchExt)
virtual void emitTextAttribute(unsigned Attribute, StringRef String)
virtual void emitARMWinCFIAllocStack(unsigned Size, bool Wide)
virtual void emitARMWinCFICustom(unsigned Opcode)
virtual void emitARMWinCFISaveRegMask(unsigned Mask, bool Wide)
virtual void emitRegSave(const SmallVectorImpl< MCRegister > &RegList, bool isVector)
virtual void emitARMWinCFIEpilogEnd()
virtual void emitARMWinCFIPrologEnd(bool Fragment)
virtual void switchVendor(StringRef Vendor)
virtual void emitFnStart()
virtual void emitPersonality(const MCSymbol *Personality)
virtual void emitObjectArch(ARM::ArchKind Arch)
virtual void emitHandlerData()
virtual void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue="")
virtual void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value)
virtual void emitThumbFunc(MCSymbol *Symbol)
virtual void emitFPU(ARM::FPUKind FPU)
virtual void emitCantUnwind()
virtual void emitARMWinCFISaveFRegs(unsigned First, unsigned Last)
virtual void emitARMWinCFIEpilogStart(unsigned Condition)
virtual void emitPad(int64_t Offset)
virtual void emitAttribute(unsigned Attribute, unsigned Value)
virtual void emitARMWinCFINop(bool Wide)
virtual void emitArch(ARM::ArchKind Arch)
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool isLittleEndian() const
True if the target is little endian.
bool hasSubsectionsViaSymbols() const
void setIsThumbFunc(const MCSymbol *Func)
Flag a function symbol as the target of a .thumb_func directive.
Context object for machine code objects.
const MCObjectFileInfo * getObjectFileInfo() const
const MCAsmInfo * getAsmInfo() const
void reportError(SMLoc L, const Twine &Msg)
Fragment for data and encoded instructions.
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override
Emit the expression Value into the output as a native integer of the given Size bytes.
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
void reset() override
state management
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F, uint64_t Offset) override
SmallVectorImpl< MCFixup > & getFixups()
SmallVectorImpl< char > & getContents()
Base class for the full range of assembler expressions which are needed for parsing.
static MCFixupKind getKindForSize(unsigned Size, bool IsPCRel)
Return the generic fixup kind for a value with the given size.
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Instances of this class represent a single low-level machine instruction.
MCSection * getTextSection() const
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override
Emit Size bytes worth of the value specified by FillValue.
MCDataFragment * getOrCreateDataFragment(const MCSubtargetInfo *STI=nullptr)
Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.
MCAssembler & getAssembler()
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
This represents a section on linux, lots of unix variants and some bare metal systems.
unsigned getUniqueID() const
const MCSymbolELF * getGroup() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
StringRef getName() const
MCSymbol * getBeginSymbol()
Streaming machine code generation interface.
MCFragment * getCurrentFragment() const
MCContext & getContext() const
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef getName() const
getName - Get the symbol name.
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
Target specific streamer interface.
MCStreamer & getStreamer()
virtual void emitLabel(MCSymbol *Symbol)
Represents a location in source code.
SectionKind - This is a simple POD value that classifies the properties of a section.
static SectionKind getData()
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Twine utohexstr(const uint64_t &Val)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '\t', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an esca...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const TagNameMap & getARMAttributeTags()
@ EXIDX_CANTUNWIND
Special entry for the function never unwind.
StringRef getArchExtName(uint64_t ArchExtKind)
StringRef getCPUAttr(ArchKind AK)
StringRef getArchName(ArchKind AK)
unsigned getArchAttr(ArchKind AK)
StringRef getFPUName(FPUKind FPUKind)
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap, bool hasTagPrefix=true)
Reg
All possible values of the reg field in the ModR/M byte.
This is an optimization pass for GlobalISel generic memory operations.
MCELFStreamer * createARMELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter, bool IsThumb, bool IsAndroid)
MCTargetStreamer * createARMObjectTargetELFStreamer(MCStreamer &S)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
void sort(IteratorTy Start, IteratorTy End)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
@ FK_Data_4
A four-byte fixup.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
@ MCAF_SyntaxUnified
.syntax (ARM/ELF)
@ MCAF_Code64
.code64 (X86)
@ MCAF_Code16
.code16 (X86) / .code 16 (ARM)
@ MCAF_Code32
.code32 (X86) / .code 32 (ARM)
@ MCAF_SubsectionsViaSymbols
.subsections_via_symbols (MachO)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
static const char * ARMCondCodeToString(ARMCC::CondCodes CC)
MCTargetStreamer * createARMNullTargetStreamer(MCStreamer &S)
MCTargetStreamer * createARMTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint)
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
ELF object attributes section emission support.