diff options
author | Eric Christopher <echristo@gmail.com> | 2014-03-20 19:16:16 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2014-03-20 19:16:16 +0000 |
commit | 384f3feb2dcaf5d8f91b3b48567bb2869f16b1fd (patch) | |
tree | bf0aabfa16d0e180469cb71e7b6bc30c53586240 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | |
parent | d4576318b4d79761af02ab932c55b2963ef4aae3 (diff) | |
download | bcm5719-llvm-384f3feb2dcaf5d8f91b3b48567bb2869f16b1fd.tar.gz bcm5719-llvm-384f3feb2dcaf5d8f91b3b48567bb2869f16b1fd.zip |
Reapply DW_AT_low/high_pc patch:
Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc.
This commit moves us from a single range per subprogram to extending
ranges if we are:
a) In the same section, and
b) In the same enclosing CU.
This means we have more fine grained ranges for compile units, and fewer
ranges overall when we have multiple functions in the same CU
adjacent to each other in the object file.
Also remove all of the earlier hacks around this functionality for
function sections etc. Also update all of the testcases to take into
account the merging functionality.
with a fix for location entries in the debug_loc section:
Make sure that debug loc entries are relative to the low_pc
of the compile unit. This means that when we only have a single
range that the offset should be just relative to the low_pc
of the unit, for multiple ranges for a CU this means that we'll be
relative to 0 which we emit along with DW_AT_ranges.
This mostly shows up with linked binaries, so add a testcase with
multiple CUs so that our location is going to be offset of a CU
with a non-zero low_pc.
llvm-svn: 204377
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 73150442c67..09ae489c40d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -81,31 +81,37 @@ class DebugLocEntry { // The variable to which this location entry corresponds. const MDNode *Variable; + // The compile unit to which this location entry is referenced by. + const DwarfCompileUnit *Unit; + // Whether this location has been merged. bool Merged; public: - DebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) { + DebugLocEntry() : Begin(0), End(0), Variable(0), Unit(0), Merged(false) { Constants.Int = 0; } DebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L, - const MDNode *V) - : Begin(B), End(E), Loc(L), Variable(V), Merged(false) { + const MDNode *V, const DwarfCompileUnit *U) + : Begin(B), End(E), Loc(L), Variable(V), Unit(U), Merged(false) { Constants.Int = 0; EntryKind = E_Location; } - DebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i) - : Begin(B), End(E), Variable(0), Merged(false) { + DebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i, + const DwarfCompileUnit *U) + : Begin(B), End(E), Variable(0), Unit(U), Merged(false) { Constants.Int = i; EntryKind = E_Integer; } - DebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr) - : Begin(B), End(E), Variable(0), Merged(false) { + DebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr, + const DwarfCompileUnit *U) + : Begin(B), End(E), Variable(0), Unit(U), Merged(false) { Constants.CFP = FPtr; EntryKind = E_ConstantFP; } - DebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantInt *IPtr) - : Begin(B), End(E), Variable(0), Merged(false) { + DebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantInt *IPtr, + const DwarfCompileUnit *U) + : Begin(B), End(E), Variable(0), Unit(U), Merged(false) { Constants.CIP = IPtr; EntryKind = E_ConstantInt; } @@ -130,6 +136,7 @@ public: const MDNode *getVariable() const { return Variable; } const MCSymbol *getBeginSym() const { return Begin; } const MCSymbol *getEndSym() const { return End; } + const DwarfCompileUnit *getCU() const { return Unit; } MachineLocation getLoc() const { return Loc; } }; @@ -406,6 +413,13 @@ class DwarfDebug : public AsmPrinterHandler { // If nonnull, stores the current machine instruction we're processing. const MachineInstr *CurMI; + // If nonnull, stores the section that the previous function was allocated to + // emitting. + const MCSection *PrevSection; + + // If nonnull, stores the CU in which the previous subprogram was contained. + const DwarfCompileUnit *PrevCU; + // Section Symbols: these are assembler temporary labels that are emitted at // the beginning of each supported dwarf section. These are used to form // section offsets and are created by EmitSectionLabels. @@ -741,15 +755,18 @@ public: /// split dwarf proposal support. bool useSplitDwarf() const { return HasSplitDwarf; } - /// \brief Returns whether or not to use AT_ranges for compilation units. - bool useCURanges() const { return HasCURanges; } - /// Returns the Dwarf Version. unsigned getDwarfVersion() const { return DwarfVersion; } /// Returns the section symbol for the .debug_loc section. MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; } + /// Returns the previous section that was emitted into. + const MCSection *getPrevSection() const { return PrevSection; } + + /// Returns the previous CU that was being updated + const DwarfCompileUnit *getPrevCU() const { return PrevCU; } + /// Returns the entries for the .debug_loc section. const SmallVectorImpl<DebugLocEntry> &getDebugLocEntries() const { return DotDebugLocEntries; |