diff options
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfUnit.h')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfUnit.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h index 0ee1aade64..89fbd307a8 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -31,6 +31,31 @@ class ConstantInt; class ConstantFP; class DbgVariable; +// Data structure to hold a range for range lists. +class RangeSpan { +public: + RangeSpan(MCSymbol *S, MCSymbol *E) : Start(S), End(E) {} + const MCSymbol *getStart() { return Start; } + const MCSymbol *getEnd() { return End; } + +private: + const MCSymbol *Start, *End; +}; + +class RangeSpanList { +private: + // Index for locating within the debug_range section this particular span. + unsigned Index; + // List of ranges. + SmallVector<RangeSpan, 2> Ranges; + +public: + RangeSpanList(unsigned Idx) : Index(Idx) {} + unsigned getIndex() const { return Index; } + const SmallVectorImpl<RangeSpan> &getRanges() const { return Ranges; } + void addRange(RangeSpan Range) { Ranges.push_back(Range); } +}; + //===----------------------------------------------------------------------===// /// Unit - This dwarf writer support class manages information associated /// with a source file. @@ -92,6 +117,10 @@ protected: /// corresponds to the MDNode mapped with the subprogram DIE. DenseMap<DIE *, const MDNode *> ContainingTypeMap; + // List of range lists for a given compile unit, separate from the ranges for + // the CU itself. + SmallVector<RangeSpanList *, 1> CURangeLists; + // DIEValueAllocator - All DIEValues are allocated through this allocator. BumpPtrAllocator DIEValueAllocator; @@ -132,6 +161,15 @@ public: /// hasContent - Return true if this compile unit has something to write out. bool hasContent() const { return !UnitDie->getChildren().empty(); } + /// addRangeList - Add an address range list to the list of range lists. + void addRangeList(RangeSpanList *Ranges) { CURangeLists.push_back(Ranges); } + + /// getRangeLists - Get the vector of range lists. + const SmallVectorImpl<RangeSpanList *> &getRangeLists() const { + return CURangeLists; + } + SmallVectorImpl<RangeSpanList *> &getRangeLists() { return CURangeLists; } + /// getParentContextString - Get a string containing the language specific /// context for a global name. std::string getParentContextString(DIScope Context) const; |