summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfUnit.h
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-12-03 00:45:45 +0000
committerEric Christopher <echristo@gmail.com>2013-12-03 00:45:45 +0000
commitc2efbdbb6022149b6b94188efd85b72abe19b0ba (patch)
treeda11ff9b576fd28cfe21ac1989c0bce49cfc9336 /lib/CodeGen/AsmPrinter/DwarfUnit.h
parent357fcf9d2ea79d43e4a1a29edb8608225c8f9a54 (diff)
downloadllvm-c2efbdbb6022149b6b94188efd85b72abe19b0ba.tar.gz
llvm-c2efbdbb6022149b6b94188efd85b72abe19b0ba.tar.bz2
llvm-c2efbdbb6022149b6b94188efd85b72abe19b0ba.tar.xz
Make ranges and range lists be a discrete entity that can be located
and emitted per function and CU. Begins coalescing ranges as a first class entity through debug info. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196178 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfUnit.h')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfUnit.h38
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;