Lines Matching defs:MCOS

91 void MCDwarfLineEntry::make(MCStreamer *MCOS, MCSection *Section) {
92 if (!MCOS->getContext().getDwarfLocSeen())
96 MCSymbol *LineSym = MCOS->getContext().createTempSymbol();
98 MCOS->emitLabel(LineSym);
101 const MCDwarfLoc &DwarfLoc = MCOS->getContext().getCurrentDwarfLoc();
107 MCOS->getContext().clearDwarfLocSeen();
110 MCOS->getContext()
111 .getMCDwarfLineTable(MCOS->getContext().getDwarfCompileUnitID())
167 MCStreamer *MCOS, MCSection *Section,
189 const MCAsmInfo *asmInfo = MCOS->getContext().getAsmInfo();
193 MCOS->emitDwarfLineEndEntry(Section, LastLabel,
197 MCOS->emitLabel(LineEntry.LineStreamLabel, LineEntry.StreamLabelDefLoc);
202 MCOS->emitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, Label,
213 MCOS->emitInt8(dwarf::DW_LNS_set_file);
214 MCOS->emitULEB128IntValue(FileNum);
218 MCOS->emitInt8(dwarf::DW_LNS_set_column);
219 MCOS->emitULEB128IntValue(Column);
222 MCOS->getContext().getDwarfVersion() >= 4) {
225 MCOS->emitInt8(dwarf::DW_LNS_extended_op);
226 MCOS->emitULEB128IntValue(Size + 1);
227 MCOS->emitInt8(dwarf::DW_LNE_set_discriminator);
228 MCOS->emitULEB128IntValue(Discriminator);
232 MCOS->emitInt8(dwarf::DW_LNS_set_isa);
233 MCOS->emitULEB128IntValue(Isa);
237 MCOS->emitInt8(dwarf::DW_LNS_negate_stmt);
240 MCOS->emitInt8(dwarf::DW_LNS_set_basic_block);
242 MCOS->emitInt8(dwarf::DW_LNS_set_prologue_end);
244 MCOS->emitInt8(dwarf::DW_LNS_set_epilogue_begin);
249 MCOS->emitDwarfAdvanceLineAddr(LineDelta, LastLabel, Label,
264 MCOS->emitDwarfLineEndEntry(Section, LastLabel);
267 void MCDwarfLineTable::endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS,
270 auto &ctx = MCOS->getContext();
273 MCOS->emitLabel(LineSym);
280 getMCLineSections().addLineEntry(LineEntry, MCOS->getCurrentSectionOnly());
286 void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) {
287 MCContext &context = MCOS->getContext();
302 MCOS->switchSection(context.getObjectFileInfo()->getDwarfLineSection());
306 CUIDTablePair.second.emitCU(MCOS, Params, LineStr);
310 LineStr->emitSection(MCOS);
313 void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
318 MCOS.switchSection(Section);
319 MCOS.emitLabel(Header.Emit(&MCOS, Params, {}, NoLineStr).second);
323 MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
341 return Emit(MCOS, Params,
363 void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
365 MCOS->switchSection(
366 MCOS->getContext().getObjectFileInfo()->getDwarfLineStrSection());
368 MCOS->emitBinaryData(Data.str());
385 void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) {
387 dwarf::getDwarfOffsetByteSize(MCOS->getContext().getDwarfFormat());
390 MCContext &Ctx = MCOS->getContext();
392 MCOS->emitCOFFSecRel32(LineStrLabel, Offset);
394 MCOS->emitValue(makeStartPlusIntExpr(Ctx, *LineStrLabel, Offset),
398 MCOS->emitIntValue(Offset, RefSize);
401 void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
404 MCOS->emitBytes(Dir); // The DirectoryName, and...
405 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
407 MCOS->emitInt8(0); // Terminate the directory list.
412 MCOS->emitBytes(MCDwarfFiles[i].Name); // FileName and...
413 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
414 MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
415 MCOS->emitInt8(0); // Last modification timestamp (always 0).
416 MCOS->emitInt8(0); // File size (always 0).
418 MCOS->emitInt8(0); // Terminate the file list.
421 static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
426 LineStr->emitRef(MCOS, DwarfFile.Name);
428 MCOS->emitBytes(DwarfFile.Name); // FileName and...
429 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
431 MCOS->emitULEB128IntValue(DwarfFile.DirIndex); // Directory number.
434 MCOS->emitBinaryData(
439 LineStr->emitRef(MCOS, DwarfFile.Source.value_or(StringRef()));
441 MCOS->emitBytes(DwarfFile.Source.value_or(StringRef())); // Source and...
442 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
448 MCStreamer *MCOS, std::optional<MCDwarfLineStr> &LineStr) const {
452 MCOS->emitInt8(1);
453 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
454 MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
456 MCOS->emitULEB128IntValue(MCDwarfDirs.size() + 1);
459 StringRef CompDir = MCOS->getContext().getCompilationDir();
462 MCOS->getContext().remapDebugPath(Dir);
469 LineStr->emitRef(MCOS, CompDir);
471 LineStr->emitRef(MCOS, Dir);
474 MCOS->emitBytes(CompDir);
475 MCOS->emitBytes(StringRef("\0", 1));
477 MCOS->emitBytes(Dir); // The DirectoryName, and...
478 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
490 MCOS->emitInt8(Entries);
491 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
492 MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
494 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_directory_index);
495 MCOS->emitULEB128IntValue(dwarf::DW_FORM_udata);
497 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_MD5);
498 MCOS->emitULEB128IntValue(dwarf::DW_FORM_data16);
501 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_LLVM_source);
502 MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
509 MCOS->emitULEB128IntValue(MCDwarfFiles.empty() ? 1 : MCDwarfFiles.size());
514 emitOneV5FileEntry(MCOS, RootFile.Name.empty() ? MCDwarfFiles[1] : RootFile,
517 emitOneV5FileEntry(MCOS, MCDwarfFiles[i], HasAllMD5, HasAnySource, LineStr);
521 MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
524 MCContext &context = MCOS->getContext();
532 MCOS->emitDwarfLineStartLabel(LineStartSym);
536 MCSymbol *LineEndSym = MCOS->emitDwarfUnitLength("debug_line", "unit length");
540 MCOS->emitInt16(LineTableVersion);
544 MCOS->emitInt8(context.getAsmInfo()->getCodePointerSize());
545 MCOS->emitInt8(0); // Segment selector; same as EmitGenDwarfAranges.
554 MCOS->emitAbsoluteSymbolDiff(ProEndSym, ProStartSym, OffsetSize);
556 MCOS->emitLabel(ProStartSym);
559 MCOS->emitInt8(context.getAsmInfo()->getMinInstAlignment());
564 MCOS->emitInt8(1);
565 MCOS->emitInt8(DWARF2_LINE_DEFAULT_IS_STMT);
566 MCOS->emitInt8(Params.DWARF2LineBase);
567 MCOS->emitInt8(Params.DWARF2LineRange);
568 MCOS->emitInt8(StandardOpcodeLengths.size() + 1);
572 MCOS->emitInt8(Length);
577 emitV5FileDirTables(MCOS, LineStr);
579 emitV2FileDirTables(MCOS);
583 MCOS->emitLabel(ProEndSym);
588 void MCDwarfLineTable::emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
590 MCSymbol *LineEndSym = Header.Emit(MCOS, Params, LineStr).second;
594 emitOne(MCOS, LineSec.first, LineSec.second);
598 MCOS->emitLabel(LineEndSym);
701 void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
703 MCContext &Context = MCOS->getContext();
706 MCOS->emitBytes(Tmp);
800 static void EmitAbbrev(MCStreamer *MCOS, uint64_t Name, uint64_t Form) {
801 MCOS->emitULEB128IntValue(Name);
802 MCOS->emitULEB128IntValue(Form);
807 static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
808 MCContext &context = MCOS->getContext();
809 MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
812 MCOS->emitULEB128IntValue(1);
813 MCOS->emitULEB128IntValue(dwarf::DW_TAG_compile_unit);
814 MCOS->emitInt8(dwarf::DW_CHILDREN_yes);
820 EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, SecOffsetForm);
823 EmitAbbrev(MCOS, dwarf::DW_AT_ranges, SecOffsetForm);
825 EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
826 EmitAbbrev(MCOS, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr);
828 EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
830 EmitAbbrev(MCOS, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string);
833 EmitAbbrev(MCOS, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string);
834 EmitAbbrev(MCOS, dwarf::DW_AT_producer, dwarf::DW_FORM_string);
835 EmitAbbrev(MCOS, dwarf::DW_AT_language, dwarf::DW_FORM_data2);
836 EmitAbbrev(MCOS, 0, 0);
839 MCOS->emitULEB128IntValue(2);
840 MCOS->emitULEB128IntValue(dwarf::DW_TAG_label);
841 MCOS->emitInt8(dwarf::DW_CHILDREN_no);
842 EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
843 EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
844 EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
845 EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
846 EmitAbbrev(MCOS, 0, 0);
849 MCOS->emitInt8(0);
856 static void EmitGenDwarfAranges(MCStreamer *MCOS,
858 MCContext &context = MCOS->getContext();
862 MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
890 MCOS->emitInt32(dwarf::DW_LENGTH_DWARF64);
893 MCOS->emitIntValue(Length - UnitLengthBytes, OffsetSize);
895 MCOS->emitInt16(2);
899 MCOS->emitSymbolValue(InfoSectionSymbol, OffsetSize,
902 MCOS->emitIntValue(0, OffsetSize);
904 MCOS->emitInt8(AddrSize);
906 MCOS->emitInt8(0);
909 MCOS->emitInt8(0);
923 MCOS->emitValue(Addr, AddrSize);
924 emitAbsValue(*MCOS, Size, AddrSize);
928 MCOS->emitIntValue(0, AddrSize);
929 MCOS->emitIntValue(0, AddrSize);
935 static void EmitGenDwarfInfo(MCStreamer *MCOS,
939 MCContext &context = MCOS->getContext();
941 MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
946 MCOS->emitLabel(InfoStart);
957 MCOS->emitInt32(dwarf::DW_LENGTH_DWARF64);
963 emitAbsValue(*MCOS, Length, OffsetSize);
966 MCOS->emitInt16(context.getDwarfVersion());
973 MCOS->emitInt8(dwarf::DW_UT_compile);
974 MCOS->emitInt8(AddrSize);
979 MCOS->emitSymbolValue(AbbrevSectionSymbol, OffsetSize,
983 MCOS->emitIntValue(0, OffsetSize);
985 MCOS->emitInt8(AddrSize);
990 MCOS->emitULEB128IntValue(1);
995 MCOS->emitSymbolValue(LineSectionSymbol, OffsetSize,
999 MCOS->emitIntValue(0, OffsetSize);
1005 MCOS->emitSymbolValue(RangesSymbol, OffsetSize);
1023 MCOS->emitValue(Start, AddrSize);
1028 MCOS->emitValue(End, AddrSize);
1035 MCOS->emitBytes(MCDwarfDirs[0]);
1036 MCOS->emitBytes(sys::path::get_separator());
1046 MCOS->emitBytes(RootFile.Name);
1047 MCOS->emitInt8(0); // NULL byte to terminate the string.
1051 MCOS->emitBytes(context.getCompilationDir());
1052 MCOS->emitInt8(0); // NULL byte to terminate the string.
1058 MCOS->emitBytes(DwarfDebugFlags);
1059 MCOS->emitInt8(0); // NULL byte to terminate the string.
1065 MCOS->emitBytes(DwarfDebugProducer);
1067 MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
1068 MCOS->emitInt8(0); // NULL byte to terminate the string.
1072 MCOS->emitInt16(dwarf::DW_LANG_Mips_Assembler);
1078 MCOS->getContext().getMCGenDwarfLabelEntries();
1081 MCOS->emitULEB128IntValue(2);
1084 MCOS->emitBytes(Entry.getName());
1085 MCOS->emitInt8(0); // NULL byte to terminate the string.
1088 MCOS->emitInt32(Entry.getFileNumber());
1091 MCOS->emitInt32(Entry.getLineNumber());
1096 MCOS->emitValue(AT_low_pc, AddrSize);
1100 MCOS->emitInt8(0);
1103 MCOS->emitLabel(InfoEnd);
1109 static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
1110 MCContext &context = MCOS->getContext();
1117 if (MCOS->getContext().getDwarfVersion() >= 5) {
1118 MCOS->switchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
1119 MCSymbol *EndSymbol = mcdwarf::emitListsTableHeaderStart(*MCOS);
1120 MCOS->AddComment("Offset entry count");
1121 MCOS->emitInt32(0);
1123 MCOS->emitLabel(RangesSymbol);
1131 MCOS->emitInt8(dwarf::DW_RLE_start_length);
1132 MCOS->emitValue(SectionStartAddr, AddrSize);
1133 MCOS->emitULEB128Value(SectionSize);
1135 MCOS->emitInt8(dwarf::DW_RLE_end_of_list);
1136 MCOS->emitLabel(EndSymbol);
1138 MCOS->switchSection(context.getObjectFileInfo()->getDwarfRangesSection());
1140 MCOS->emitLabel(RangesSymbol);
1148 MCOS->emitFill(AddrSize, 0xFF);
1149 MCOS->emitValue(SectionStartAddr, AddrSize);
1154 MCOS->emitIntValue(0, AddrSize);
1155 emitAbsValue(*MCOS, SectionSize, AddrSize);
1159 MCOS->emitIntValue(0, AddrSize);
1160 MCOS->emitIntValue(0, AddrSize);
1170 void MCGenDwarfInfo::Emit(MCStreamer *MCOS) {
1171 MCContext &context = MCOS->getContext();
1179 LineSectionSymbol = MCOS->getDwarfLineTableSymbol(0);
1185 MCOS->getContext().finalizeDwarfSections(*MCOS);
1189 if (MCOS->getContext().getGenDwarfSectionSyms().empty())
1195 MCOS->getContext().getGenDwarfSectionSyms().size() > 1 &&
1196 MCOS->getContext().getDwarfVersion() >= 3;
1199 MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
1202 MCOS->emitLabel(InfoSectionSymbol);
1204 MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
1207 MCOS->emitLabel(AbbrevSectionSymbol);
1210 MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
1213 EmitGenDwarfAranges(MCOS, InfoSectionSymbol);
1216 RangesSymbol = emitGenDwarfRanges(MCOS);
1221 EmitGenDwarfAbbrev(MCOS);
1224 EmitGenDwarfInfo(MCOS, AbbrevSectionSymbol, LineSectionSymbol, RangesSymbol);
1233 void MCGenDwarfLabelEntry::Make(MCSymbol *Symbol, MCStreamer *MCOS,
1238 MCContext &context = MCOS->getContext();
1241 if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSectionOnly()))
1263 MCOS->emitLabel(Label);
1266 MCOS->getContext().addMCGenDwarfLabelEntry(