mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-07 03:40:35 +00:00
Remove what looks like dead code in the production of debug lines.
We only produce debug line information if we have seen a line directive, so this code is dead. Also, if we want to be bug by bug compatible with gas and sometimes produce "empty" .debug_line sections, this will match the content produced by gas. llvm-svn: 118914
This commit is contained in:
parent
68d533cca4
commit
77cad43f26
@ -135,7 +135,7 @@ static inline void EmitDwarfSetAddress(MCObjectStreamer *MCOS,
|
||||
// This emits the Dwarf line table for the specified section from the entries
|
||||
// in the LineSection.
|
||||
//
|
||||
static inline bool EmitDwarfLineTable(MCObjectStreamer *MCOS,
|
||||
static inline void EmitDwarfLineTable(MCObjectStreamer *MCOS,
|
||||
const MCSection *Section,
|
||||
MCLineSection *LineSection,
|
||||
const MCSection *DwarfLineSection) {
|
||||
@ -144,7 +144,6 @@ static inline bool EmitDwarfLineTable(MCObjectStreamer *MCOS,
|
||||
unsigned Column = 0;
|
||||
unsigned Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0;
|
||||
unsigned Isa = 0;
|
||||
bool EmittedLineTable = false;
|
||||
MCSymbol *LastLabel = NULL;
|
||||
MCSectionData &DLS =
|
||||
MCOS->getAssembler().getOrCreateSectionData(*DwarfLineSection);
|
||||
@ -202,7 +201,6 @@ static inline bool EmitDwarfLineTable(MCObjectStreamer *MCOS,
|
||||
|
||||
LastLine = it->getLine();
|
||||
LastLabel = Label;
|
||||
EmittedLineTable = true;
|
||||
}
|
||||
|
||||
// Emit a DW_LNE_end_sequence for the end of the section.
|
||||
@ -226,8 +224,6 @@ static inline bool EmitDwarfLineTable(MCObjectStreamer *MCOS,
|
||||
0);
|
||||
// Create a Dwarf Line fragment for the LineDelta and AddrDelta.
|
||||
new MCDwarfLineAddrFragment(INT64_MAX, *AddrDelta, &DLS);
|
||||
|
||||
return EmittedLineTable;
|
||||
}
|
||||
|
||||
//
|
||||
@ -315,56 +311,17 @@ void MCDwarfFileTable::Emit(MCObjectStreamer *MCOS,
|
||||
MCOS->EmitLabel(ProEndSym);
|
||||
|
||||
// Put out the line tables.
|
||||
bool EmittedLineTable = false;
|
||||
DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
|
||||
MCOS->getContext().getMCLineSections();
|
||||
for (DenseMap<const MCSection *, MCLineSection *>::iterator it =
|
||||
MCLineSections.begin(), ie = MCLineSections.end(); it != ie; ++it) {
|
||||
EmittedLineTable = EmitDwarfLineTable(MCOS, it->first, it->second,
|
||||
DwarfLineSection);
|
||||
EmitDwarfLineTable(MCOS, it->first, it->second, DwarfLineSection);
|
||||
|
||||
// Now delete the MCLineSections that were created in MCLineEntry::Make()
|
||||
// and used to emit the line table.
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
// If there are no line tables emited then we emit:
|
||||
// The following DW_LNE_set_address sequence to set the address to zero and
|
||||
// the DW_LNE_end_sequence.
|
||||
if (EmittedLineTable == false) {
|
||||
if (MCOS->getAssembler().getBackend().getPointerSize() == 8) {
|
||||
// This is the DW_LNE_set_address sequence for 64-bit code.
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(9, 1);
|
||||
MCOS->EmitIntValue(2, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
}
|
||||
else {
|
||||
// This is the DW_LNE_set_address sequence for 32-bit code.
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(5, 1);
|
||||
MCOS->EmitIntValue(2, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
MCOS->EmitIntValue(0, 1);
|
||||
}
|
||||
|
||||
// Lastly emit the DW_LNE_end_sequence which consists of 3 bytes '00 01 01'
|
||||
// (00 is the code for extended opcodes, followed by a ULEB128 length of the
|
||||
// extended opcode (01), and the DW_LNE_end_sequence (01).
|
||||
MCOS->EmitIntValue(0, 1); // DW_LNS_extended_op
|
||||
MCOS->EmitIntValue(1, 1); // ULEB128 length of the extended opcode
|
||||
MCOS->EmitIntValue(1, 1); // DW_LNE_end_sequence
|
||||
}
|
||||
|
||||
// This is the end of the section, so set the value of the symbol at the end
|
||||
// of this section (that was used in a previous expression).
|
||||
MCOS->EmitLabel(LineEndSym);
|
||||
|
Loading…
Reference in New Issue
Block a user