51 "Invalid personality index");
52 return (
Twine(
"__aeabi_unwind_cpp_pr") +
Twine(Index)).str();
64 void emitFnStart()
override;
65 void emitFnEnd()
override;
66 void emitCantUnwind()
override;
67 void emitPersonality(
const MCSymbol *Personality)
override;
68 void emitPersonalityIndex(
unsigned Index)
override;
69 void emitHandlerData()
override;
70 void emitSetFP(
unsigned FpReg,
unsigned SpReg, int64_t
Offset = 0)
override;
71 void emitMovSP(
unsigned Reg, int64_t
Offset = 0)
override;
72 void emitPad(int64_t
Offset)
override;
75 void emitUnwindRaw(int64_t
Offset,
78 void switchVendor(
StringRef Vendor)
override;
81 void emitIntTextAttribute(
unsigned Attribute,
unsigned IntValue,
83 void emitArch(
unsigned Arch)
override;
84 void emitArchExtension(
unsigned ArchExt)
override;
85 void emitObjectArch(
unsigned Arch)
override;
86 void emitFPU(
unsigned FPU)
override;
87 void emitInst(
uint32_t Inst,
char Suffix =
'\0')
override;
88 void finishAttributeSection()
override;
90 void AnnotateTLSDescriptorSequence(
const MCSymbolRefExpr *SRE)
override;
98 ARMTargetAsmStreamer::ARMTargetAsmStreamer(
MCStreamer &S,
103 IsVerboseAsm(VerboseAsm) {}
104 void ARMTargetAsmStreamer::emitFnStart() { OS <<
"\t.fnstart\n"; }
105 void ARMTargetAsmStreamer::emitFnEnd() { OS <<
"\t.fnend\n"; }
106 void ARMTargetAsmStreamer::emitCantUnwind() { OS <<
"\t.cantunwind\n"; }
107 void ARMTargetAsmStreamer::emitPersonality(
const MCSymbol *Personality) {
108 OS <<
"\t.personality " << Personality->
getName() <<
'\n';
110 void ARMTargetAsmStreamer::emitPersonalityIndex(
unsigned Index) {
111 OS <<
"\t.personalityindex " << Index <<
'\n';
113 void ARMTargetAsmStreamer::emitHandlerData() { OS <<
"\t.handlerdata\n"; }
114 void ARMTargetAsmStreamer::emitSetFP(
unsigned FpReg,
unsigned SpReg,
117 InstPrinter.printRegName(OS, FpReg);
119 InstPrinter.printRegName(OS, SpReg);
124 void ARMTargetAsmStreamer::emitMovSP(
unsigned Reg, int64_t Offset) {
126 "the operand of .movsp cannot be either sp or pc");
129 InstPrinter.printRegName(OS, Reg);
134 void ARMTargetAsmStreamer::emitPad(int64_t Offset) {
135 OS <<
"\t.pad\t#" << Offset <<
'\n';
139 assert(RegList.
size() &&
"RegList should not be empty");
145 InstPrinter.printRegName(OS, RegList[0]);
147 for (
unsigned i = 1, e = RegList.
size();
i != e; ++
i) {
149 InstPrinter.printRegName(OS, RegList[
i]);
154 void ARMTargetAsmStreamer::switchVendor(
StringRef Vendor) {
156 void ARMTargetAsmStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
157 OS <<
"\t.eabi_attribute\t" << Attribute <<
", " <<
Twine(Value);
161 OS <<
"\t@ " << Name;
165 void ARMTargetAsmStreamer::emitTextAttribute(
unsigned Attribute,
169 OS <<
"\t.cpu\t" << String.
lower();
172 OS <<
"\t.eabi_attribute\t" << Attribute <<
", \"" << String <<
"\"";
176 OS <<
"\t@ " << Name;
182 void ARMTargetAsmStreamer::emitIntTextAttribute(
unsigned Attribute,
188 OS <<
"\t.eabi_attribute\t" << Attribute <<
", " << IntValue;
189 if (!StringValue.
empty())
190 OS <<
", \"" << StringValue <<
"\"";
197 void ARMTargetAsmStreamer::emitArch(
unsigned Arch) {
200 void ARMTargetAsmStreamer::emitArchExtension(
unsigned ArchExt) {
203 void ARMTargetAsmStreamer::emitObjectArch(
unsigned Arch) {
206 void ARMTargetAsmStreamer::emitFPU(
unsigned FPU) {
209 void ARMTargetAsmStreamer::finishAttributeSection() {
212 ARMTargetAsmStreamer::AnnotateTLSDescriptorSequence(
const MCSymbolRefExpr *S) {
217 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
219 OS <<
"\t.thumb_set\t";
220 Symbol->
print(OS, MAI);
222 Value->
print(OS, MAI);
226 void ARMTargetAsmStreamer::emitInst(
uint32_t Inst,
char Suffix) {
233 void ARMTargetAsmStreamer::emitUnwindRaw(int64_t Offset,
235 OS <<
"\t.unwind_raw " <<
Offset;
248 struct AttributeItem {
253 NumericAndTextAttributes
257 std::string StringValue;
259 static bool LessTag(
const AttributeItem &LHS,
const AttributeItem &RHS) {
279 unsigned EmittedArch;
284 AttributeItem *getAttributeItem(
unsigned Attribute) {
285 for (
size_t i = 0;
i < Contents.size(); ++
i)
286 if (Contents[
i].
Tag == Attribute)
291 void setAttributeItem(
unsigned Attribute,
unsigned Value,
292 bool OverwriteExisting) {
294 if (AttributeItem *Item = getAttributeItem(Attribute)) {
295 if (!OverwriteExisting)
297 Item->Type = AttributeItem::NumericAttribute;
298 Item->IntValue = Value;
303 AttributeItem Item = {
304 AttributeItem::NumericAttribute,
309 Contents.push_back(Item);
312 void setAttributeItem(
unsigned Attribute,
StringRef Value,
313 bool OverwriteExisting) {
315 if (AttributeItem *Item = getAttributeItem(Attribute)) {
316 if (!OverwriteExisting)
318 Item->Type = AttributeItem::TextAttribute;
319 Item->StringValue = Value;
324 AttributeItem Item = {
325 AttributeItem::TextAttribute,
330 Contents.push_back(Item);
333 void setAttributeItems(
unsigned Attribute,
unsigned IntValue,
334 StringRef StringValue,
bool OverwriteExisting) {
336 if (AttributeItem *Item = getAttributeItem(Attribute)) {
337 if (!OverwriteExisting)
339 Item->Type = AttributeItem::NumericAndTextAttributes;
340 Item->IntValue = IntValue;
341 Item->StringValue = StringValue;
346 AttributeItem Item = {
347 AttributeItem::NumericAndTextAttributes,
352 Contents.push_back(Item);
355 void emitArchDefaultAttributes();
356 void emitFPUDefaultAttributes();
366 void emitSetFP(
unsigned FpReg,
unsigned SpReg, int64_t Offset = 0)
override;
367 void emitMovSP(
unsigned Reg, int64_t Offset = 0)
override;
368 void emitPad(int64_t Offset)
override;
370 bool isVector)
override;
375 void emitAttribute(
unsigned Attribute,
unsigned Value)
override;
379 void emitArch(
unsigned Arch)
override;
381 void emitFPU(
unsigned FPU)
override;
389 size_t calculateContentSize()
const;
392 void reset()
override;
397 Arch(
ARM::AK_INVALID), EmittedArch(
ARM::AK_INVALID),
398 AttributeSection(nullptr) {}
415 friend class ARMTargetELFStreamer;
419 :
MCELFStreamer(Context, TAB, OS, Emitter), IsThumb(IsThumb),
420 MappingSymbolCounter(0), LastEMS(EMS_None) {
431 void emitCantUnwind();
432 void emitPersonality(
const MCSymbol *Per);
433 void emitPersonalityIndex(
unsigned index);
434 void emitHandlerData();
435 void emitSetFP(
unsigned NewFpReg,
unsigned NewSpReg, int64_t Offset = 0);
436 void emitMovSP(
unsigned Reg, int64_t Offset = 0);
437 void emitPad(int64_t Offset);
446 LastEMS = LastMappingSymbols.lookup(Section);
457 EmitThumbMappingSymbol();
459 EmitARMMappingSymbol();
464 void emitInst(
uint32_t Inst,
char Suffix) {
474 EmitARMMappingSymbol();
475 for (
unsigned II = 0,
IE = Size; II !=
IE; II++) {
476 const unsigned I = LittleEndian ? (Size - II - 1) : II;
477 Buffer[Size - II - 1] = uint8_t(Inst >> I * CHAR_BIT);
483 Size = (Suffix ==
'n' ? 2 : 4);
486 EmitThumbMappingSymbol();
487 for (
unsigned II = 0,
IE = Size; II !=
IE; II = II + 2) {
488 const unsigned I0 = LittleEndian ? II + 0 : (Size - II - 1);
489 const unsigned I1 = LittleEndian ? II + 1 : (Size - II - 2);
490 Buffer[Size - II - 2] = uint8_t(Inst >> I0 * CHAR_BIT);
491 Buffer[Size - II - 1] = uint8_t(Inst >> I1 * CHAR_BIT);
506 EmitDataMappingSymbol();
514 if (
const MCSymbolRefExpr *SRE = dyn_cast_or_null<MCSymbolRefExpr>(Value))
515 if (SRE->getKind() == MCSymbolRefExpr::VK_ARM_SBREL && !(Size == 4)) {
520 EmitDataMappingSymbol();
544 enum ElfMappingSymbol {
551 void EmitDataMappingSymbol() {
552 if (LastEMS == EMS_Data)
return;
553 EmitMappingSymbol(
"$d");
557 void EmitThumbMappingSymbol() {
558 if (LastEMS == EMS_Thumb)
return;
559 EmitMappingSymbol(
"$t");
563 void EmitARMMappingSymbol() {
564 if (LastEMS == EMS_ARM)
return;
565 EmitMappingSymbol(
"$a");
571 Name +
"." +
Twine(MappingSymbolCounter++)));
588 void reset()
override;
590 void EmitPersonalityFixup(
StringRef Name);
591 void FlushPendingOffset();
592 void FlushUnwindOpcodes(
bool NoHandlerData);
596 void SwitchToExTabSection(
const MCSymbol &FnStart);
597 void SwitchToExIdxSection(
const MCSymbol &FnStart);
602 int64_t MappingSymbolCounter;
605 ElfMappingSymbol LastEMS;
611 unsigned PersonalityIndex;
615 int64_t PendingOffset;
623 ARMELFStreamer &ARMTargetELFStreamer::getStreamer() {
624 return static_cast<ARMELFStreamer &
>(Streamer);
627 void ARMTargetELFStreamer::emitFnStart() { getStreamer().emitFnStart(); }
628 void ARMTargetELFStreamer::emitFnEnd() { getStreamer().emitFnEnd(); }
629 void ARMTargetELFStreamer::emitCantUnwind() { getStreamer().emitCantUnwind(); }
630 void ARMTargetELFStreamer::emitPersonality(
const MCSymbol *Personality) {
631 getStreamer().emitPersonality(Personality);
633 void ARMTargetELFStreamer::emitPersonalityIndex(
unsigned Index) {
634 getStreamer().emitPersonalityIndex(Index);
636 void ARMTargetELFStreamer::emitHandlerData() {
637 getStreamer().emitHandlerData();
639 void ARMTargetELFStreamer::emitSetFP(
unsigned FpReg,
unsigned SpReg,
641 getStreamer().emitSetFP(FpReg, SpReg, Offset);
643 void ARMTargetELFStreamer::emitMovSP(
unsigned Reg, int64_t Offset) {
644 getStreamer().emitMovSP(Reg, Offset);
646 void ARMTargetELFStreamer::emitPad(int64_t Offset) {
647 getStreamer().emitPad(Offset);
651 getStreamer().emitRegSave(RegList, isVector);
653 void ARMTargetELFStreamer::emitUnwindRaw(int64_t Offset,
655 getStreamer().emitUnwindRaw(Offset, Opcodes);
657 void ARMTargetELFStreamer::switchVendor(
StringRef Vendor) {
658 assert(!Vendor.
empty() &&
"Vendor cannot be empty.");
660 if (CurrentVendor == Vendor)
663 if (!CurrentVendor.empty())
664 finishAttributeSection();
666 assert(Contents.empty() &&
667 ".ARM.attributes should be flushed before changing vendor");
668 CurrentVendor = Vendor;
671 void ARMTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
672 setAttributeItem(Attribute, Value,
true);
674 void ARMTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
676 setAttributeItem(Attribute, Value,
true);
678 void ARMTargetELFStreamer::emitIntTextAttribute(
unsigned Attribute,
681 setAttributeItems(Attribute, IntValue, StringValue,
684 void ARMTargetELFStreamer::emitArch(
unsigned Value) {
687 void ARMTargetELFStreamer::emitObjectArch(
unsigned Value) {
690 void ARMTargetELFStreamer::emitArchDefaultAttributes() {
691 using namespace ARMBuildAttrs;
697 if (EmittedArch == ARM::AK_INVALID)
717 case ARM::AK_ARMV5TE:
723 case ARM::AK_ARMV6T2:
729 case ARM::AK_ARMV6KZ:
757 case ARM::AK_ARMV8_1A:
758 case ARM::AK_ARMV8_2A:
766 case ARM::AK_ARMV8MBaseline:
767 case ARM::AK_ARMV8MMainline:
778 case ARM::AK_IWMMXT2:
789 void ARMTargetELFStreamer::emitFPU(
unsigned Value) {
792 void ARMTargetELFStreamer::emitFPUDefaultAttributes() {
807 case ARM::FK_VFPV3_FP16:
816 case ARM::FK_VFPV3_D16:
822 case ARM::FK_VFPV3_D16_FP16:
831 case ARM::FK_VFPV3XD:
836 case ARM::FK_VFPV3XD_FP16:
853 case ARM::FK_FPV4_SP_D16:
854 case ARM::FK_VFPV4_D16:
860 case ARM::FK_FP_ARMV8:
868 case ARM::FK_FPV5_SP_D16:
869 case ARM::FK_FPV5_D16:
884 case ARM::FK_NEON_FP16:
896 case ARM::FK_NEON_VFPV4:
905 case ARM::FK_NEON_FP_ARMV8:
906 case ARM::FK_CRYPTO_NEON_FP_ARMV8:
914 case ARM::FK_SOFTVFP:
923 size_t ARMTargetELFStreamer::calculateContentSize()
const {
925 for (
size_t i = 0;
i < Contents.size(); ++
i) {
926 AttributeItem item = Contents[
i];
928 case AttributeItem::HiddenAttribute:
930 case AttributeItem::NumericAttribute:
934 case AttributeItem::TextAttribute:
936 Result += item.StringValue.size() + 1;
938 case AttributeItem::NumericAndTextAttributes:
941 Result += item.StringValue.size() + 1;
947 void ARMTargetELFStreamer::finishAttributeSection() {
956 if (FPU != ARM::FK_INVALID)
957 emitFPUDefaultAttributes();
959 if (Arch != ARM::AK_INVALID)
960 emitArchDefaultAttributes();
962 if (Contents.empty())
965 std::sort(Contents.begin(), Contents.end(), AttributeItem::LessTag);
967 ARMELFStreamer &Streamer = getStreamer();
970 if (AttributeSection) {
971 Streamer.SwitchSection(AttributeSection);
973 AttributeSection = Streamer.getContext().getELFSection(
975 Streamer.SwitchSection(AttributeSection);
978 Streamer.EmitIntValue(0x41, 1);
982 const size_t VendorHeaderSize = 4 + CurrentVendor.size() + 1;
985 const size_t TagHeaderSize = 1 + 4;
987 const size_t ContentsSize = calculateContentSize();
989 Streamer.EmitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4);
990 Streamer.EmitBytes(CurrentVendor);
991 Streamer.EmitIntValue(0, 1);
994 Streamer.EmitIntValue(TagHeaderSize + ContentsSize, 4);
998 for (
size_t i = 0;
i < Contents.size(); ++
i) {
999 AttributeItem item = Contents[
i];
1000 Streamer.EmitULEB128IntValue(item.Tag);
1001 switch (item.Type) {
1003 case AttributeItem::NumericAttribute:
1004 Streamer.EmitULEB128IntValue(item.IntValue);
1006 case AttributeItem::TextAttribute:
1007 Streamer.EmitBytes(item.StringValue);
1008 Streamer.EmitIntValue(0, 1);
1010 case AttributeItem::NumericAndTextAttributes:
1011 Streamer.EmitULEB128IntValue(item.IntValue);
1012 Streamer.EmitBytes(item.StringValue);
1013 Streamer.EmitIntValue(0, 1);
1019 FPU = ARM::FK_INVALID;
1022 void ARMTargetELFStreamer::emitLabel(
MCSymbol *Symbol) {
1023 ARMELFStreamer &Streamer = getStreamer();
1024 if (!Streamer.IsThumb)
1027 Streamer.getAssembler().registerSymbol(*Symbol);
1030 Streamer.EmitThumbFunc(Symbol);
1034 ARMTargetELFStreamer::AnnotateTLSDescriptorSequence(
const MCSymbolRefExpr *S) {
1038 void ARMTargetELFStreamer::emitThumbSet(
MCSymbol *Symbol,
const MCExpr *Value) {
1040 const MCSymbol &Sym = SRE->getSymbol();
1042 getStreamer().EmitAssignment(Symbol, Value);
1047 getStreamer().EmitThumbFunc(Symbol);
1048 getStreamer().EmitAssignment(Symbol, Value);
1051 void ARMTargetELFStreamer::emitInst(
uint32_t Inst,
char Suffix) {
1052 getStreamer().emitInst(Inst, Suffix);
1055 void ARMTargetELFStreamer::reset() { AttributeSection =
nullptr; }
1057 void ARMELFStreamer::FinishImpl() {
1062 MCELFStreamer::FinishImpl();
1065 void ARMELFStreamer::reset() {
1069 MappingSymbolCounter = 0;
1070 MCELFStreamer::reset();
1088 if (FnSecName !=
".text") {
1089 EHSecName += FnSecName;
1097 getContext().getELFSection(EHSecName, Type, Flags, 0, Group,
1100 assert(EHSection &&
"Failed to get the required EH section");
1103 SwitchSection(EHSection);
1104 EmitCodeAlignment(4);
1107 inline void ARMELFStreamer::SwitchToExTabSection(
const MCSymbol &FnStart) {
1109 SectionKind::getData(), FnStart);
1112 inline void ARMELFStreamer::SwitchToExIdxSection(
const MCSymbol &FnStart) {
1115 SectionKind::getData(), FnStart);
1123 void ARMELFStreamer::EHReset() {
1126 Personality =
nullptr;
1136 UnwindOpAsm.Reset();
1139 void ARMELFStreamer::emitFnStart() {
1140 assert(FnStart ==
nullptr);
1141 FnStart = getContext().createTempSymbol();
1145 void ARMELFStreamer::emitFnEnd() {
1146 assert(FnStart &&
".fnstart must precedes .fnend");
1149 if (!ExTab && !CantUnwind)
1150 FlushUnwindOpcodes(
true);
1153 SwitchToExIdxSection(*FnStart);
1159 MCSymbolRefExpr::create(FnStart,
1160 MCSymbolRefExpr::VK_ARM_PREL31,
1163 EmitValue(FnStartRef, 4);
1170 MCSymbolRefExpr::create(ExTab,
1171 MCSymbolRefExpr::VK_ARM_PREL31,
1173 EmitValue(ExTabEntryRef, 4);
1179 "Compact model must use __aeabi_unwind_cpp_pr0 as personality");
1181 "Unwind opcode size for __aeabi_unwind_cpp_pr0 must be equal to 4");
1182 uint64_t Intval = Opcodes[0] |
1186 EmitIntValue(Intval, Opcodes.
size());
1196 void ARMELFStreamer::emitCantUnwind() { CantUnwind =
true; }
1199 void ARMELFStreamer::EmitPersonalityFixup(
StringRef Name) {
1200 const MCSymbol *PersonalitySym = getContext().getOrCreateSymbol(Name);
1203 PersonalitySym, MCSymbolRefExpr::VK_ARM_NONE, getContext());
1205 visitUsedExpr(*PersonalityRef);
1209 MCFixup::getKindForSize(4,
false)));
1212 void ARMELFStreamer::FlushPendingOffset() {
1213 if (PendingOffset != 0) {
1214 UnwindOpAsm.EmitSPOffset(-PendingOffset);
1219 void ARMELFStreamer::FlushUnwindOpcodes(
bool NoHandlerData) {
1223 int64_t LastRegSaveSPOffset = SPOffset - PendingOffset;
1224 UnwindOpAsm.EmitSPOffset(LastRegSaveSPOffset - FPOffset);
1227 FlushPendingOffset();
1231 UnwindOpAsm.Finalize(PersonalityIndex, Opcodes);
1240 SwitchToExTabSection(*FnStart);
1244 ExTab = getContext().createTempSymbol();
1250 MCSymbolRefExpr::create(Personality,
1251 MCSymbolRefExpr::VK_ARM_PREL31,
1254 EmitValue(PersonalityRef, 4);
1259 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
1260 for (
unsigned I = 0;
I != Opcodes.
size();
I += 4) {
1261 uint64_t Intval = Opcodes[
I] |
1262 Opcodes[
I + 1] << 8 |
1263 Opcodes[
I + 2] << 16 |
1264 Opcodes[
I + 3] << 24;
1265 EmitIntValue(Intval, 4);
1275 if (NoHandlerData && !Personality)
1279 void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(
false); }
1281 void ARMELFStreamer::emitPersonality(
const MCSymbol *Per) {
1283 UnwindOpAsm.setPersonality(Per);
1286 void ARMELFStreamer::emitPersonalityIndex(
unsigned Index) {
1288 PersonalityIndex = Index;
1291 void ARMELFStreamer::emitSetFP(
unsigned NewFPReg,
unsigned NewSPReg,
1293 assert((NewSPReg == ARM::SP || NewSPReg == FPReg) &&
1294 "the operand of .setfp directive should be either $sp or $fp");
1299 if (NewSPReg == ARM::SP)
1300 FPOffset = SPOffset +
Offset;
1305 void ARMELFStreamer::emitMovSP(
unsigned Reg, int64_t Offset) {
1307 "the operand of .movsp cannot be either sp or pc");
1308 assert(FPReg == ARM::SP &&
"current FP must be SP");
1310 FlushPendingOffset();
1313 FPOffset = SPOffset +
Offset;
1319 void ARMELFStreamer::emitPad(int64_t Offset) {
1334 for (
size_t i = 0;
i < RegList.
size(); ++
i) {
1336 assert(Reg < (IsVector ? 32U : 16U) &&
"Register out of range");
1337 unsigned Bit = (1u <<
Reg);
1338 if ((Mask & Bit) == 0) {
1348 SPOffset -= Count * (IsVector ? 8 : 4);
1351 FlushPendingOffset();
1353 UnwindOpAsm.EmitVFPRegSave(Mask);
1355 UnwindOpAsm.EmitRegSave(Mask);
1358 void ARMELFStreamer::emitUnwindRaw(int64_t Offset,
1360 FlushPendingOffset();
1361 SPOffset = SPOffset -
Offset;
1362 UnwindOpAsm.EmitRaw(Opcodes);
1370 bool isVerboseAsm) {
1371 return new ARMTargetAsmStreamer(S, OS, *InstPrint, isVerboseAsm);
1382 return new ARMTargetELFStreamer(S);
1390 ARMELFStreamer *S =
new ARMELFStreamer(Context, TAB, OS, Emitter, IsThumb);
1397 S->getAssembler().setRelaxAll(
true);
void setIsThumbFunc(const MCSymbol *Func)
Flag a function symbol as the target of a .thumb_func directive.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
virtual void emitInst(uint32_t Inst, char Suffix= '\0')
MCELFStreamer * createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll, bool IsThumb)
virtual void AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE)
virtual void emitFPU(unsigned FPU)
MCSectionSubPair getPreviousSection() const
Return the previous section that the streamer is emitting code to.
const MCAsmInfo * getAsmInfo() const
StringRef getSectionName() const
void EmitBytes(StringRef Data) override
Emit the bytes in Data into the output.
const MCSymbol & getSymbol() const
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void reset() override
state management
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Target specific streamer interface.
virtual void emitPad(int64_t Offset)
unsigned getUniqueID() const
virtual void finishAttributeSection()
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
StringRef getArchExtName(unsigned ArchExtKind)
virtual void emitPersonality(const MCSymbol *Personality)
StringRef getFPUName(unsigned FPUKind)
unsigned getArchAttr(unsigned ArchKind)
virtual void reset()
Reset any state between object emissions, i.e.
virtual void emitPersonalityIndex(unsigned Index)
StringRef getArchName(unsigned ArchKind)
struct fuzzer::@269 Flags
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Base class for the full range of assembler expressions which are needed for parsing.
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
Reg
All possible values of the reg field in the ModR/M byte.
void EmitLabel(MCSymbol *Symbol) override
Emit a label for Symbol into the current section.
Represent a reference to a symbol from inside an expression.
virtual void emitLabel(MCSymbol *Symbol)
MCContext & getContext() const
bool isLittleEndian() const
True if the target is little endian.
Context object for machine code objects.
void EmitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
.code16 (X86) / .code 16 (ARM)
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.
const MCSymbolELF * getGroup() const
virtual void emitMovSP(unsigned Reg, int64_t Offset=0)
void setExternal(bool Value) const
virtual void emitCantUnwind()
SmallVectorImpl< char > & getContents()
MCTargetStreamer * createARMTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Instances of this class represent a single low-level machine instruction.
virtual void emitAttribute(unsigned Attribute, unsigned Value)
Flag
These should be considered private to the implementation of the MCInstrDesc class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
StringRef AttrTypeAsString(unsigned Attr, bool HasTagPrefix=true)
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
MCTargetStreamer * createARMObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Streaming machine code generation interface.
virtual void emitRegSave(const SmallVectorImpl< unsigned > &RegList, bool isVector)
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
virtual void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value)
MCAssembler & getAssembler()
virtual void emitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset=0)
MCCodeEmitter - Generic instruction encoding interface.
virtual void emitObjectArch(unsigned Arch)
MCFixupKind
Extensible enumeration to represent the type of a fixup.
SmallVectorImpl< MCFixup > & getFixups()
virtual void emitUnwindRaw(int64_t StackOffset, const SmallVectorImpl< uint8_t > &Opcodes)
Special entry for the function never unwind.
void reportError(SMLoc L, const Twine &Msg)
.subsections_via_symbols (MachO)
SectionKind - This is a simple POD value that classifies the properties of a section.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
virtual void emitFnStart()
MCStreamer & getStreamer()
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
bool isDefined(bool SetUsed=true) const
isDefined - Check if this symbol is defined (i.e., it has an address).
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
MCSection & getSection(bool SetUsed=true) const
Get the section associated with a defined, non-absolute symbol.
.code32 (X86) / .code 32 (ARM)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
StringRef getCPUAttr(unsigned ArchKind)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
StringRef getName() const
getName - Get the symbol name.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
.type _foo, STT_FUNC # aka
virtual void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue="")
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
MCSubtargetInfo - Generic base class for all target subtargets.
This represents a section on linux, lots of unix variants and some bare metal systems.
const Triple & getTargetTriple() const
getTargetTriple - Return the target triple string.
static std::string utohexstr(uint64_t X, bool LowerCase=false)
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
An abstract base class for streams implementations that also support a pwrite operation.
Fragment for data and encoded instructions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCTargetStreamer * createARMNullTargetStreamer(MCStreamer &S)
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
virtual void emitHandlerData()
LLVM Value Representation.
Generic interface to target specific assembler backends.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
void EmitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
StringRef - Represent a constant reference to a string, i.e.
virtual void emitArch(unsigned Arch)
static std::string GetAEABIUnwindPersonalityName(unsigned Index)
Represents a location in source code.
void FinishImpl() override
Streamer specific finalization.
LLVM_NODISCARD std::string lower() const
virtual void switchVendor(StringRef Vendor)
virtual void emitTextAttribute(unsigned Attribute, StringRef String)