61 "Invalid personality index");
80 void emitSetFP(
unsigned FpReg,
unsigned SpReg, int64_t
Offset = 0)
override;
84 bool isVector)
override;
119ARMTargetAsmStreamer::ARMTargetAsmStreamer(
MCStreamer &S,
124 IsVerboseAsm(VerboseAsm) {}
126void ARMTargetAsmStreamer::emitFnStart() {
OS <<
"\t.fnstart\n"; }
127void ARMTargetAsmStreamer::emitFnEnd() {
OS <<
"\t.fnend\n"; }
128void ARMTargetAsmStreamer::emitCantUnwind() {
OS <<
"\t.cantunwind\n"; }
130void ARMTargetAsmStreamer::emitPersonality(
const MCSymbol *Personality) {
131 OS <<
"\t.personality " << Personality->
getName() <<
'\n';
134void ARMTargetAsmStreamer::emitPersonalityIndex(
unsigned Index) {
135 OS <<
"\t.personalityindex " <<
Index <<
'\n';
138void ARMTargetAsmStreamer::emitHandlerData() {
OS <<
"\t.handlerdata\n"; }
140void ARMTargetAsmStreamer::emitSetFP(
unsigned FpReg,
unsigned SpReg,
143 InstPrinter.printRegName(
OS, FpReg);
145 InstPrinter.printRegName(
OS, SpReg);
151void ARMTargetAsmStreamer::emitMovSP(
unsigned Reg, int64_t
Offset) {
152 assert((Reg != ARM::SP && Reg != ARM::PC) &&
153 "the operand of .movsp cannot be either sp or pc");
156 InstPrinter.printRegName(
OS, Reg);
162void ARMTargetAsmStreamer::emitPad(int64_t
Offset) {
163 OS <<
"\t.pad\t#" <<
Offset <<
'\n';
168 assert(RegList.
size() &&
"RegList should not be empty");
174 InstPrinter.printRegName(
OS, RegList[0]);
176 for (
unsigned i = 1, e = RegList.
size(); i != e; ++i) {
178 InstPrinter.printRegName(
OS, RegList[i]);
184void ARMTargetAsmStreamer::switchVendor(
StringRef Vendor) {}
186void ARMTargetAsmStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
197void ARMTargetAsmStreamer::emitTextAttribute(
unsigned Attribute,
204 OS <<
"\t.eabi_attribute\t" <<
Attribute <<
", \"";
221void ARMTargetAsmStreamer::emitIntTextAttribute(
unsigned Attribute,
227 OS <<
"\t.eabi_attribute\t" <<
Attribute <<
", " << IntValue;
228 if (!StringValue.
empty())
229 OS <<
", \"" << StringValue <<
"\"";
243void ARMTargetAsmStreamer::emitArchExtension(
uint64_t ArchExt) {
247void ARMTargetAsmStreamer::emitObjectArch(
ARM::ArchKind Arch) {
255void ARMTargetAsmStreamer::finishAttributeSection() {}
257void ARMTargetAsmStreamer::annotateTLSDescriptorSequence(
263 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
265 OS <<
"\t.thumb_set\t";
272void ARMTargetAsmStreamer::emitInst(
uint32_t Inst,
char Suffix) {
279void ARMTargetAsmStreamer::emitUnwindRaw(int64_t
Offset,
282 for (uint8_t Opcode : Opcodes)
287void ARMTargetAsmStreamer::emitARMWinCFIAllocStack(
unsigned Size,
bool Wide) {
289 OS <<
"\t.seh_stackalloc_w\t" <<
Size <<
"\n";
291 OS <<
"\t.seh_stackalloc\t" <<
Size <<
"\n";
302void ARMTargetAsmStreamer::emitARMWinCFISaveRegMask(
unsigned Mask,
bool Wide) {
304 OS <<
"\t.seh_save_regs_w\t";
306 OS <<
"\t.seh_save_regs\t";
310 for (
int I = 0;
I <= 12;
I++) {
311 if (Mask & (1 <<
I)) {
316 printRegs(
OS, LS, First,
I - 1);
322 printRegs(
OS, LS, First, 12);
323 if (Mask & (1 << 14))
328void ARMTargetAsmStreamer::emitARMWinCFISaveSP(
unsigned Reg) {
329 OS <<
"\t.seh_save_sp\tr" <<
Reg <<
"\n";
332void ARMTargetAsmStreamer::emitARMWinCFISaveFRegs(
unsigned First,
335 OS <<
"\t.seh_save_fregs\t{d" <<
First <<
"-d" <<
Last <<
"}\n";
337 OS <<
"\t.seh_save_fregs\t{d" <<
First <<
"}\n";
340void ARMTargetAsmStreamer::emitARMWinCFISaveLR(
unsigned Offset) {
341 OS <<
"\t.seh_save_lr\t" <<
Offset <<
"\n";
344void ARMTargetAsmStreamer::emitARMWinCFIPrologEnd(
bool Fragment) {
346 OS <<
"\t.seh_endprologue_fragment\n";
348 OS <<
"\t.seh_endprologue\n";
351void ARMTargetAsmStreamer::emitARMWinCFINop(
bool Wide) {
353 OS <<
"\t.seh_nop_w\n";
355 OS <<
"\t.seh_nop\n";
358void ARMTargetAsmStreamer::emitARMWinCFIEpilogStart(
unsigned Condition) {
360 OS <<
"\t.seh_startepilogue\n";
362 OS <<
"\t.seh_startepilogue_cond\t"
366void ARMTargetAsmStreamer::emitARMWinCFIEpilogEnd() {
367 OS <<
"\t.seh_endepilogue\n";
370void ARMTargetAsmStreamer::emitARMWinCFICustom(
unsigned Opcode) {
372 for (
I = 3;
I > 0;
I--)
373 if (Opcode & (0xffu << (8 *
I)))
376 OS <<
"\t.seh_custom\t";
378 OS << LS << ((Opcode >> (8 *
I)) & 0xff);
391 void emitArchDefaultAttributes();
392 void emitFPUDefaultAttributes();
402 void emitSetFP(
unsigned FpReg,
unsigned SpReg, int64_t
Offset = 0)
override;
406 bool isVector)
override;
426 void reset()
override;
447 friend class ARMTargetELFStreamer;
449 ARMELFStreamer(
MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
450 std::unique_ptr<MCObjectWriter> OW,
451 std::unique_ptr<MCCodeEmitter>
Emitter,
bool IsThumb,
455 IsThumb(IsThumb), IsAndroid(IsAndroid) {
459 ~ARMELFStreamer()
override =
default;
466 void emitCantUnwind();
467 void emitPersonality(
const MCSymbol *Per);
468 void emitPersonalityIndex(
unsigned index);
469 void emitHandlerData();
470 void emitSetFP(
unsigned NewFpReg,
unsigned NewSpReg, int64_t
Offset = 0);
471 void emitMovSP(
unsigned Reg, int64_t
Offset = 0);
472 void emitPad(int64_t
Offset);
476 SMLoc Loc)
override {
477 emitDataMappingSymbol();
484 auto LastMappingSymbol = LastMappingSymbols.find(Section);
485 if (LastMappingSymbol != LastMappingSymbols.end()) {
486 LastEMSInfo = std::move(LastMappingSymbol->second);
489 LastEMSInfo.reset(
new ElfMappingSymbolInfo(
SMLoc(),
nullptr, 0));
498 EmitThumbMappingSymbol();
500 EmitARMMappingSymbol();
505 void emitInst(
uint32_t Inst,
char Suffix) {
515 EmitARMMappingSymbol();
516 for (
unsigned II = 0, IE =
Size; II !=
IE; II++) {
517 const unsigned I = LittleEndian ? (
Size - II - 1) : II;
518 Buffer[
Size - II - 1] = uint8_t(Inst >>
I * CHAR_BIT);
524 Size = (Suffix ==
'n' ? 2 : 4);
527 EmitThumbMappingSymbol();
530 for (
unsigned II = 0, IE =
Size; II !=
IE; II = II + 2) {
531 const unsigned I0 = LittleEndian ? II + 0 : II + 1;
532 const unsigned I1 = LittleEndian ? II + 1 : II + 0;
533 Buffer[
Size - II - 2] = uint8_t(Inst >> I0 * CHAR_BIT);
534 Buffer[
Size - II - 1] = uint8_t(Inst >> I1 * CHAR_BIT);
549 emitDataMappingSymbol();
553 void FlushPendingMappingSymbol() {
554 if (!LastEMSInfo->hasInfo())
556 ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
557 EmitMappingSymbol(
"$d", EMS->Loc, EMS->F, EMS->Offset);
573 emitDataMappingSymbol();
610 unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
619 enum ElfMappingSymbol {
626 struct ElfMappingSymbolInfo {
628 : Loc(Loc),
F(
F),
Offset(
O), State(EMS_None) {}
633 bool hasInfo() {
return F !=
nullptr; }
637 ElfMappingSymbol State;
640 void emitDataMappingSymbol() {
641 if (LastEMSInfo->State == EMS_Data)
643 else if (LastEMSInfo->State == EMS_None) {
646 ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
652 EMS->Offset =
DF->getContents().size();
653 LastEMSInfo->State = EMS_Data;
656 EmitMappingSymbol(
"$d");
657 LastEMSInfo->State = EMS_Data;
660 void EmitThumbMappingSymbol() {
661 if (LastEMSInfo->State == EMS_Thumb)
663 FlushPendingMappingSymbol();
664 EmitMappingSymbol(
"$t");
665 LastEMSInfo->State = EMS_Thumb;
668 void EmitARMMappingSymbol() {
669 if (LastEMSInfo->State == EMS_ARM)
671 FlushPendingMappingSymbol();
672 EmitMappingSymbol(
"$a");
673 LastEMSInfo->State = EMS_ARM;
678 Name +
"." +
Twine(MappingSymbolCounter++)));
688 Name +
"." +
Twine(MappingSymbolCounter++)));
703 void reset()
override;
706 void FlushPendingOffset();
707 void FlushUnwindOpcodes(
bool NoHandlerData);
709 void SwitchToEHSection(
StringRef Prefix,
unsigned Type,
unsigned Flags,
711 void SwitchToExTabSection(
const MCSymbol &FnStart);
712 void SwitchToExIdxSection(
const MCSymbol &FnStart);
718 int64_t MappingSymbolCounter = 0;
723 std::unique_ptr<ElfMappingSymbolInfo> LastEMSInfo;
729 unsigned PersonalityIndex;
733 int64_t PendingOffset;
742ARMELFStreamer &ARMTargetELFStreamer::getStreamer() {
743 return static_cast<ARMELFStreamer &
>(Streamer);
746void ARMTargetELFStreamer::emitFnStart() { getStreamer().emitFnStart(); }
747void ARMTargetELFStreamer::emitFnEnd() { getStreamer().emitFnEnd(); }
748void ARMTargetELFStreamer::emitCantUnwind() { getStreamer().emitCantUnwind(); }
750void ARMTargetELFStreamer::emitPersonality(
const MCSymbol *Personality) {
751 getStreamer().emitPersonality(Personality);
754void ARMTargetELFStreamer::emitPersonalityIndex(
unsigned Index) {
755 getStreamer().emitPersonalityIndex(
Index);
758void ARMTargetELFStreamer::emitHandlerData() {
759 getStreamer().emitHandlerData();
762void ARMTargetELFStreamer::emitSetFP(
unsigned FpReg,
unsigned SpReg,
764 getStreamer().emitSetFP(FpReg, SpReg,
Offset);
767void ARMTargetELFStreamer::emitMovSP(
unsigned Reg, int64_t
Offset) {
768 getStreamer().emitMovSP(Reg,
Offset);
771void ARMTargetELFStreamer::emitPad(int64_t
Offset) {
772 getStreamer().emitPad(
Offset);
777 getStreamer().emitRegSave(RegList, isVector);
780void ARMTargetELFStreamer::emitUnwindRaw(int64_t
Offset,
782 getStreamer().emitUnwindRaw(
Offset, Opcodes);
785void ARMTargetELFStreamer::switchVendor(
StringRef Vendor) {
786 assert(!Vendor.
empty() &&
"Vendor cannot be empty.");
788 if (CurrentVendor == Vendor)
791 if (!CurrentVendor.empty())
792 finishAttributeSection();
794 assert(getStreamer().Contents.empty() &&
795 ".ARM.attributes should be flushed before changing vendor");
796 CurrentVendor = Vendor;
800void ARMTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
805void ARMTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
811void ARMTargetELFStreamer::emitIntTextAttribute(
unsigned Attribute,
814 getStreamer().setAttributeItems(
Attribute, IntValue, StringValue,
826void ARMTargetELFStreamer::emitArchDefaultAttributes() {
827 using namespace ARMBuildAttrs;
828 ARMELFStreamer &S = getStreamer();
832 if (EmittedArch == ARM::ArchKind::INVALID)
838 case ARM::ArchKind::ARMV4:
839 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
842 case ARM::ArchKind::ARMV4T:
843 case ARM::ArchKind::ARMV5T:
844 case ARM::ArchKind::XSCALE:
845 case ARM::ArchKind::ARMV5TE:
846 case ARM::ArchKind::ARMV6:
847 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
848 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
851 case ARM::ArchKind::ARMV6T2:
852 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
853 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
856 case ARM::ArchKind::ARMV6K:
857 case ARM::ArchKind::ARMV6KZ:
858 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
859 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
860 S.setAttributeItem(Virtualization_use, AllowTZ,
false);
863 case ARM::ArchKind::ARMV6M:
864 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
867 case ARM::ArchKind::ARMV7A:
868 S.setAttributeItem(CPU_arch_profile, ApplicationProfile,
false);
869 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
870 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
873 case ARM::ArchKind::ARMV7R:
874 S.setAttributeItem(CPU_arch_profile, RealTimeProfile,
false);
875 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
876 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
879 case ARM::ArchKind::ARMV7EM:
880 case ARM::ArchKind::ARMV7M:
881 S.setAttributeItem(CPU_arch_profile, MicroControllerProfile,
false);
882 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
885 case ARM::ArchKind::ARMV8A:
886 case ARM::ArchKind::ARMV8_1A:
887 case ARM::ArchKind::ARMV8_2A:
888 case ARM::ArchKind::ARMV8_3A:
889 case ARM::ArchKind::ARMV8_4A:
890 case ARM::ArchKind::ARMV8_5A:
891 case ARM::ArchKind::ARMV8_6A:
892 case ARM::ArchKind::ARMV8_7A:
893 case ARM::ArchKind::ARMV8_8A:
894 case ARM::ArchKind::ARMV8_9A:
895 case ARM::ArchKind::ARMV9A:
896 case ARM::ArchKind::ARMV9_1A:
897 case ARM::ArchKind::ARMV9_2A:
898 case ARM::ArchKind::ARMV9_3A:
899 case ARM::ArchKind::ARMV9_4A:
900 S.setAttributeItem(CPU_arch_profile, ApplicationProfile,
false);
901 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
902 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
903 S.setAttributeItem(MPextension_use, Allowed,
false);
904 S.setAttributeItem(Virtualization_use, AllowTZVirtualization,
false);
907 case ARM::ArchKind::ARMV8MBaseline:
908 case ARM::ArchKind::ARMV8MMainline:
909 S.setAttributeItem(THUMB_ISA_use, AllowThumbDerived,
false);
910 S.setAttributeItem(CPU_arch_profile, MicroControllerProfile,
false);
913 case ARM::ArchKind::IWMMXT:
914 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
915 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
916 S.setAttributeItem(WMMX_arch, AllowWMMXv1,
false);
919 case ARM::ArchKind::IWMMXT2:
920 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
921 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
922 S.setAttributeItem(WMMX_arch, AllowWMMXv2,
false);
933void ARMTargetELFStreamer::emitFPUDefaultAttributes() {
934 ARMELFStreamer &S = getStreamer();
948 case ARM::FK_VFPV3_FP16:
955 case ARM::FK_VFPV3_D16:
960 case ARM::FK_VFPV3_D16_FP16:
967 case ARM::FK_VFPV3XD:
971 case ARM::FK_VFPV3XD_FP16:
985 case ARM::FK_FPV4_SP_D16:
986 case ARM::FK_VFPV4_D16:
991 case ARM::FK_FP_ARMV8:
998 case ARM::FK_FPV5_SP_D16:
999 case ARM::FK_FPV5_D16:
1012 case ARM::FK_NEON_FP16:
1022 case ARM::FK_NEON_VFPV4:
1030 case ARM::FK_NEON_FP_ARMV8:
1031 case ARM::FK_CRYPTO_NEON_FP_ARMV8:
1038 case ARM::FK_SOFTVFP:
1048void ARMTargetELFStreamer::finishAttributeSection() {
1049 ARMELFStreamer &S = getStreamer();
1051 if (FPU != ARM::FK_INVALID)
1052 emitFPUDefaultAttributes();
1054 if (Arch != ARM::ArchKind::INVALID)
1055 emitArchDefaultAttributes();
1057 if (S.Contents.empty())
1078 S.emitAttributesSection(CurrentVendor,
".ARM.attributes",
1081 FPU = ARM::FK_INVALID;
1084void ARMTargetELFStreamer::emitLabel(
MCSymbol *Symbol) {
1085 ARMELFStreamer &Streamer = getStreamer();
1086 if (!Streamer.IsThumb)
1089 Streamer.getAssembler().registerSymbol(*Symbol);
1090 unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
1092 Streamer.emitThumbFunc(Symbol);
1095void ARMTargetELFStreamer::annotateTLSDescriptorSequence(
1103 if (!
Sym.isDefined()) {
1104 getStreamer().emitAssignment(Symbol,
Value);
1109 getStreamer().emitThumbFunc(Symbol);
1110 getStreamer().emitAssignment(Symbol,
Value);
1113void ARMTargetELFStreamer::emitInst(
uint32_t Inst,
char Suffix) {
1114 getStreamer().emitInst(Inst, Suffix);
1117void ARMTargetELFStreamer::reset() { AttributeSection =
nullptr; }
1119void ARMELFStreamer::finishImpl() {
1127void ARMELFStreamer::reset() {
1131 MappingSymbolCounter = 0;
1133 LastMappingSymbols.clear();
1134 LastEMSInfo.reset();
1141inline void ARMELFStreamer::SwitchToEHSection(
StringRef Prefix,
1152 if (FnSecName !=
".text") {
1153 EHSecName += FnSecName;
1161 EHSecName,
Type, Flags, 0, Group,
true,
1165 assert(EHSection &&
"Failed to get the required EH section");
1168 switchSection(EHSection);
1169 emitValueToAlignment(
Align(4), 0, 1, 0);
1172inline void ARMELFStreamer::SwitchToExTabSection(
const MCSymbol &FnStart) {
1177inline void ARMELFStreamer::SwitchToExIdxSection(
const MCSymbol &FnStart) {
1189void ARMELFStreamer::EHReset() {
1192 Personality =
nullptr;
1202 UnwindOpAsm.Reset();
1205void ARMELFStreamer::emitFnStart() {
1206 assert(FnStart ==
nullptr);
1207 FnStart = getContext().createTempSymbol();
1211void ARMELFStreamer::emitFnEnd() {
1212 assert(FnStart &&
".fnstart must precedes .fnend");
1215 if (!ExTab && !CantUnwind)
1216 FlushUnwindOpcodes(
true);
1219 SwitchToExIdxSection(*FnStart);
1234 emitValue(FnStartRef, 4);
1244 emitValue(ExTabEntryRef, 4);
1250 "Compact model must use __aeabi_unwind_cpp_pr0 as personality");
1252 "Unwind opcode size for __aeabi_unwind_cpp_pr0 must be equal to 4");
1257 emitIntValue(Intval, Opcodes.
size());
1267void ARMELFStreamer::emitCantUnwind() { CantUnwind =
true; }
1271 const MCSymbol *PersonalitySym = getContext().getOrCreateSymbol(
Name);
1276 visitUsedExpr(*PersonalityRef);
1283void ARMELFStreamer::FlushPendingOffset() {
1284 if (PendingOffset != 0) {
1285 UnwindOpAsm.EmitSPOffset(-PendingOffset);
1290void ARMELFStreamer::FlushUnwindOpcodes(
bool NoHandlerData) {
1294 int64_t LastRegSaveSPOffset = SPOffset - PendingOffset;
1295 UnwindOpAsm.EmitSPOffset(LastRegSaveSPOffset - FPOffset);
1296 UnwindOpAsm.EmitSetSP(
MRI->getEncodingValue(FPReg));
1298 FlushPendingOffset();
1302 UnwindOpAsm.Finalize(PersonalityIndex, Opcodes);
1311 SwitchToExTabSection(*FnStart);
1315 ExTab = getContext().createTempSymbol();
1325 emitValue(PersonalityRef, 4);
1330 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
1331 for (
unsigned I = 0;
I != Opcodes.
size();
I += 4) {
1333 Opcodes[
I + 1] << 8 |
1334 Opcodes[
I + 2] << 16 |
1335 Opcodes[
I + 3] << 24;
1346 if (NoHandlerData && !Personality)
1350void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(
false); }
1352void ARMELFStreamer::emitPersonality(
const MCSymbol *Per) {
1354 UnwindOpAsm.setPersonality(Per);
1357void ARMELFStreamer::emitPersonalityIndex(
unsigned Index) {
1359 PersonalityIndex =
Index;
1362void ARMELFStreamer::emitSetFP(
unsigned NewFPReg,
unsigned NewSPReg,
1364 assert((NewSPReg == ARM::SP || NewSPReg == FPReg) &&
1365 "the operand of .setfp directive should be either $sp or $fp");
1370 if (NewSPReg == ARM::SP)
1371 FPOffset = SPOffset +
Offset;
1376void ARMELFStreamer::emitMovSP(
unsigned Reg, int64_t
Offset) {
1377 assert((Reg != ARM::SP && Reg != ARM::PC) &&
1378 "the operand of .movsp cannot be either sp or pc");
1379 assert(FPReg == ARM::SP &&
"current FP must be SP");
1381 FlushPendingOffset();
1384 FPOffset = SPOffset +
Offset;
1387 UnwindOpAsm.EmitSetSP(
MRI->getEncodingValue(FPReg));
1390void ARMELFStreamer::emitPad(int64_t
Offset) {
1399static std::pair<unsigned, unsigned>
1406 unsigned Reg = RegList[
Idx - 1];
1407 if (Reg == ARM::RA_AUTH_CODE)
1409 Reg =
MRI.getEncodingValue(Reg);
1410 assert(Reg < (IsVector ? 32U : 16U) &&
"Register out of range");
1411 unsigned Bit = (1u << Reg);
1412 if ((Mask & Bit) == 0) {
1420 return {
Idx, Count};
1426 unsigned Idx, Count;
1443 SPOffset -= Count * (IsVector ? 8 : 4);
1446 FlushPendingOffset();
1448 UnwindOpAsm.EmitVFPRegSave(Mask);
1450 UnwindOpAsm.EmitRegSave(Mask);
1451 }
else if (
Idx > 0 && RegList[
Idx - 1] == ARM::RA_AUTH_CODE) {
1454 FlushPendingOffset();
1455 UnwindOpAsm.EmitRegSave(0);
1460void ARMELFStreamer::emitUnwindRaw(int64_t
Offset,
1462 FlushPendingOffset();
1463 SPOffset = SPOffset -
Offset;
1464 UnwindOpAsm.EmitRaw(Opcodes);
1472 bool isVerboseAsm) {
1473 return new ARMTargetAsmStreamer(S,
OS, *InstPrint, isVerboseAsm);
1481 return new ARMTargetELFStreamer(S);
1485 std::unique_ptr<MCAsmBackend> TAB,
1486 std::unique_ptr<MCObjectWriter> OW,
1487 std::unique_ptr<MCCodeEmitter>
Emitter,
1488 bool RelaxAll,
bool IsThumb,
1491 new ARMELFStreamer(
Context, std::move(TAB), std::move(OW),
1492 std::move(
Emitter), IsThumb, IsAndroid);
1499 S->getAssembler().setRelaxAll(
true);
unsigned const MachineRegisterInfo * MRI
static std::string GetAEABIUnwindPersonalityName(unsigned Index)
static std::pair< unsigned, unsigned > collectHWRegs(const MCRegisterInfo &MRI, unsigned Idx, const SmallVectorImpl< unsigned > &RegList, bool IsVector, uint32_t &Mask_)
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.
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 annotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE)
virtual void finishAttributeSection()
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 emitRegSave(const SmallVectorImpl< unsigned > &RegList, bool isVector)
virtual void emitTextAttribute(unsigned Attribute, StringRef String)
virtual void emitARMWinCFIAllocStack(unsigned Size, bool Wide)
virtual void emitMovSP(unsigned Reg, int64_t Offset=0)
virtual void emitARMWinCFICustom(unsigned Opcode)
virtual void emitARMWinCFISaveRegMask(unsigned Mask, bool Wide)
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 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 emitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset=0)
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.
void setIsThumbFunc(const MCSymbol *Func)
Flag a function symbol as the target of a .thumb_func directive.
Context object for machine code objects.
const MCAsmInfo * getAsmInfo() const
void reportError(SMLoc L, const Twine &Msg)
Fragment for data and encoded instructions.
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 emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, uint64_t Offset) override
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
void reset() override
state management
void changeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
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 finishImpl() override
Streamer specific finalization.
SmallVectorImpl< char > & getContents()
SmallVectorImpl< MCFixup > & getFixups()
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.
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.
MCFragment * getCurrentFragment() const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
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.
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.
MCTargetStreamer * createARMObjectTargetELFStreamer(MCStreamer &S)
MCELFStreamer * createARMELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter, bool RelaxAll, bool IsThumb, bool IsAndroid)
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.
@ 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 * createARMTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
MCTargetStreamer * createARMNullTargetStreamer(MCStreamer &S)
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
This struct is a compact representation of a valid (non-zero power of two) alignment.
ELF object attributes section emission support.