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;
74 bool isVector)
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);
121 OS <<
", #" << Offset;
124 void ARMTargetAsmStreamer::emitMovSP(
unsigned Reg, int64_t Offset) {
125 assert((Reg != ARM::SP && Reg != ARM::PC) &&
126 "the operand of .movsp cannot be either sp or pc");
129 InstPrinter.printRegName(OS, Reg);
131 OS <<
", #" << Offset;
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) {
198 OS <<
"\t.arch\t" << ARMTargetParser::getArchName(Arch) <<
"\n";
200 void ARMTargetAsmStreamer::emitArchExtension(
unsigned ArchExt) {
201 OS <<
"\t.arch_extension\t" << ARMTargetParser::getArchExtName(ArchExt) <<
"\n";
203 void ARMTargetAsmStreamer::emitObjectArch(
unsigned Arch) {
204 OS <<
"\t.object_arch\t" << ARMTargetParser::getArchName(Arch) <<
'\n';
206 void ARMTargetAsmStreamer::emitFPU(
unsigned FPU) {
207 OS <<
"\t.fpu\t" << ARMTargetParser::getFPUName(FPU) <<
"\n";
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
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;
382 void emitInst(uint32_t Inst,
char Suffix =
'\0')
override;
389 size_t calculateContentSize()
const;
395 AttributeSection(nullptr) {}
412 friend class ARMTargetELFStreamer;
416 :
MCELFStreamer(Context, TAB, OS, Emitter), IsThumb(IsThumb),
417 MappingSymbolCounter(0), LastEMS(EMS_None) {
428 void emitCantUnwind();
429 void emitPersonality(
const MCSymbol *Per);
430 void emitPersonalityIndex(
unsigned index);
431 void emitHandlerData();
432 void emitSetFP(
unsigned NewFpReg,
unsigned NewSpReg, int64_t Offset = 0);
433 void emitMovSP(
unsigned Reg, int64_t Offset = 0);
434 void emitPad(int64_t Offset);
443 LastEMS = LastMappingSymbols.lookup(Section);
454 EmitThumbMappingSymbol();
456 EmitARMMappingSymbol();
461 void emitInst(uint32_t Inst,
char Suffix) {
471 EmitARMMappingSymbol();
472 for (
unsigned II = 0,
IE = Size; II !=
IE; II++) {
473 const unsigned I = LittleEndian ? (Size - II - 1) : II;
474 Buffer[Size - II - 1] = uint8_t(Inst >> I * CHAR_BIT);
480 Size = (Suffix ==
'n' ? 2 : 4);
483 EmitThumbMappingSymbol();
484 for (
unsigned II = 0,
IE = Size; II !=
IE; II = II + 2) {
485 const unsigned I0 = LittleEndian ? II + 0 : (Size - II - 1);
486 const unsigned I1 = LittleEndian ? II + 1 : (Size - II - 2);
487 Buffer[Size - II - 2] = uint8_t(Inst >> I0 * CHAR_BIT);
488 Buffer[Size - II - 1] = uint8_t(Inst >> I1 * CHAR_BIT);
503 EmitDataMappingSymbol();
511 const SMLoc &Loc)
override {
512 if (
const MCSymbolRefExpr *SRE = dyn_cast_or_null<MCSymbolRefExpr>(Value))
513 if (SRE->getKind() == MCSymbolRefExpr::VK_ARM_SBREL && !(Size == 4))
516 EmitDataMappingSymbol();
540 enum ElfMappingSymbol {
547 void EmitDataMappingSymbol() {
548 if (LastEMS == EMS_Data)
return;
549 EmitMappingSymbol(
"$d");
553 void EmitThumbMappingSymbol() {
554 if (LastEMS == EMS_Thumb)
return;
555 EmitMappingSymbol(
"$t");
559 void EmitARMMappingSymbol() {
560 if (LastEMS == EMS_ARM)
return;
561 EmitMappingSymbol(
"$a");
567 Name +
"." +
Twine(MappingSymbolCounter++)));
583 void EmitPersonalityFixup(
StringRef Name);
584 void FlushPendingOffset();
585 void FlushUnwindOpcodes(
bool NoHandlerData);
587 void SwitchToEHSection(
const char *
Prefix,
unsigned Type,
unsigned Flags,
589 void SwitchToExTabSection(
const MCSymbol &FnStart);
590 void SwitchToExIdxSection(
const MCSymbol &FnStart);
595 int64_t MappingSymbolCounter;
598 ElfMappingSymbol LastEMS;
604 unsigned PersonalityIndex;
608 int64_t PendingOffset;
616 ARMELFStreamer &ARMTargetELFStreamer::getStreamer() {
617 return static_cast<ARMELFStreamer &
>(Streamer);
620 void ARMTargetELFStreamer::emitFnStart() { getStreamer().emitFnStart(); }
621 void ARMTargetELFStreamer::emitFnEnd() { getStreamer().emitFnEnd(); }
622 void ARMTargetELFStreamer::emitCantUnwind() { getStreamer().emitCantUnwind(); }
623 void ARMTargetELFStreamer::emitPersonality(
const MCSymbol *Personality) {
624 getStreamer().emitPersonality(Personality);
626 void ARMTargetELFStreamer::emitPersonalityIndex(
unsigned Index) {
627 getStreamer().emitPersonalityIndex(Index);
629 void ARMTargetELFStreamer::emitHandlerData() {
630 getStreamer().emitHandlerData();
632 void ARMTargetELFStreamer::emitSetFP(
unsigned FpReg,
unsigned SpReg,
634 getStreamer().emitSetFP(FpReg, SpReg, Offset);
636 void ARMTargetELFStreamer::emitMovSP(
unsigned Reg, int64_t Offset) {
637 getStreamer().emitMovSP(Reg, Offset);
639 void ARMTargetELFStreamer::emitPad(int64_t Offset) {
640 getStreamer().emitPad(Offset);
644 getStreamer().emitRegSave(RegList, isVector);
646 void ARMTargetELFStreamer::emitUnwindRaw(int64_t Offset,
648 getStreamer().emitUnwindRaw(Offset, Opcodes);
650 void ARMTargetELFStreamer::switchVendor(
StringRef Vendor) {
651 assert(!Vendor.
empty() &&
"Vendor cannot be empty.");
653 if (CurrentVendor == Vendor)
656 if (!CurrentVendor.empty())
657 finishAttributeSection();
659 assert(Contents.empty() &&
660 ".ARM.attributes should be flushed before changing vendor");
661 CurrentVendor = Vendor;
664 void ARMTargetELFStreamer::emitAttribute(
unsigned Attribute,
unsigned Value) {
665 setAttributeItem(Attribute, Value,
true);
667 void ARMTargetELFStreamer::emitTextAttribute(
unsigned Attribute,
669 setAttributeItem(Attribute, Value,
true);
671 void ARMTargetELFStreamer::emitIntTextAttribute(
unsigned Attribute,
674 setAttributeItems(Attribute, IntValue, StringValue,
677 void ARMTargetELFStreamer::emitArch(
unsigned Value) {
680 void ARMTargetELFStreamer::emitObjectArch(
unsigned Value) {
683 void ARMTargetELFStreamer::emitArchDefaultAttributes() {
684 using namespace ARMBuildAttrs;
687 ARMTargetParser::getCPUAttr(Arch),
692 ARMTargetParser::getArchAttr(Arch),
696 ARMTargetParser::getArchAttr(EmittedArch),
782 void ARMTargetELFStreamer::emitFPU(
unsigned Value) {
785 void ARMTargetELFStreamer::emitFPUDefaultAttributes() {
916 size_t ARMTargetELFStreamer::calculateContentSize()
const {
918 for (
size_t i = 0; i < Contents.size(); ++i) {
919 AttributeItem item = Contents[i];
921 case AttributeItem::HiddenAttribute:
923 case AttributeItem::NumericAttribute:
927 case AttributeItem::TextAttribute:
929 Result += item.StringValue.size() + 1;
931 case AttributeItem::NumericAndTextAttributes:
934 Result += item.StringValue.size() + 1;
940 void ARMTargetELFStreamer::finishAttributeSection() {
950 emitFPUDefaultAttributes();
953 emitArchDefaultAttributes();
955 if (Contents.empty())
958 std::sort(Contents.begin(), Contents.end(), AttributeItem::LessTag);
960 ARMELFStreamer &Streamer = getStreamer();
963 if (AttributeSection) {
964 Streamer.SwitchSection(AttributeSection);
966 AttributeSection = Streamer.getContext().getELFSection(
968 Streamer.SwitchSection(AttributeSection);
971 Streamer.EmitIntValue(0x41, 1);
975 const size_t VendorHeaderSize = 4 + CurrentVendor.size() + 1;
978 const size_t TagHeaderSize = 1 + 4;
980 const size_t ContentsSize = calculateContentSize();
982 Streamer.EmitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4);
983 Streamer.EmitBytes(CurrentVendor);
984 Streamer.EmitIntValue(0, 1);
987 Streamer.EmitIntValue(TagHeaderSize + ContentsSize, 4);
991 for (
size_t i = 0; i < Contents.size(); ++i) {
992 AttributeItem item = Contents[i];
993 Streamer.EmitULEB128IntValue(item.Tag);
996 case AttributeItem::NumericAttribute:
997 Streamer.EmitULEB128IntValue(item.IntValue);
999 case AttributeItem::TextAttribute:
1000 Streamer.EmitBytes(item.StringValue);
1001 Streamer.EmitIntValue(0, 1);
1003 case AttributeItem::NumericAndTextAttributes:
1004 Streamer.EmitULEB128IntValue(item.IntValue);
1005 Streamer.EmitBytes(item.StringValue);
1006 Streamer.EmitIntValue(0, 1);
1015 void ARMTargetELFStreamer::emitLabel(
MCSymbol *Symbol) {
1016 ARMELFStreamer &Streamer = getStreamer();
1017 if (!Streamer.IsThumb)
1020 Streamer.getAssembler().registerSymbol(*Symbol);
1023 Streamer.EmitThumbFunc(Symbol);
1027 ARMTargetELFStreamer::AnnotateTLSDescriptorSequence(
const MCSymbolRefExpr *S) {
1031 void ARMTargetELFStreamer::emitThumbSet(
MCSymbol *Symbol,
const MCExpr *Value) {
1033 const MCSymbol &Sym = SRE->getSymbol();
1035 getStreamer().EmitAssignment(Symbol, Value);
1040 getStreamer().EmitThumbFunc(Symbol);
1041 getStreamer().EmitAssignment(Symbol, Value);
1044 void ARMTargetELFStreamer::emitInst(uint32_t Inst,
char Suffix) {
1045 getStreamer().emitInst(Inst, Suffix);
1048 void ARMELFStreamer::FinishImpl() {
1053 MCELFStreamer::FinishImpl();
1056 inline void ARMELFStreamer::SwitchToEHSection(
const char *
Prefix,
1067 if (FnSecName !=
".text") {
1068 EHSecName += FnSecName;
1076 getContext().getELFSection(EHSecName, Type, Flags, 0, Group,
1079 assert(EHSection &&
"Failed to get the required EH section");
1082 SwitchSection(EHSection);
1083 EmitCodeAlignment(4);
1086 inline void ARMELFStreamer::SwitchToExTabSection(
const MCSymbol &FnStart) {
1087 SwitchToEHSection(
".ARM.extab",
1090 SectionKind::getDataRel(),
1094 inline void ARMELFStreamer::SwitchToExIdxSection(
const MCSymbol &FnStart) {
1095 SwitchToEHSection(
".ARM.exidx",
1098 SectionKind::getDataRel(),
1107 void ARMELFStreamer::Reset() {
1110 Personality =
nullptr;
1120 UnwindOpAsm.Reset();
1123 void ARMELFStreamer::emitFnStart() {
1124 assert(FnStart ==
nullptr);
1125 FnStart = getContext().createTempSymbol();
1129 void ARMELFStreamer::emitFnEnd() {
1130 assert(FnStart &&
".fnstart must precedes .fnend");
1133 if (!ExTab && !CantUnwind)
1134 FlushUnwindOpcodes(
true);
1137 SwitchToExIdxSection(*FnStart);
1143 MCSymbolRefExpr::create(FnStart,
1144 MCSymbolRefExpr::VK_ARM_PREL31,
1147 EmitValue(FnStartRef, 4);
1154 MCSymbolRefExpr::create(ExTab,
1155 MCSymbolRefExpr::VK_ARM_PREL31,
1157 EmitValue(ExTabEntryRef, 4);
1163 "Compact model must use __aeabi_unwind_cpp_pr0 as personality");
1164 assert(Opcodes.
size() == 4u &&
1165 "Unwind opcode size for __aeabi_unwind_cpp_pr0 must be equal to 4");
1166 uint64_t Intval = Opcodes[0] |
1170 EmitIntValue(Intval, Opcodes.
size());
1180 void ARMELFStreamer::emitCantUnwind() { CantUnwind =
true; }
1183 void ARMELFStreamer::EmitPersonalityFixup(
StringRef Name) {
1184 const MCSymbol *PersonalitySym = getContext().getOrCreateSymbol(Name);
1187 PersonalitySym, MCSymbolRefExpr::VK_ARM_NONE, getContext());
1189 visitUsedExpr(*PersonalityRef);
1193 MCFixup::getKindForSize(4,
false)));
1196 void ARMELFStreamer::FlushPendingOffset() {
1197 if (PendingOffset != 0) {
1198 UnwindOpAsm.EmitSPOffset(-PendingOffset);
1203 void ARMELFStreamer::FlushUnwindOpcodes(
bool NoHandlerData) {
1207 int64_t LastRegSaveSPOffset = SPOffset - PendingOffset;
1208 UnwindOpAsm.EmitSPOffset(LastRegSaveSPOffset - FPOffset);
1211 FlushPendingOffset();
1215 UnwindOpAsm.Finalize(PersonalityIndex, Opcodes);
1224 SwitchToExTabSection(*FnStart);
1228 ExTab = getContext().createTempSymbol();
1234 MCSymbolRefExpr::create(Personality,
1235 MCSymbolRefExpr::VK_ARM_PREL31,
1238 EmitValue(PersonalityRef, 4);
1242 assert((Opcodes.
size() % 4) == 0 &&
1243 "Unwind opcode size for __aeabi_cpp_unwind_pr0 must be multiple of 4");
1244 for (
unsigned I = 0;
I != Opcodes.
size();
I += 4) {
1245 uint64_t Intval = Opcodes[
I] |
1246 Opcodes[
I + 1] << 8 |
1247 Opcodes[
I + 2] << 16 |
1248 Opcodes[
I + 3] << 24;
1249 EmitIntValue(Intval, 4);
1259 if (NoHandlerData && !Personality)
1263 void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(
false); }
1265 void ARMELFStreamer::emitPersonality(
const MCSymbol *Per) {
1267 UnwindOpAsm.setPersonality(Per);
1270 void ARMELFStreamer::emitPersonalityIndex(
unsigned Index) {
1272 PersonalityIndex = Index;
1275 void ARMELFStreamer::emitSetFP(
unsigned NewFPReg,
unsigned NewSPReg,
1277 assert((NewSPReg == ARM::SP || NewSPReg == FPReg) &&
1278 "the operand of .setfp directive should be either $sp or $fp");
1283 if (NewSPReg == ARM::SP)
1284 FPOffset = SPOffset + Offset;
1289 void ARMELFStreamer::emitMovSP(
unsigned Reg, int64_t Offset) {
1290 assert((Reg != ARM::SP && Reg != ARM::PC) &&
1291 "the operand of .movsp cannot be either sp or pc");
1292 assert(FPReg == ARM::SP &&
"current FP must be SP");
1294 FlushPendingOffset();
1297 FPOffset = SPOffset + Offset;
1303 void ARMELFStreamer::emitPad(int64_t Offset) {
1309 PendingOffset -= Offset;
1318 for (
size_t i = 0; i < RegList.
size(); ++i) {
1320 assert(Reg < (IsVector ? 32U : 16U) &&
"Register out of range");
1321 unsigned Bit = (1u <<
Reg);
1322 if ((Mask & Bit) == 0) {
1332 SPOffset -= Count * (IsVector ? 8 : 4);
1335 FlushPendingOffset();
1337 UnwindOpAsm.EmitVFPRegSave(Mask);
1339 UnwindOpAsm.EmitRegSave(Mask);
1342 void ARMELFStreamer::emitUnwindRaw(int64_t Offset,
1344 FlushPendingOffset();
1345 SPOffset = SPOffset - Offset;
1346 UnwindOpAsm.EmitRaw(Opcodes);
1354 bool isVerboseAsm) {
1355 return new ARMTargetAsmStreamer(S, OS, *InstPrint, isVerboseAsm);
1366 return new ARMTargetELFStreamer(S);
1374 ARMELFStreamer *S =
new ARMELFStreamer(Context, TAB, OS, Emitter, IsThumb);
1381 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.
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)
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg) const
unsigned getUniqueID() const
virtual void finishAttributeSection()
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
virtual void emitPersonality(const MCSymbol *Personality)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
virtual void emitPersonalityIndex(unsigned Index)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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)
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)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
Streaming machine code generation interface.
virtual void emitRegSave(const SmallVectorImpl< unsigned > &RegList, bool isVector)
The instances of the Type class are immutable: once they are created, they are never changed...
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()
Special entry for the function never unwind.
virtual void emitUnwindRaw(int64_t StackOffset, const SmallVectorImpl< uint8_t > &Opcodes)
.subsections_via_symbols (MachO)
SectionKind - This is a simple POD value that classifies the properties of a section.
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()
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
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...
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
.code32 (X86) / .code 32 (ARM)
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.
void EmitValueImpl(const MCExpr *Value, unsigned Size, const SMLoc &Loc=SMLoc()) override
Emit the expression Value into the output as a native integer of the given Size bytes.
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="")
MCSubtargetInfo - Generic base class for all target subtargets.
MCSectionELF - 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)
An abstract base class for streams implementations that also support a pwrite operation.
Fragment for data and encoded instructions.
const ARM::ArchExtKind Kind
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.
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.
std::string lower() const
virtual void switchVendor(StringRef Vendor)
bool empty() const
empty - Check if the string is empty.
virtual void emitTextAttribute(unsigned Attribute, StringRef String)