21 #include "llvm/Config/config.h"
50 if (MinInsnLength == 1)
52 if (AddrDelta % MinInsnLength != 0) {
56 return AddrDelta / MinInsnLength;
86 .addLineEntry(LineEntry, Section);
117 unsigned FileNum = 1;
118 unsigned LastLine = 1;
122 unsigned Discriminator = 0;
127 int64_t LineDelta =
static_cast<int64_t
>(LineEntry.getLine()) - LastLine;
129 if (FileNum != LineEntry.getFileNum()) {
130 FileNum = LineEntry.getFileNum();
134 if (Column != LineEntry.getColumn()) {
135 Column = LineEntry.getColumn();
139 if (Discriminator != LineEntry.getDiscriminator() &&
141 Discriminator = LineEntry.getDiscriminator();
148 if (Isa != LineEntry.getIsa()) {
149 Isa = LineEntry.getIsa();
154 Flags = LineEntry.getFlags();
162 MCOS->
EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
164 MCSymbol *Label = LineEntry.getLabel();
174 LastLine = LineEntry.getLine();
205 if (LineTables.empty())
212 for (
const auto &CUIDTablePair : LineTables)
213 CUIDTablePair.second.EmitCU(MCOS, Params);
221 std::pair<MCSymbol *, MCSymbol *>
224 static const char StandardOpcodeLengths[] = {
246 assert(!isa<MCSymbolRefExpr>(Expr));
260 std::pair<MCSymbol *, MCSymbol *>
302 for (
char Length : StandardOpcodeLengths)
330 return std::make_pair(LineStartSym, LineEndSym);
335 MCSymbol *LineEndSym = Header.
Emit(MCOS, Params).second;
347 unsigned FileNumber) {
348 return Header.
getFile(Directory, FileName, FileNumber);
353 unsigned FileNumber) {
356 if (FileName.
empty()) {
357 FileName =
"<stdin>";
361 if (FileNumber == 0) {
369 if (!IterBool.second)
370 return IterBool.first->second;
379 if (!File.
Name.empty())
382 if (Directory.
empty()) {
385 if (!tFileName.
empty()) {
387 if (!Directory.
empty())
388 FileName = tFileName;
395 if (Directory.
empty()) {
413 File.
Name = FileName;
422 int64_t LineDelta, uint64_t AddrDelta) {
438 int64_t LineDelta, uint64_t AddrDelta,
440 uint64_t Temp, Opcode;
441 bool NeedCopy =
false;
444 uint64_t MaxSpecialAddrDelta =
SpecialAddr(Params, 255);
452 if (LineDelta == INT64_MAX) {
453 if (AddrDelta == MaxSpecialAddrDelta)
454 OS <<
char(dwarf::DW_LNS_const_add_pc);
455 else if (AddrDelta) {
456 OS << char(dwarf::DW_LNS_advance_pc);
459 OS << char(dwarf::DW_LNS_extended_op);
461 OS << char(dwarf::DW_LNE_end_sequence);
472 OS <<
char(dwarf::DW_LNS_advance_line);
481 if (LineDelta == 0 && AddrDelta == 0) {
482 OS <<
char(dwarf::DW_LNS_copy);
490 if (AddrDelta < 256 + MaxSpecialAddrDelta) {
499 Opcode = Temp + (AddrDelta - MaxSpecialAddrDelta) * Params.
DWARF2LineRange;
501 OS <<
char(dwarf::DW_LNS_const_add_pc);
508 OS <<
char(dwarf::DW_LNS_advance_pc);
512 OS << char(dwarf::DW_LNS_copy);
514 assert(Temp <= 255 &&
"Buggy special opcode encoding.");
536 ? dwarf::DW_FORM_sec_offset
537 : dwarf::DW_FORM_data4);
541 ? dwarf::DW_FORM_sec_offset
542 : dwarf::DW_FORM_data4);
544 EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
545 EmitAbbrev(MCOS, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr);
547 EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
549 EmitAbbrev(MCOS, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string);
551 if (!DwarfDebugFlags.
empty())
552 EmitAbbrev(MCOS, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string);
553 EmitAbbrev(MCOS, dwarf::DW_AT_producer, dwarf::DW_FORM_string);
554 EmitAbbrev(MCOS, dwarf::DW_AT_language, dwarf::DW_FORM_data2);
561 EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
562 EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
563 EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
564 EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
565 EmitAbbrev(MCOS, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag);
583 const MCSymbol *InfoSectionSymbol) {
592 int Length = 4 + 2 + 4 + 1 + 1;
598 int Pad = 2 * AddrSize - (Length & (2 * AddrSize - 1));
599 if (Pad == 2 * AddrSize)
605 Length += 2 * AddrSize * Sections.size();
607 Length += 2 * AddrSize;
616 if (InfoSectionSymbol)
626 for(
int i = 0; i < Pad; i++)
632 const MCSymbol *StartSymbol = Sec->getBeginSymbol();
633 MCSymbol *EndSymbol = Sec->getEndSymbol(context);
634 assert(StartSymbol &&
"StartSymbol must not be NULL");
635 assert(EndSymbol &&
"EndSymbol must not be NULL");
640 *StartSymbol, *EndSymbol, 0);
654 const MCSymbol *AbbrevSectionSymbol,
656 const MCSymbol *RangesSectionSymbol) {
687 if (AbbrevSectionSymbol ==
nullptr)
702 if (LineSectionSymbol)
708 if (RangesSectionSymbol) {
721 const auto TextSection = Sections.begin();
722 assert(TextSection != Sections.end() &&
"No text section found");
724 MCSymbol *StartSymbol = (*TextSection)->getBeginSymbol();
725 MCSymbol *EndSymbol = (*TextSection)->getEndSymbol(context);
726 assert(StartSymbol &&
"StartSymbol must not be NULL");
727 assert(EndSymbol &&
"EndSymbol must not be NULL");
743 if (MCDwarfDirs.
size() > 0) {
760 if (!DwarfDebugFlags.
empty()){
767 if (!DwarfDebugProducer.
empty())
780 const std::vector<MCGenDwarfLabelEntry> &Entries =
782 for (
const auto &Entry : Entries) {
831 const MCSymbol *StartSymbol = Sec->getBeginSymbol();
832 MCSymbol *EndSymbol = Sec->getEndSymbol(context);
833 assert(StartSymbol &&
"StartSymbol must not be NULL");
834 assert(EndSymbol &&
"EndSymbol must not be NULL");
840 MCOS->
EmitValue(SectionStartAddr, AddrSize);
844 *StartSymbol, *EndSymbol, 0);
863 bool CreateDwarfSectionSymbols =
865 MCSymbol *LineSectionSymbol =
nullptr;
866 if (CreateDwarfSectionSymbols)
868 MCSymbol *AbbrevSectionSymbol =
nullptr;
869 MCSymbol *InfoSectionSymbol =
nullptr;
870 MCSymbol *RangesSectionSymbol =
nullptr;
882 const bool UseRangesSection =
885 CreateDwarfSectionSymbols |= UseRangesSection;
888 if (CreateDwarfSectionSymbols) {
893 if (CreateDwarfSectionSymbols) {
897 if (UseRangesSection) {
899 if (CreateDwarfSectionSymbols) {
905 assert((RangesSectionSymbol !=
nullptr) || !UseRangesSection);
912 if (UseRangesSection)
920 RangesSectionSymbol);
977 unsigned symbolEncoding) {
979 unsigned format = symbolEncoding & 0x0f;
998 unsigned symbolEncoding,
bool isEH) {
1012 unsigned symbolEncoding) {
1024 class FrameEmitterImpl {
1026 int InitialCFAOffset = 0;
1032 : IsEH(IsEH), Streamer(Streamer) {}
1038 unsigned personalityEncoding,
const MCSymbol *lsda,
1039 bool IsSignalFrame,
unsigned lsdaEncoding,
1042 bool LastInSection,
const MCSymbol &SectionStart);
1056 auto *
MRI = Streamer.getContext().getRegisterInfo();
1063 Reg1 =
MRI->getDwarfRegNum(
MRI->getLLVMRegNum(Reg1,
true),
false);
1064 Reg2 =
MRI->getDwarfRegNum(
MRI->getLLVMRegNum(Reg2,
true),
false);
1066 Streamer.EmitIntValue(dwarf::DW_CFA_register, 1);
1067 Streamer.EmitULEB128IntValue(Reg1);
1068 Streamer.EmitULEB128IntValue(Reg2);
1072 Streamer.EmitIntValue(dwarf::DW_CFA_GNU_window_save, 1);
1077 Streamer.EmitIntValue(dwarf::DW_CFA_undefined, 1);
1078 Streamer.EmitULEB128IntValue(Reg);
1083 const bool IsRelative =
1086 Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_offset, 1);
1093 Streamer.EmitULEB128IntValue(CFAOffset);
1100 Reg =
MRI->getDwarfRegNum(
MRI->getLLVMRegNum(Reg,
true),
false);
1101 Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa, 1);
1102 Streamer.EmitULEB128IntValue(Reg);
1104 Streamer.EmitULEB128IntValue(CFAOffset);
1111 Reg =
MRI->getDwarfRegNum(
MRI->getLLVMRegNum(Reg,
true),
false);
1112 Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_register, 1);
1113 Streamer.EmitULEB128IntValue(Reg);
1119 const bool IsRelative =
1124 Reg =
MRI->getDwarfRegNum(
MRI->getLLVMRegNum(Reg,
true),
false);
1128 Offset -= CFAOffset;
1129 Offset = Offset / dataAlignmentFactor;
1132 Streamer.EmitIntValue(dwarf::DW_CFA_offset_extended_sf, 1);
1133 Streamer.EmitULEB128IntValue(Reg);
1134 Streamer.EmitSLEB128IntValue(Offset);
1135 }
else if (Reg < 64) {
1136 Streamer.EmitIntValue(dwarf::DW_CFA_offset + Reg, 1);
1137 Streamer.EmitULEB128IntValue(Offset);
1139 Streamer.EmitIntValue(dwarf::DW_CFA_offset_extended, 1);
1140 Streamer.EmitULEB128IntValue(Reg);
1141 Streamer.EmitULEB128IntValue(Offset);
1146 Streamer.EmitIntValue(dwarf::DW_CFA_remember_state, 1);
1149 Streamer.EmitIntValue(dwarf::DW_CFA_restore_state, 1);
1153 Streamer.EmitIntValue(dwarf::DW_CFA_same_value, 1);
1154 Streamer.EmitULEB128IntValue(Reg);
1160 Reg =
MRI->getDwarfRegNum(
MRI->getLLVMRegNum(Reg,
true),
false);
1161 Streamer.EmitIntValue(dwarf::DW_CFA_restore | Reg, 1);
1165 Streamer.EmitIntValue(dwarf::DW_CFA_GNU_args_size, 1);
1166 Streamer.EmitULEB128IntValue(Instr.
getOffset());
1182 if (Label && !Label->
isDefined())
continue;
1185 if (BaseLabel && Label) {
1187 if (ThisSym != BaseLabel) {
1188 Streamer.EmitDwarfAdvanceFrameAddr(BaseLabel, ThisSym);
1189 BaseLabel = ThisSym;
1193 EmitCFIInstruction(Instr);
1225 if (!Encoding)
return;
1229 if (!DwarfEHFrameOnly && Frame.
Lsda)
1230 Encoding |= 0x40000000;
1235 Streamer.EmitSymbolValue(Frame.
Begin, Size);
1244 Streamer.EmitIntValue(Encoding, Size);
1249 Streamer.EmitSymbolValue(Frame.
Personality, Size);
1251 Streamer.EmitIntValue(0, Size);
1255 if (!DwarfEHFrameOnly && Frame.
Lsda)
1256 Streamer.EmitSymbolValue(Frame.
Lsda, Size);
1258 Streamer.EmitIntValue(0, Size);
1264 switch (DwarfVersion) {
1277 unsigned personalityEncoding,
1280 unsigned lsdaEncoding,
1282 MCContext &context = Streamer.getContext();
1287 Streamer.EmitLabel(sectionStart);
1297 unsigned CIE_ID = IsEH ? 0 : -1;
1298 Streamer.EmitIntValue(CIE_ID, 4);
1302 Streamer.EmitIntValue(CIEVersion, 1);
1307 Augmentation +=
"z";
1309 Augmentation +=
"P";
1311 Augmentation +=
"L";
1312 Augmentation +=
"R";
1314 Augmentation +=
"S";
1315 Streamer.EmitBytes(Augmentation);
1317 Streamer.EmitIntValue(0, 1);
1319 if (CIEVersion >= 4) {
1324 Streamer.EmitIntValue(0, 1);
1334 if (CIEVersion == 1) {
1336 "DWARF 2 encodes return_address_register in one byte");
1339 Streamer.EmitULEB128IntValue(
1345 unsigned augmentationLength = 0;
1349 augmentationLength += 1;
1354 augmentationLength += 1;
1356 augmentationLength += 1;
1358 Streamer.EmitULEB128IntValue(augmentationLength);
1379 const std::vector<MCCFIInstruction> &Instructions =
1381 EmitCFIInstructions(Instructions,
nullptr);
1384 InitialCFAOffset = CFAOffset;
1389 Streamer.EmitLabel(sectionEnd);
1390 return *sectionStart;
1393 void FrameEmitterImpl::EmitFDE(
const MCSymbol &cieStart,
1397 MCContext &context = Streamer.getContext();
1402 CFAOffset = InitialCFAOffset;
1408 Streamer.EmitLabel(fdeStart);
1421 Streamer.EmitSymbolValue(&cieStart, 4);
1425 unsigned PCEncoding =
1437 unsigned augmentationLength = 0;
1442 Streamer.EmitULEB128IntValue(augmentationLength);
1457 Streamer.EmitValueToAlignment(Align);
1459 Streamer.EmitLabel(fdeEnd);
1465 static const CIEKey getEmptyKey() {
1466 return CIEKey(
nullptr, 0, -1,
false,
false);
1469 static const CIEKey getTombstoneKey() {
1470 return CIEKey(
nullptr, -1, 0,
false,
false);
1473 CIEKey(
const MCSymbol *Personality,
unsigned PersonalityEncoding,
1474 unsigned LsdaEncoding,
bool IsSignalFrame,
bool IsSimple)
1475 : Personality(Personality), PersonalityEncoding(PersonalityEncoding),
1476 LsdaEncoding(LsdaEncoding), IsSignalFrame(IsSignalFrame),
1477 IsSimple(IsSimple) {}
1480 unsigned PersonalityEncoding;
1481 unsigned LsdaEncoding;
1495 return static_cast<unsigned>(
1496 hash_combine(Key.Personality, Key.PersonalityEncoding, Key.LsdaEncoding,
1497 Key.IsSignalFrame, Key.IsSimple));
1500 static bool isEqual(
const CIEKey &LHS,
const CIEKey &RHS) {
1501 return LHS.Personality == RHS.Personality &&
1502 LHS.PersonalityEncoding == RHS.PersonalityEncoding &&
1503 LHS.LsdaEncoding == RHS.LsdaEncoding &&
1504 LHS.IsSignalFrame == RHS.IsSignalFrame &&
1505 LHS.IsSimple == RHS.IsSimple;
1518 FrameEmitterImpl Emitter(IsEH, Streamer);
1524 bool SectionEmitted =
false;
1527 if (!SectionEmitted) {
1530 SectionEmitted =
true;
1532 NeedsEHFrameSection |=
1535 Emitter.EmitCompactUnwind(Frame);
1539 if (!NeedsEHFrameSection)
return;
1551 const MCSymbol *DummyDebugKey =
nullptr;
1553 for (
auto I = FrameArray.
begin(),
E = FrameArray.
end();
I !=
E;) {
1564 const MCSymbol *&CIEStart = IsEH ? CIEStarts[Key] : DummyDebugKey;
1570 Emitter.EmitFDE(*CIEStart, Frame,
I ==
E, *SectionStart);
1575 uint64_t AddrDelta) {
1589 if (AddrDelta == 0) {
1590 }
else if (
isUIntN(6, AddrDelta)) {
1591 uint8_t Opcode = dwarf::DW_CFA_advance_loc | AddrDelta;
1594 OS << uint8_t(dwarf::DW_CFA_advance_loc1);
1595 OS << uint8_t(AddrDelta);
1597 OS << uint8_t(dwarf::DW_CFA_advance_loc2);
1604 OS << uint8_t(dwarf::DW_CFA_advance_loc4);
static const MCExpr * forceExpAbs(MCStreamer &OS, const MCExpr *Expr)
void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E)
constexpr bool isUInt< 32 >(uint64_t x)
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
const MCAsmInfo * getAsmInfo() const
unsigned getFDEEncoding() const
static int getDataAlignmentFactor(MCStreamer &streamer)
void EmitBytes(StringRef Data) override
Emit the bytes in Data into the output.
static CIEKey getTombstoneKey()
#define DWARF2_FLAG_PROLOGUE_END
static void Make(MCObjectStreamer *MCOS, MCSection *Section)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles(unsigned CUID=0)
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta)
bool getOmitDwarfIfHaveCompactUnwind() const
A raw_ostream that writes to an SmallVector or SmallString.
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta)
Utility function to emit the encoding to a streamer.
virtual MCSymbol * getDwarfLineTableSymbol(unsigned CUID)
static void EmitGenDwarfInfo(MCStreamer *MCOS, const MCSymbol *AbbrevSectionSymbol, const MCSymbol *LineSectionSymbol, const MCSymbol *RangesSectionSymbol)
uint16_t getDwarfVersion() const
StringRef getDwarfDebugFlags()
std::vector< MCDwarfLineEntry > MCDwarfLineEntryCollection
static void Encode(MCContext &Context, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS)
Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
void EmitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel, const MCSymbol *Label, unsigned PointerSize)
unsigned getRegister() const
std::vector< MCCFIInstruction > Instructions
virtual const MCExpr * getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const
#define DWARF2_FLAG_IS_STMT
StringRef getDwarfDebugProducer()
bool getSupportsCompactUnwindWithoutEHFrame() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
MCSection * getCurrentSectionOnly() const
void finalizeDwarfSections(MCStreamer &MCOS)
Remove empty sections from SectionStartEndSyms, to avoid generating useless debug info for them...
Base class for the full range of assembler expressions which are needed for parsing.
uint8_t DWARF2LineRange
Range of line offsets in a special line info. opcode.
Reg
All possible values of the reg field in the ModR/M byte.
const std::vector< MCCFIInstruction > & getInitialFrameState() const
static void emitFDESymbol(MCObjectStreamer &streamer, const MCSymbol &symbol, unsigned symbolEncoding, bool isEH)
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
MCContext & getContext() const
bool isLittleEndian() const
True if the target is little endian.
const SmallVectorImpl< std::string > & getMCDwarfDirs(unsigned CUID=0)
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
Context object for machine code objects.
StringRef getValues() const
static void EmitGenDwarfAbbrev(MCStreamer *MCOS)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
unsigned getDwarfCompileUnitID()
Streaming object file generation interface.
Instances of this class represent the information from a dwarf .loc directive.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned getGenDwarfFileNumber()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
size_t size() const
size - Get the array size.
void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
static const MCBinaryExpr * create(Opcode Op, const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params) const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
This class is intended to be used as a base class for asm properties and features specific to the tar...
MCSection * getDwarfLineSection() const
bool needsDwarfSectionOffsetDirective() const
static uint64_t SpecialAddr(MCDwarfLineTableParams Params, uint64_t op)
Given a special op, return the address skip amount (in units of DWARF2_LINE_MIN_INSN_LENGTH).
static unsigned getSizeForEncoding(MCStreamer &streamer, unsigned symbolEncoding)
Streaming machine code generation interface.
static unsigned getCIEVersion(bool IsEH, unsigned DwarfVersion)
MCSection * getCompactUnwindSection() const
static void EmitAbbrev(MCStreamer *MCOS, uint64_t Name, uint64_t Form)
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
uint8_t DWARF2LineOpcodeBase
First special line opcode - leave room for the standard opcodes.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
constexpr bool isUInt< 8 >(uint64_t x)
unsigned const MachineRegisterInfo * MRI
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void write(ArrayRef< value_type > Vals)
#define DWARF2_FLAG_EPILOGUE_BEGIN
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
static void EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section, const MCLineSection::MCDwarfLineEntryCollection &LineEntries)
static void EmitGenDwarfAranges(MCStreamer *MCOS, const MCSymbol *InfoSectionSymbol)
cl::opt< int > DwarfVersion("dwarf-version", cl::desc("Dwarf version"), cl::init(0))
static const unsigned End
#define DWARF2_FLAG_BASIC_BLOCK
const MCDwarfLoc & getCurrentDwarfLoc()
StringRef parent_path(StringRef path, Style style=Style::native)
Get parent path.
unsigned PersonalityEncoding
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
int8_t DWARF2LineBase
Minimum line offset in a special line info.
StringRef get_separator(Style style=Style::native)
Return the preferred separator for this platform.
void generateCompactUnwindEncodings(MCAsmBackend *MAB)
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
const SetVector< MCSection * > & getGenDwarfSectionSyms()
OpType getOperation() const
unsigned getMinInstAlignment() const
bool doDwarfFDESymbolsUseAbsDiff() const
static unsigned getHashValue(const CIEKey &Key)
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
static bool isEqual(const CIEKey &LHS, const CIEKey &RHS)
unsigned getRegister2() const
StringRef str()
Return a StringRef for the vector contents.
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, raw_ostream &OS)
uint32_t CompactUnwindEncoding
static void EmitGenDwarfRanges(MCStreamer *MCOS)
bool isDefined(bool SetUsed=true) const
isDefined - Check if this symbol is defined (i.e., it has an address).
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
const std::vector< MCGenDwarfLabelEntry > & getMCGenDwarfLabelEntries() const
static CIEKey getEmptyKey()
unsigned FindLineNumber(SMLoc Loc, unsigned BufferID=0) const
Find the line number for the specified location in the specified file.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
static void Emit(MCStreamer *MCOS)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
#define DWARF2_LINE_DEFAULT_IS_STMT
static StringRef toStringRef(bool B)
Construct a string ref from a boolean.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
static uint64_t ScaleAddrDelta(MCContext &Context, uint64_t AddrDelta)
const MCRegisterInfo * getRegisterInfo() const
Instances of this class represent the line information for the dwarf line table entries.
static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params)
static std::vector< std::string > Flags
StringRef getCompilationDir() const
Get the compilation directory for DW_AT_comp_dir The compilation directory should be set with setComp...
MCSection * getDwarfARangesSection() const
void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const
static const MCExpr * MakeStartMinusEndExpr(const MCStreamer &MCOS, const MCSymbol &Start, const MCSymbol &End, int IntVal)
StringRef getName() const
getName - Get the symbol name.
static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol, unsigned symbolEncoding)
StringRef filename(StringRef path, Style style=Style::native)
Get filename.
static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr, SMLoc &Loc)
const std::map< unsigned, MCDwarfLineTable > & getMCDwarfLineTables() const
const MCSymbol * Personality
bool isStackGrowthDirectionUp() const
True if target stack grow up.
MCSection * getDwarfFrameSection() const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
constexpr bool isUInt< 16 >(uint64_t x)
virtual void emitFill(uint64_t NumBytes, uint8_t FillValue)
Emit NumBytes bytes worth of the value specified by FillValue.
const MCLineDivisionMap & getMCLineEntries() const
bool hasAggressiveSymbolFolding() const
void EmitULEB128IntValue(uint64_t Value, unsigned Padding=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
MCSymbol * endSection(MCSection *Section)
void encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a SLEB128 value to an output stream.
unsigned FindBufferContainingLoc(SMLoc Loc) const
Return the ID of the buffer containing the specified location.
MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber, MCSymbol *label)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual const MCExpr * getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const
LLVM Value Representation.
Generic interface to target specific assembler backends.
const MCObjectFileInfo * getObjectFileInfo() const
MCSection * getDwarfInfoSection() const
MCSection * getDwarfRangesSection() const
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
unsigned getCompactUnwindDwarfEHFrameOnly() const
static void emitEncodingByte(MCObjectStreamer &Streamer, unsigned Encoding)
This class implements an extremely fast bulk output stream that can only output to a stream...
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output stream.
static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH)
StringRef - Represent a constant reference to a string, i.e.
Instances of this class represent the name of the dwarf .file directive and its associated dwarf file...
unsigned getRARegister() const
This method should return the register where the return address can be found.
MCSection * getDwarfAbbrevSection() const
Represents a location in source code.
unsigned getFile(StringRef &Directory, StringRef &FileName, unsigned FileNumber=0)
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
MCSymbol * getLabel() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
bool doesDwarfUseRelocationsAcrossSections() const