Lines Matching defs:MCOS

95 void MCDwarfLineEntry::make(MCStreamer *MCOS, MCSection *Section) {
96 if (!MCOS->getContext().getDwarfLocSeen())
100 MCSymbol *LineSym = MCOS->getContext().createTempSymbol();
102 MCOS->emitLabel(LineSym);
105 const MCDwarfLoc &DwarfLoc = MCOS->getContext().getCurrentDwarfLoc();
111 MCOS->getContext().clearDwarfLocSeen();
114 MCOS->getContext()
115 .getMCDwarfLineTable(MCOS->getContext().getDwarfCompileUnitID())
171 MCStreamer *MCOS, MCSection *Section,
191 const MCAsmInfo *asmInfo = MCOS->getContext().getAsmInfo();
193 MCOS->emitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, Label,
204 MCOS->emitInt8(dwarf::DW_LNS_set_file);
205 MCOS->emitULEB128IntValue(FileNum);
209 MCOS->emitInt8(dwarf::DW_LNS_set_column);
210 MCOS->emitULEB128IntValue(Column);
213 MCOS->getContext().getDwarfVersion() >= 4) {
216 MCOS->emitInt8(dwarf::DW_LNS_extended_op);
217 MCOS->emitULEB128IntValue(Size + 1);
218 MCOS->emitInt8(dwarf::DW_LNE_set_discriminator);
219 MCOS->emitULEB128IntValue(Discriminator);
223 MCOS->emitInt8(dwarf::DW_LNS_set_isa);
224 MCOS->emitULEB128IntValue(Isa);
228 MCOS->emitInt8(dwarf::DW_LNS_negate_stmt);
231 MCOS->emitInt8(dwarf::DW_LNS_set_basic_block);
233 MCOS->emitInt8(dwarf::DW_LNS_set_prologue_end);
235 MCOS->emitInt8(dwarf::DW_LNS_set_epilogue_begin);
240 MCOS->emitDwarfAdvanceLineAddr(LineDelta, LastLabel, Label,
254 MCOS->emitDwarfLineEndEntry(Section, LastLabel);
260 void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) {
261 MCContext &context = MCOS->getContext();
276 MCOS->switchSection(context.getObjectFileInfo()->getDwarfLineSection());
280 CUIDTablePair.second.emitCU(MCOS, Params, LineStr);
284 LineStr->emitSection(MCOS);
287 void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
292 MCOS.switchSection(Section);
293 MCOS.emitLabel(Header.Emit(&MCOS, Params, std::nullopt, NoLineStr).second);
297 MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
315 return Emit(MCOS, Params,
336 void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
338 MCOS->switchSection(
339 MCOS->getContext().getObjectFileInfo()->getDwarfLineStrSection());
341 MCOS->emitBinaryData(Data.str());
358 void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) {
360 dwarf::getDwarfOffsetByteSize(MCOS->getContext().getDwarfFormat());
363 MCContext &Ctx = MCOS->getContext();
365 MCOS->emitCOFFSecRel32(LineStrLabel, Offset);
367 MCOS->emitValue(makeStartPlusIntExpr(Ctx, *LineStrLabel, Offset),
371 MCOS->emitIntValue(Offset, RefSize);
374 void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
377 MCOS->emitBytes(Dir); // The DirectoryName, and...
378 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
380 MCOS->emitInt8(0); // Terminate the directory list.
385 MCOS->emitBytes(MCDwarfFiles[i].Name); // FileName and...
386 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
387 MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
388 MCOS->emitInt8(0); // Last modification timestamp (always 0).
389 MCOS->emitInt8(0); // File size (always 0).
391 MCOS->emitInt8(0); // Terminate the file list.
394 static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
399 LineStr->emitRef(MCOS, DwarfFile.Name);
401 MCOS->emitBytes(DwarfFile.Name); // FileName and...
402 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
404 MCOS->emitULEB128IntValue(DwarfFile.DirIndex); // Directory number.
407 MCOS->emitBinaryData(
412 LineStr->emitRef(MCOS, DwarfFile.Source.value_or(StringRef()));
414 MCOS->emitBytes(DwarfFile.Source.value_or(StringRef())); // Source and...
415 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
421 MCStreamer *MCOS, std::optional<MCDwarfLineStr> &LineStr) const {
425 MCOS->emitInt8(1);
426 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
427 MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
429 MCOS->emitULEB128IntValue(MCDwarfDirs.size() + 1);
432 StringRef CompDir = MCOS->getContext().getCompilationDir();
435 MCOS->getContext().remapDebugPath(Dir);
442 LineStr->emitRef(MCOS, CompDir);
444 LineStr->emitRef(MCOS, Dir);
447 MCOS->emitBytes(CompDir);
448 MCOS->emitBytes(StringRef("\0", 1));
450 MCOS->emitBytes(Dir); // The DirectoryName, and...
451 MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
463 MCOS->emitInt8(Entries);
464 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
465 MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
467 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_directory_index);
468 MCOS->emitULEB128IntValue(dwarf::DW_FORM_udata);
470 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_MD5);
471 MCOS->emitULEB128IntValue(dwarf::DW_FORM_data16);
474 MCOS->emitULEB128IntValue(dwarf::DW_LNCT_LLVM_source);
475 MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
482 MCOS->emitULEB128IntValue(MCDwarfFiles.empty() ? 1 : MCDwarfFiles.size());
487 emitOneV5FileEntry(MCOS, RootFile.Name.empty() ? MCDwarfFiles[1] : RootFile,
490 emitOneV5FileEntry(MCOS, MCDwarfFiles[i], HasAllMD5, HasAnySource, LineStr);
494 MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
497 MCContext &context = MCOS->getContext();
505 MCOS->emitDwarfLineStartLabel(LineStartSym);
509 MCSymbol *LineEndSym = MCOS->emitDwarfUnitLength("debug_line", "unit length");
513 MCOS->emitInt16(LineTableVersion);
517 MCOS->emitInt8(context.getAsmInfo()->getCodePointerSize());
518 MCOS->emitInt8(0); // Segment selector; same as EmitGenDwarfAranges.
527 MCOS->emitAbsoluteSymbolDiff(ProEndSym, ProStartSym, OffsetSize);
529 MCOS->emitLabel(ProStartSym);
532 MCOS->emitInt8(context.getAsmInfo()->getMinInstAlignment());
537 MCOS->emitInt8(1);
538 MCOS->emitInt8(DWARF2_LINE_DEFAULT_IS_STMT);
539 MCOS->emitInt8(Params.DWARF2LineBase);
540 MCOS->emitInt8(Params.DWARF2LineRange);
541 MCOS->emitInt8(StandardOpcodeLengths.size() + 1);
545 MCOS->emitInt8(Length);
550 emitV5FileDirTables(MCOS, LineStr);
552 emitV2FileDirTables(MCOS);
556 MCOS->emitLabel(ProEndSym);
561 void MCDwarfLineTable::emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
563 MCSymbol *LineEndSym = Header.Emit(MCOS, Params, LineStr).second;
567 emitOne(MCOS, LineSec.first, LineSec.second);
571 MCOS->emitLabel(LineEndSym);
674 void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
676 MCContext &Context = MCOS->getContext();
679 MCOS->emitBytes(Tmp);
773 static void EmitAbbrev(MCStreamer *MCOS, uint64_t Name, uint64_t Form) {
774 MCOS->emitULEB128IntValue(Name);
775 MCOS->emitULEB128IntValue(Form);
780 static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
781 MCContext &context = MCOS->getContext();
782 MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
785 MCOS->emitULEB128IntValue(1);
786 MCOS->emitULEB128IntValue(dwarf::DW_TAG_compile_unit);
787 MCOS->emitInt8(dwarf::DW_CHILDREN_yes);
793 EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, SecOffsetForm);
796 EmitAbbrev(MCOS, dwarf::DW_AT_ranges, SecOffsetForm);
798 EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
799 EmitAbbrev(MCOS, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr);
801 EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
803 EmitAbbrev(MCOS, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string);
806 EmitAbbrev(MCOS, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string);
807 EmitAbbrev(MCOS, dwarf::DW_AT_producer, dwarf::DW_FORM_string);
808 EmitAbbrev(MCOS, dwarf::DW_AT_language, dwarf::DW_FORM_data2);
809 EmitAbbrev(MCOS, 0, 0);
812 MCOS->emitULEB128IntValue(2);
813 MCOS->emitULEB128IntValue(dwarf::DW_TAG_label);
814 MCOS->emitInt8(dwarf::DW_CHILDREN_no);
815 EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
816 EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
817 EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
818 EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
819 EmitAbbrev(MCOS, 0, 0);
822 MCOS->emitInt8(0);
829 static void EmitGenDwarfAranges(MCStreamer *MCOS,
831 MCContext &context = MCOS->getContext();
835 MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
863 MCOS->emitInt32(dwarf::DW_LENGTH_DWARF64);
866 MCOS->emitIntValue(Length - UnitLengthBytes, OffsetSize);
868 MCOS->emitInt16(2);
872 MCOS->emitSymbolValue(InfoSectionSymbol, OffsetSize,
875 MCOS->emitIntValue(0, OffsetSize);
877 MCOS->emitInt8(AddrSize);
879 MCOS->emitInt8(0);
882 MCOS->emitInt8(0);
896 MCOS->emitValue(Addr, AddrSize);
897 emitAbsValue(*MCOS, Size, AddrSize);
901 MCOS->emitIntValue(0, AddrSize);
902 MCOS->emitIntValue(0, AddrSize);
908 static void EmitGenDwarfInfo(MCStreamer *MCOS,
912 MCContext &context = MCOS->getContext();
914 MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
919 MCOS->emitLabel(InfoStart);
930 MCOS->emitInt32(dwarf::DW_LENGTH_DWARF64);
936 emitAbsValue(*MCOS, Length, OffsetSize);
939 MCOS->emitInt16(context.getDwarfVersion());
946 MCOS->emitInt8(dwarf::DW_UT_compile);
947 MCOS->emitInt8(AddrSize);
952 MCOS->emitSymbolValue(AbbrevSectionSymbol, OffsetSize,
956 MCOS->emitIntValue(0, OffsetSize);
958 MCOS->emitInt8(AddrSize);
963 MCOS->emitULEB128IntValue(1);
968 MCOS->emitSymbolValue(LineSectionSymbol, OffsetSize,
972 MCOS->emitIntValue(0, OffsetSize);
978 MCOS->emitSymbolValue(RangesSymbol, OffsetSize);
996 MCOS->emitValue(Start, AddrSize);
1001 MCOS->emitValue(End, AddrSize);
1008 MCOS->emitBytes(MCDwarfDirs[0]);
1009 MCOS->emitBytes(sys::path::get_separator());
1019 MCOS->emitBytes(RootFile.Name);
1020 MCOS->emitInt8(0); // NULL byte to terminate the string.
1024 MCOS->emitBytes(context.getCompilationDir());
1025 MCOS->emitInt8(0); // NULL byte to terminate the string.
1031 MCOS->emitBytes(DwarfDebugFlags);
1032 MCOS->emitInt8(0); // NULL byte to terminate the string.
1038 MCOS->emitBytes(DwarfDebugProducer);
1040 MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
1041 MCOS->emitInt8(0); // NULL byte to terminate the string.
1045 MCOS->emitInt16(dwarf::DW_LANG_Mips_Assembler);
1051 MCOS->getContext().getMCGenDwarfLabelEntries();
1054 MCOS->emitULEB128IntValue(2);
1057 MCOS->emitBytes(Entry.getName());
1058 MCOS->emitInt8(0); // NULL byte to terminate the string.
1061 MCOS->emitInt32(Entry.getFileNumber());
1064 MCOS->emitInt32(Entry.getLineNumber());
1069 MCOS->emitValue(AT_low_pc, AddrSize);
1073 MCOS->emitInt8(0);
1076 MCOS->emitLabel(InfoEnd);
1082 static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
1083 MCContext &context = MCOS->getContext();
1090 if (MCOS->getContext().getDwarfVersion() >= 5) {
1091 MCOS->switchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
1092 MCSymbol *EndSymbol = mcdwarf::emitListsTableHeaderStart(*MCOS);
1093 MCOS->AddComment("Offset entry count");
1094 MCOS->emitInt32(0);
1096 MCOS->emitLabel(RangesSymbol);
1104 MCOS->emitInt8(dwarf::DW_RLE_start_length);
1105 MCOS->emitValue(SectionStartAddr, AddrSize);
1106 MCOS->emitULEB128Value(SectionSize);
1108 MCOS->emitInt8(dwarf::DW_RLE_end_of_list);
1109 MCOS->emitLabel(EndSymbol);
1111 MCOS->switchSection(context.getObjectFileInfo()->getDwarfRangesSection());
1113 MCOS->emitLabel(RangesSymbol);
1121 MCOS->emitFill(AddrSize, 0xFF);
1122 MCOS->emitValue(SectionStartAddr, AddrSize);
1127 MCOS->emitIntValue(0, AddrSize);
1128 emitAbsValue(*MCOS, SectionSize, AddrSize);
1132 MCOS->emitIntValue(0, AddrSize);
1133 MCOS->emitIntValue(0, AddrSize);
1143 void MCGenDwarfInfo::Emit(MCStreamer *MCOS) {
1144 MCContext &context = MCOS->getContext();
1152 LineSectionSymbol = MCOS->getDwarfLineTableSymbol(0);
1158 MCOS->getContext().finalizeDwarfSections(*MCOS);
1162 if (MCOS->getContext().getGenDwarfSectionSyms().empty())
1168 MCOS->getContext().getGenDwarfSectionSyms().size() > 1 &&
1169 MCOS->getContext().getDwarfVersion() >= 3;
1172 MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
1175 MCOS->emitLabel(InfoSectionSymbol);
1177 MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
1180 MCOS->emitLabel(AbbrevSectionSymbol);
1183 MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
1186 EmitGenDwarfAranges(MCOS, InfoSectionSymbol);
1189 RangesSymbol = emitGenDwarfRanges(MCOS);
1194 EmitGenDwarfAbbrev(MCOS);
1197 EmitGenDwarfInfo(MCOS, AbbrevSectionSymbol, LineSectionSymbol, RangesSymbol);
1206 void MCGenDwarfLabelEntry::Make(MCSymbol *Symbol, MCStreamer *MCOS,
1211 MCContext &context = MCOS->getContext();
1214 if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSectionOnly()))
1236 MCOS->emitLabel(Label);
1239 MCOS->getContext().addMCGenDwarfLabelEntry(