mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 04:33:40 +00:00
DebugInfo: Avoid emitting standard opcode lengths in debug_line.dwo headers where opcodes are never used anyway
Introduce a slightly tighter wrapper around the header structure that handles this use case. (MCDwarfDwoLineTable) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204101 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c1e56a84d
commit
c5b39af329
@ -15,6 +15,7 @@
|
|||||||
#ifndef LLVM_MC_MCDWARF_H
|
#ifndef LLVM_MC_MCDWARF_H
|
||||||
#define LLVM_MC_MCDWARF_H
|
#define LLVM_MC_MCDWARF_H
|
||||||
|
|
||||||
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
#include "llvm/ADT/MapVector.h"
|
#include "llvm/ADT/MapVector.h"
|
||||||
@ -187,6 +188,17 @@ struct MCDwarfLineTableHeader {
|
|||||||
unsigned getFile(StringRef &Directory, StringRef &FileName,
|
unsigned getFile(StringRef &Directory, StringRef &FileName,
|
||||||
unsigned FileNumber = 0);
|
unsigned FileNumber = 0);
|
||||||
std::pair<MCSymbol *, MCSymbol *> Emit(MCStreamer *MCOS) const;
|
std::pair<MCSymbol *, MCSymbol *> Emit(MCStreamer *MCOS) const;
|
||||||
|
std::pair<MCSymbol *, MCSymbol *>
|
||||||
|
Emit(MCStreamer *MCOS, ArrayRef<char> SpecialOpcodeLengths) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MCDwarfDwoLineTable {
|
||||||
|
MCDwarfLineTableHeader Header;
|
||||||
|
public:
|
||||||
|
unsigned getFile(StringRef Directory, StringRef FileName) {
|
||||||
|
return Header.getFile(Directory, FileName);
|
||||||
|
}
|
||||||
|
void Emit(MCStreamer &MCOS) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MCDwarfLineTable {
|
class MCDwarfLineTable {
|
||||||
|
@ -2684,7 +2684,7 @@ void DwarfDebug::emitDebugLineDWO() {
|
|||||||
assert(useSplitDwarf() && "No split dwarf?");
|
assert(useSplitDwarf() && "No split dwarf?");
|
||||||
Asm->OutStreamer.SwitchSection(
|
Asm->OutStreamer.SwitchSection(
|
||||||
Asm->getObjFileLowering().getDwarfLineDWOSection());
|
Asm->getObjFileLowering().getDwarfLineDWOSection());
|
||||||
Asm->OutStreamer.EmitLabel(SplitTypeUnitFileTable.Emit(&Asm->OutStreamer).second);
|
SplitTypeUnitFileTable.Emit(Asm->OutStreamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the .debug_str.dwo section for separated dwarf. This contains the
|
// Emit the .debug_str.dwo section for separated dwarf. This contains the
|
||||||
|
@ -489,7 +489,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
|
|
||||||
// Store file names for type units under fission in a line table header that
|
// Store file names for type units under fission in a line table header that
|
||||||
// will be emitted into debug_line.dwo.
|
// will be emitted into debug_line.dwo.
|
||||||
MCDwarfLineTableHeader SplitTypeUnitFileTable;
|
MCDwarfDwoLineTable SplitTypeUnitFileTable;
|
||||||
|
|
||||||
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ DwarfCompileUnit::DwarfCompileUnit(unsigned UID, DIE *D, DICompileUnit Node,
|
|||||||
|
|
||||||
DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU,
|
DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU,
|
||||||
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU,
|
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU,
|
||||||
MCDwarfLineTableHeader *SplitLineTable)
|
MCDwarfDwoLineTable *SplitLineTable)
|
||||||
: DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU),
|
: DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU),
|
||||||
SplitLineTable(SplitLineTable) {
|
SplitLineTable(SplitLineTable) {
|
||||||
if (SplitLineTable)
|
if (SplitLineTable)
|
||||||
|
@ -616,12 +616,12 @@ private:
|
|||||||
uint64_t TypeSignature;
|
uint64_t TypeSignature;
|
||||||
const DIE *Ty;
|
const DIE *Ty;
|
||||||
DwarfCompileUnit &CU;
|
DwarfCompileUnit &CU;
|
||||||
MCDwarfLineTableHeader *SplitLineTable;
|
MCDwarfDwoLineTable *SplitLineTable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU, AsmPrinter *A,
|
DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU, AsmPrinter *A,
|
||||||
DwarfDebug *DW, DwarfFile *DWU,
|
DwarfDebug *DW, DwarfFile *DWU,
|
||||||
MCDwarfLineTableHeader *SplitLineTable = nullptr);
|
MCDwarfDwoLineTable *SplitLineTable = nullptr);
|
||||||
|
|
||||||
void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
|
void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
|
||||||
uint64_t getTypeSignature() const { return TypeSignature; }
|
uint64_t getTypeSignature() const { return TypeSignature; }
|
||||||
|
@ -224,7 +224,33 @@ const MCSymbol *MCDwarfLineTable::Emit(MCStreamer *MCOS) {
|
|||||||
return LineStartSym;
|
return LineStartSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS) const {
|
||||||
|
MCOS.EmitLabel(Header.Emit(&MCOS, None).second);
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<MCSymbol *, MCSymbol *> MCDwarfLineTableHeader::Emit(MCStreamer *MCOS) const {
|
std::pair<MCSymbol *, MCSymbol *> MCDwarfLineTableHeader::Emit(MCStreamer *MCOS) const {
|
||||||
|
static const char StandardOpcodeLengths[] = {
|
||||||
|
0, // length of DW_LNS_copy
|
||||||
|
1, // length of DW_LNS_advance_pc
|
||||||
|
1, // length of DW_LNS_advance_line
|
||||||
|
1, // length of DW_LNS_set_file
|
||||||
|
1, // length of DW_LNS_set_column
|
||||||
|
0, // length of DW_LNS_negate_stmt
|
||||||
|
0, // length of DW_LNS_set_basic_block
|
||||||
|
0, // length of DW_LNS_const_add_pc
|
||||||
|
1, // length of DW_LNS_fixed_advance_pc
|
||||||
|
0, // length of DW_LNS_set_prologue_end
|
||||||
|
0, // length of DW_LNS_set_epilogue_begin
|
||||||
|
1 // DW_LNS_set_isa
|
||||||
|
};
|
||||||
|
assert(array_lengthof(StandardOpcodeLengths) == (DWARF2_LINE_OPCODE_BASE - 1));
|
||||||
|
return Emit(MCOS, StandardOpcodeLengths);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<MCSymbol *, MCSymbol *>
|
||||||
|
MCDwarfLineTableHeader::Emit(MCStreamer *MCOS,
|
||||||
|
ArrayRef<char> StandardOpcodeLengths) const {
|
||||||
|
|
||||||
MCContext &context = MCOS->getContext();
|
MCContext &context = MCOS->getContext();
|
||||||
|
|
||||||
// Create a symbol at the beginning of the line table.
|
// Create a symbol at the beginning of the line table.
|
||||||
@ -260,21 +286,11 @@ std::pair<MCSymbol *, MCSymbol *> MCDwarfLineTableHeader::Emit(MCStreamer *MCOS)
|
|||||||
MCOS->EmitIntValue(DWARF2_LINE_DEFAULT_IS_STMT, 1);
|
MCOS->EmitIntValue(DWARF2_LINE_DEFAULT_IS_STMT, 1);
|
||||||
MCOS->EmitIntValue(DWARF2_LINE_BASE, 1);
|
MCOS->EmitIntValue(DWARF2_LINE_BASE, 1);
|
||||||
MCOS->EmitIntValue(DWARF2_LINE_RANGE, 1);
|
MCOS->EmitIntValue(DWARF2_LINE_RANGE, 1);
|
||||||
MCOS->EmitIntValue(DWARF2_LINE_OPCODE_BASE, 1);
|
MCOS->EmitIntValue(StandardOpcodeLengths.size() + 1, 1);
|
||||||
|
|
||||||
// Standard opcode lengths
|
// Standard opcode lengths
|
||||||
MCOS->EmitIntValue(0, 1); // length of DW_LNS_copy
|
for (char Length : StandardOpcodeLengths)
|
||||||
MCOS->EmitIntValue(1, 1); // length of DW_LNS_advance_pc
|
MCOS->EmitIntValue(Length, 1);
|
||||||
MCOS->EmitIntValue(1, 1); // length of DW_LNS_advance_line
|
|
||||||
MCOS->EmitIntValue(1, 1); // length of DW_LNS_set_file
|
|
||||||
MCOS->EmitIntValue(1, 1); // length of DW_LNS_set_column
|
|
||||||
MCOS->EmitIntValue(0, 1); // length of DW_LNS_negate_stmt
|
|
||||||
MCOS->EmitIntValue(0, 1); // length of DW_LNS_set_basic_block
|
|
||||||
MCOS->EmitIntValue(0, 1); // length of DW_LNS_const_add_pc
|
|
||||||
MCOS->EmitIntValue(1, 1); // length of DW_LNS_fixed_advance_pc
|
|
||||||
MCOS->EmitIntValue(0, 1); // length of DW_LNS_set_prologue_end
|
|
||||||
MCOS->EmitIntValue(0, 1); // length of DW_LNS_set_epilogue_begin
|
|
||||||
MCOS->EmitIntValue(1, 1); // DW_LNS_set_isa
|
|
||||||
|
|
||||||
// Put out the directory and file tables.
|
// Put out the directory and file tables.
|
||||||
|
|
||||||
|
@ -141,6 +141,8 @@
|
|||||||
|
|
||||||
; CHECK-LABEL: .debug_line.dwo contents:
|
; CHECK-LABEL: .debug_line.dwo contents:
|
||||||
; FISSION: Line table prologue
|
; FISSION: Line table prologue
|
||||||
|
; FISSION: opcode_base: 1
|
||||||
|
; FISSION-NOT: standard_opcode_lengths
|
||||||
; FISSION-NOT: file_names[
|
; FISSION-NOT: file_names[
|
||||||
; FISSION: file_names{{.*}} bar.h
|
; FISSION: file_names{{.*}} bar.h
|
||||||
; FISSION: file_names{{.*}} bar.cpp
|
; FISSION: file_names{{.*}} bar.cpp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user