62 "Invalid personality index");
63 return (
Twine(
"__aeabi_unwind_cpp_pr") +
Twine(Index)).str();
82 int64_t
Offset = 0)
override;
86 bool isVector)
override;
125ARMTargetAsmStreamer::ARMTargetAsmStreamer(
MCStreamer &S,
129 IsVerboseAsm(S.isVerboseAsm()) {}
131void ARMTargetAsmStreamer::emitFnStart() {
OS <<
"\t.fnstart\n"; }
132void ARMTargetAsmStreamer::emitFnEnd() {
OS <<
"\t.fnend\n"; }
133void ARMTargetAsmStreamer::emitCantUnwind() {
OS <<
"\t.cantunwind\n"; }
135void ARMTargetAsmStreamer::emitPersonality(
const MCSymbol *Personality) {
136 OS <<
"\t.personality " << Personality->
getName() <<
'\n';
139void ARMTargetAsmStreamer::emitPersonalityIndex(
unsigned Index) {
140 OS <<
"\t.personalityindex " <<
Index <<
'\n';
143void ARMTargetAsmStreamer::emitHandlerData() {
OS <<
"\t.handlerdata\n"; }
148 InstPrinter.printRegName(
OS, FpReg);
150 InstPrinter.printRegName(
OS, SpReg);
157 assert((Reg != ARM::SP && Reg != ARM::PC) &&
158 "the operand of .movsp cannot be either sp or pc");
161 InstPrinter.printRegName(
OS, Reg);
167void ARMTargetAsmStreamer::emitPad(int64_t
Offset) {
168 OS <<
"\t.pad\t#" <<
Offset <<
'\n';
171void ARMTargetAsmStreamer::emitRegSave(
173 assert(RegList.
size() &&
"RegList should not be empty");
179 InstPrinter.printRegName(
OS, RegList[0]);
181 for (
unsigned i = 1, e = RegList.
size(); i != e; ++i) {
183 InstPrinter.printRegName(
OS, RegList[i]);
189void ARMTargetAsmStreamer::switchVendor(
StringRef Vendor) {}
191void ARMTargetAsmStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
202void ARMTargetAsmStreamer::emitTextAttribute(
unsigned Attribute,
209 OS <<
"\t.eabi_attribute\t" <<
Attribute <<
", \"";
226void ARMTargetAsmStreamer::emitIntTextAttribute(
unsigned Attribute,
232 OS <<
"\t.eabi_attribute\t" <<
Attribute <<
", " << IntValue;
233 if (!StringValue.
empty())
234 OS <<
", \"" << StringValue <<
"\"";
248void ARMTargetAsmStreamer::emitArchExtension(
uint64_t ArchExt) {
252void ARMTargetAsmStreamer::emitObjectArch(
ARM::ArchKind Arch) {
260void ARMTargetAsmStreamer::finishAttributeSection() {}
262void ARMTargetAsmStreamer::annotateTLSDescriptorSequence(
267void ARMTargetAsmStreamer::emitSyntaxUnified() {
OS <<
"\t.syntax\tunified\n"; }
269void ARMTargetAsmStreamer::emitCode16() {
OS <<
"\t.code\t16\n"; }
271void ARMTargetAsmStreamer::emitCode32() {
OS <<
"\t.code\t32\n"; }
273void ARMTargetAsmStreamer::emitThumbFunc(
MCSymbol *Symbol) {
274 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
275 OS <<
"\t.thumb_func";
285 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
287 OS <<
"\t.thumb_set\t";
294void ARMTargetAsmStreamer::emitInst(
uint32_t Inst,
char Suffix) {
301void ARMTargetAsmStreamer::emitUnwindRaw(int64_t
Offset,
309void ARMTargetAsmStreamer::emitARMWinCFIAllocStack(
unsigned Size,
bool Wide) {
311 OS <<
"\t.seh_stackalloc_w\t" <<
Size <<
"\n";
313 OS <<
"\t.seh_stackalloc\t" <<
Size <<
"\n";
324void ARMTargetAsmStreamer::emitARMWinCFISaveRegMask(
unsigned Mask,
bool Wide) {
326 OS <<
"\t.seh_save_regs_w\t";
328 OS <<
"\t.seh_save_regs\t";
332 for (
int I = 0;
I <= 12;
I++) {
333 if (Mask & (1 <<
I)) {
345 if (Mask & (1 << 14))
350void ARMTargetAsmStreamer::emitARMWinCFISaveSP(
unsigned Reg) {
351 OS <<
"\t.seh_save_sp\tr" <<
Reg <<
"\n";
354void ARMTargetAsmStreamer::emitARMWinCFISaveFRegs(
unsigned First,
357 OS <<
"\t.seh_save_fregs\t{d" <<
First <<
"-d" <<
Last <<
"}\n";
359 OS <<
"\t.seh_save_fregs\t{d" <<
First <<
"}\n";
362void ARMTargetAsmStreamer::emitARMWinCFISaveLR(
unsigned Offset) {
363 OS <<
"\t.seh_save_lr\t" <<
Offset <<
"\n";
366void ARMTargetAsmStreamer::emitARMWinCFIPrologEnd(
bool Fragment) {
368 OS <<
"\t.seh_endprologue_fragment\n";
370 OS <<
"\t.seh_endprologue\n";
373void ARMTargetAsmStreamer::emitARMWinCFINop(
bool Wide) {
375 OS <<
"\t.seh_nop_w\n";
377 OS <<
"\t.seh_nop\n";
380void ARMTargetAsmStreamer::emitARMWinCFIEpilogStart(
unsigned Condition) {
382 OS <<
"\t.seh_startepilogue\n";
384 OS <<
"\t.seh_startepilogue_cond\t"
388void ARMTargetAsmStreamer::emitARMWinCFIEpilogEnd() {
389 OS <<
"\t.seh_endepilogue\n";
392void ARMTargetAsmStreamer::emitARMWinCFICustom(
unsigned Opcode) {
394 for (
I = 3;
I > 0;
I--)
395 if (Opcode & (0xffu << (8 *
I)))
398 OS <<
"\t.seh_custom\t";
400 OS << LS << ((Opcode >> (8 *
I)) & 0xff);
413 void emitArchDefaultAttributes();
414 void emitFPUDefaultAttributes();
425 int64_t
Offset = 0)
override;
429 bool isVector)
override;
452 void reset()
override;
475 friend class ARMTargetELFStreamer;
477 ARMELFStreamer(
MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
478 std::unique_ptr<MCObjectWriter> OW,
479 std::unique_ptr<MCCodeEmitter>
Emitter,
bool IsThumb,
483 IsThumb(IsThumb), IsAndroid(IsAndroid) {
487 ~ARMELFStreamer()
override =
default;
492 void emitCantUnwind();
493 void emitPersonality(
const MCSymbol *Per);
494 void emitPersonalityIndex(
unsigned index);
495 void emitHandlerData();
498 void emitPad(int64_t
Offset);
502 SMLoc Loc)
override {
503 emitDataMappingSymbol();
510 auto LastMappingSymbol = LastMappingSymbols.find(Section);
511 if (LastMappingSymbol != LastMappingSymbols.end()) {
512 LastEMSInfo = std::move(LastMappingSymbol->second);
515 LastEMSInfo.reset(
new ElfMappingSymbolInfo);
524 EmitThumbMappingSymbol();
526 EmitARMMappingSymbol();
531 void emitInst(
uint32_t Inst,
char Suffix) {
541 EmitARMMappingSymbol();
543 const unsigned I = LittleEndian ? (
Size -
II - 1) :
II;
550 Size = (Suffix ==
'n' ? 2 : 4);
553 EmitThumbMappingSymbol();
557 const unsigned I0 = LittleEndian ?
II + 0 :
II + 1;
558 const unsigned I1 = LittleEndian ?
II + 1 :
II + 0;
575 emitDataMappingSymbol();
579 void FlushPendingMappingSymbol() {
580 if (!LastEMSInfo->hasInfo())
582 ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
583 emitMappingSymbol(
"$d", *EMS->F, EMS->Offset);
599 emitDataMappingSymbol();
625 void setIsThumb(
bool Val) { IsThumb = Val; }
628 enum ElfMappingSymbol {
635 struct ElfMappingSymbolInfo {
640 bool hasInfo() {
return F !=
nullptr; }
643 ElfMappingSymbol State = EMS_None;
646 void emitDataMappingSymbol() {
647 if (LastEMSInfo->State == EMS_Data)
649 else if (LastEMSInfo->State == EMS_None) {
652 ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
657 EMS->Offset =
DF->getFixedSize();
658 LastEMSInfo->State = EMS_Data;
661 EmitMappingSymbol(
"$d");
662 LastEMSInfo->State = EMS_Data;
665 void EmitThumbMappingSymbol() {
666 if (LastEMSInfo->State == EMS_Thumb)
668 FlushPendingMappingSymbol();
669 EmitMappingSymbol(
"$t");
670 LastEMSInfo->State = EMS_Thumb;
673 void EmitARMMappingSymbol() {
674 if (LastEMSInfo->State == EMS_ARM)
676 FlushPendingMappingSymbol();
677 EmitMappingSymbol(
"$a");
678 LastEMSInfo->State = EMS_ARM;
702 void reset()
override;
705 void FlushPendingOffset();
706 void FlushUnwindOpcodes(
bool NoHandlerData);
708 void SwitchToEHSection(
StringRef Prefix,
unsigned Type,
unsigned Flags,
710 void SwitchToExTabSection(
const MCSymbol &FnStart);
711 void SwitchToExIdxSection(
const MCSymbol &FnStart);
719 std::unique_ptr<ElfMappingSymbolInfo> LastEMSInfo;
725 unsigned PersonalityIndex;
729 int64_t PendingOffset;
738ARMELFStreamer &ARMTargetELFStreamer::getStreamer() {
739 return static_cast<ARMELFStreamer &
>(Streamer);
742void ARMTargetELFStreamer::emitFnStart() { getStreamer().emitFnStart(); }
743void ARMTargetELFStreamer::emitFnEnd() { getStreamer().emitFnEnd(); }
744void ARMTargetELFStreamer::emitCantUnwind() { getStreamer().emitCantUnwind(); }
746void ARMTargetELFStreamer::emitPersonality(
const MCSymbol *Personality) {
747 getStreamer().emitPersonality(Personality);
750void ARMTargetELFStreamer::emitPersonalityIndex(
unsigned Index) {
751 getStreamer().emitPersonalityIndex(Index);
754void ARMTargetELFStreamer::emitHandlerData() {
755 getStreamer().emitHandlerData();
760 getStreamer().emitSetFP(FpReg, SpReg,
Offset);
764 getStreamer().emitMovSP(Reg,
Offset);
767void ARMTargetELFStreamer::emitPad(int64_t
Offset) {
768 getStreamer().emitPad(
Offset);
771void ARMTargetELFStreamer::emitRegSave(
773 getStreamer().emitRegSave(RegList, isVector);
776void ARMTargetELFStreamer::emitUnwindRaw(int64_t
Offset,
778 getStreamer().emitUnwindRaw(
Offset, Opcodes);
781void ARMTargetELFStreamer::switchVendor(
StringRef Vendor) {
782 assert(!Vendor.
empty() &&
"Vendor cannot be empty.");
784 if (CurrentVendor == Vendor)
787 if (!CurrentVendor.empty())
788 finishAttributeSection();
790 assert(getStreamer().Contents.empty() &&
791 ".ARM.attributes should be flushed before changing vendor");
792 CurrentVendor = Vendor;
796void ARMTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
801void ARMTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
807void ARMTargetELFStreamer::emitIntTextAttribute(
unsigned Attribute,
810 getStreamer().setAttributeItems(
Attribute, IntValue, StringValue,
822void ARMTargetELFStreamer::emitArchDefaultAttributes() {
823 using namespace ARMBuildAttrs;
824 ARMELFStreamer &S = getStreamer();
828 if (EmittedArch == ARM::ArchKind::INVALID)
834 case ARM::ArchKind::ARMV4:
835 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
838 case ARM::ArchKind::ARMV4T:
839 case ARM::ArchKind::ARMV5T:
840 case ARM::ArchKind::XSCALE:
841 case ARM::ArchKind::ARMV5TE:
842 case ARM::ArchKind::ARMV6:
843 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
844 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
847 case ARM::ArchKind::ARMV6T2:
848 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
849 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
852 case ARM::ArchKind::ARMV6K:
853 case ARM::ArchKind::ARMV6KZ:
854 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
855 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
856 S.setAttributeItem(Virtualization_use, AllowTZ,
false);
859 case ARM::ArchKind::ARMV6M:
860 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
863 case ARM::ArchKind::ARMV7A:
864 S.setAttributeItem(CPU_arch_profile, ApplicationProfile,
false);
865 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
866 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
869 case ARM::ArchKind::ARMV7R:
870 S.setAttributeItem(CPU_arch_profile, RealTimeProfile,
false);
871 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
872 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
875 case ARM::ArchKind::ARMV7EM:
876 case ARM::ArchKind::ARMV7M:
877 S.setAttributeItem(CPU_arch_profile, MicroControllerProfile,
false);
878 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
881 case ARM::ArchKind::ARMV8A:
882 case ARM::ArchKind::ARMV8_1A:
883 case ARM::ArchKind::ARMV8_2A:
884 case ARM::ArchKind::ARMV8_3A:
885 case ARM::ArchKind::ARMV8_4A:
886 case ARM::ArchKind::ARMV8_5A:
887 case ARM::ArchKind::ARMV8_6A:
888 case ARM::ArchKind::ARMV8_7A:
889 case ARM::ArchKind::ARMV8_8A:
890 case ARM::ArchKind::ARMV8_9A:
891 case ARM::ArchKind::ARMV9A:
892 case ARM::ArchKind::ARMV9_1A:
893 case ARM::ArchKind::ARMV9_2A:
894 case ARM::ArchKind::ARMV9_3A:
895 case ARM::ArchKind::ARMV9_4A:
896 case ARM::ArchKind::ARMV9_5A:
897 case ARM::ArchKind::ARMV9_6A:
898 S.setAttributeItem(CPU_arch_profile, ApplicationProfile,
false);
899 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
900 S.setAttributeItem(THUMB_ISA_use, AllowThumb32,
false);
901 S.setAttributeItem(MPextension_use, Allowed,
false);
902 S.setAttributeItem(Virtualization_use, AllowTZVirtualization,
false);
905 case ARM::ArchKind::ARMV8MBaseline:
906 case ARM::ArchKind::ARMV8MMainline:
907 case ARM::ArchKind::ARMV8_1MMainline:
908 S.setAttributeItem(THUMB_ISA_use, AllowThumbDerived,
false);
909 S.setAttributeItem(CPU_arch_profile, MicroControllerProfile,
false);
912 case ARM::ArchKind::IWMMXT:
913 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
914 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
915 S.setAttributeItem(WMMX_arch, AllowWMMXv1,
false);
918 case ARM::ArchKind::IWMMXT2:
919 S.setAttributeItem(ARM_ISA_use, Allowed,
false);
920 S.setAttributeItem(THUMB_ISA_use, Allowed,
false);
921 S.setAttributeItem(WMMX_arch, AllowWMMXv2,
false);
932void ARMTargetELFStreamer::emitFPUDefaultAttributes() {
933 ARMELFStreamer &S = getStreamer();
947 case ARM::FK_VFPV3_FP16:
954 case ARM::FK_VFPV3_D16:
959 case ARM::FK_VFPV3_D16_FP16:
966 case ARM::FK_VFPV3XD:
970 case ARM::FK_VFPV3XD_FP16:
984 case ARM::FK_FPV4_SP_D16:
985 case ARM::FK_VFPV4_D16:
990 case ARM::FK_FP_ARMV8:
997 case ARM::FK_FPV5_SP_D16:
998 case ARM::FK_FPV5_D16:
1001 case ARM::FK_FP_ARMV8_FULLFP16_SP_D16:
1002 case ARM::FK_FP_ARMV8_FULLFP16_D16:
1015 case ARM::FK_NEON_FP16:
1025 case ARM::FK_NEON_VFPV4:
1033 case ARM::FK_NEON_FP_ARMV8:
1034 case ARM::FK_CRYPTO_NEON_FP_ARMV8:
1041 case ARM::FK_SOFTVFP:
1051void ARMTargetELFStreamer::finishAttributeSection() {
1052 ARMELFStreamer &S = getStreamer();
1054 if (FPU != ARM::FK_INVALID)
1055 emitFPUDefaultAttributes();
1057 if (Arch != ARM::ArchKind::INVALID)
1058 emitArchDefaultAttributes();
1060 if (S.Contents.empty())
1081 S.emitAttributesSection(CurrentVendor,
".ARM.attributes",
1084 FPU = ARM::FK_INVALID;
1087void ARMTargetELFStreamer::emitLabel(
MCSymbol *Symbol) {
1088 ARMELFStreamer &Streamer = getStreamer();
1089 if (!Streamer.IsThumb)
1092 Streamer.getAssembler().registerSymbol(*Symbol);
1095 emitThumbFunc(Symbol);
1098void ARMTargetELFStreamer::annotateTLSDescriptorSequence(
1100 getStreamer().addFixup(Expr,
FK_Data_4);
1103void ARMTargetELFStreamer::emitCode16() { getStreamer().setIsThumb(
true); }
1105void ARMTargetELFStreamer::emitCode32() { getStreamer().setIsThumb(
false); }
1107void ARMTargetELFStreamer::emitThumbFunc(
MCSymbol *Symbol) {
1108 getStreamer().getAssembler().setIsThumbFunc(Symbol);
1115 if (!
Sym.isDefined()) {
1116 getStreamer().emitAssignment(Symbol,
Value);
1121 emitThumbFunc(Symbol);
1122 getStreamer().emitAssignment(Symbol,
Value);
1125void ARMTargetELFStreamer::emitInst(
uint32_t Inst,
char Suffix) {
1126 getStreamer().emitInst(Inst, Suffix);
1129void ARMTargetELFStreamer::reset() { AttributeSection =
nullptr; }
1131void ARMTargetELFStreamer::finish() {
1132 ARMTargetStreamer::finish();
1133 finishAttributeSection();
1141 auto &
Asm = getStreamer().getAssembler();
1148 for (
auto &
F : *Text)
1155void ARMELFStreamer::reset() {
1160 LastMappingSymbols.clear();
1161 LastEMSInfo.reset();
1168inline void ARMELFStreamer::SwitchToEHSection(
StringRef Prefix,
1179 if (FnSecName !=
".text") {
1180 EHSecName += FnSecName;
1188 EHSecName,
Type, Flags, 0, Group,
true,
1192 assert(EHSection &&
"Failed to get the required EH section");
1195 switchSection(EHSection);
1196 emitValueToAlignment(
Align(4), 0, 1, 0);
1199inline void ARMELFStreamer::SwitchToExTabSection(
const MCSymbol &FnStart) {
1204inline void ARMELFStreamer::SwitchToExIdxSection(
const MCSymbol &FnStart) {
1210void ARMELFStreamer::EHReset() {
1213 Personality =
nullptr;
1223 UnwindOpAsm.Reset();
1226void ARMELFStreamer::emitFnStart() {
1227 assert(FnStart ==
nullptr);
1228 FnStart = getContext().createTempSymbol();
1232void ARMELFStreamer::emitFnEnd() {
1233 assert(FnStart &&
".fnstart must precedes .fnend");
1236 if (!ExTab && !CantUnwind)
1237 FlushUnwindOpcodes(
true);
1240 SwitchToExIdxSection(*FnStart);
1253 emitValue(FnStartRef, 4);
1261 emitValue(ExTabEntryRef, 4);
1267 "Compact model must use __aeabi_unwind_cpp_pr0 as personality");
1269 "Unwind opcode size for __aeabi_unwind_cpp_pr0 must be equal to 4");
1274 emitIntValue(Intval, Opcodes.
size());
1284void ARMELFStreamer::emitCantUnwind() { CantUnwind =
true; }
1288 const MCSymbol *PersonalitySym = getContext().getOrCreateSymbol(
Name);
1289 visitUsedSymbol(*PersonalitySym);
1296void ARMELFStreamer::FlushPendingOffset() {
1297 if (PendingOffset != 0) {
1298 UnwindOpAsm.EmitSPOffset(-PendingOffset);
1303void ARMELFStreamer::FlushUnwindOpcodes(
bool NoHandlerData) {
1307 int64_t LastRegSaveSPOffset = SPOffset - PendingOffset;
1308 UnwindOpAsm.EmitSPOffset(LastRegSaveSPOffset - FPOffset);
1309 UnwindOpAsm.EmitSetSP(
MRI->getEncodingValue(
FPReg));
1311 FlushPendingOffset();
1315 UnwindOpAsm.Finalize(PersonalityIndex, Opcodes);
1324 SwitchToExTabSection(*FnStart);
1328 ExTab = getContext().createTempSymbol();
1336 emitValue(PersonalityRef, 4);
1341 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
1342 for (
unsigned I = 0;
I != Opcodes.
size();
I += 4) {
1344 Opcodes[
I + 1] << 8 |
1345 Opcodes[
I + 2] << 16 |
1346 Opcodes[
I + 3] << 24;
1357 if (NoHandlerData && !Personality)
1361void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(
false); }
1363void ARMELFStreamer::emitPersonality(
const MCSymbol *Per) {
1365 UnwindOpAsm.setPersonality(Per);
1368void ARMELFStreamer::emitPersonalityIndex(
unsigned Index) {
1370 PersonalityIndex =
Index;
1375 assert((NewSPReg == ARM::SP || NewSPReg ==
FPReg) &&
1376 "the operand of .setfp directive should be either $sp or $fp");
1381 if (NewSPReg == ARM::SP)
1382 FPOffset = SPOffset +
Offset;
1388 assert((Reg != ARM::SP && Reg != ARM::PC) &&
1389 "the operand of .movsp cannot be either sp or pc");
1390 assert(
FPReg == ARM::SP &&
"current FP must be SP");
1392 FlushPendingOffset();
1395 FPOffset = SPOffset +
Offset;
1398 UnwindOpAsm.EmitSetSP(
MRI->getEncodingValue(
FPReg));
1401void ARMELFStreamer::emitPad(int64_t
Offset) {
1410static std::pair<unsigned, unsigned>
1418 if (Reg == ARM::RA_AUTH_CODE)
1420 unsigned RegEnc =
MRI.getEncodingValue(Reg);
1421 assert(RegEnc < (IsVector ? 32U : 16U) &&
"Register out of range");
1422 unsigned Bit = (1u << RegEnc);
1423 if ((Mask & Bit) == 0) {
1431 return {
Idx, Count};
1437 unsigned Idx, Count;
1454 SPOffset -= Count * (IsVector ? 8 : 4);
1457 FlushPendingOffset();
1459 UnwindOpAsm.EmitVFPRegSave(Mask);
1461 UnwindOpAsm.EmitRegSave(Mask);
1462 }
else if (
Idx > 0 && RegList[
Idx - 1] == ARM::RA_AUTH_CODE) {
1465 FlushPendingOffset();
1466 UnwindOpAsm.EmitRegSave(0);
1471void ARMELFStreamer::emitUnwindRaw(int64_t
Offset,
1473 FlushPendingOffset();
1474 SPOffset = SPOffset -
Offset;
1475 UnwindOpAsm.EmitRaw(Opcodes);
1483 return new ARMTargetAsmStreamer(S,
OS, *InstPrint);
1491 return new ARMTargetELFStreamer(S);
1495 std::unique_ptr<MCAsmBackend> TAB,
1496 std::unique_ptr<MCObjectWriter> OW,
1497 std::unique_ptr<MCCodeEmitter>
Emitter,
1498 bool IsThumb,
bool IsAndroid) {
1500 new ARMELFStreamer(
Context, std::move(TAB), std::move(OW),
1501 std::move(
Emitter), IsThumb, IsAndroid);
unsigned const MachineRegisterInfo * MRI
static void addFixup(SmallVectorImpl< MCFixup > &Fixups, uint32_t Offset, const MCExpr *Value, uint16_t Kind, bool PCRel=false)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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
This file defines the SmallString class.
This file defines the SmallVector class.
static uint32_t getFlags(const Symbol *Sym)
static SymbolRef::Type getType(const Symbol *Sym)
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 emitCode16()
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 emitCode32()
virtual void emitSyntaxUnified()
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.
void printExpr(raw_ostream &, const MCExpr &) const
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
LLVM_ABI MCSymbol * createLocalSymbol(StringRef Name)
Create a local, non-temporary symbol like an ELF mapping symbol.
const MCAsmInfo * getAsmInfo() const
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment &F, uint64_t Offset) override
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.
Base class for the full range of assembler expressions which are needed for parsing.
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.
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.
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.
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, SMLoc Loc=SMLoc())
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.
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.
LLVM_ABI const TagNameMap & getARMAttributeTags()
@ EXIDX_CANTUNWIND
Special entry for the function never unwind.
LLVM_ABI StringRef getArchExtName(uint64_t ArchExtKind)
LLVM_ABI StringRef getCPUAttr(ArchKind AK)
LLVM_ABI StringRef getArchName(ArchKind AK)
LLVM_ABI unsigned getArchAttr(ArchKind AK)
LLVM_ABI 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.
LLVM_ABI 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.
@ FK_Data_4
A four-byte fixup.
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)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
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.