summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-08-15 15:54:43 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-08-15 15:54:43 +0000
commite1c30f74f7b974daed175db8a73d83ef659c1162 (patch)
treecee0a3deffb7a4501c90a7bc5090e39604e97e1c /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
parenteb2f5f3256f45696c933e83e376c0848e8fea943 (diff)
downloadbcm5719-llvm-e1c30f74f7b974daed175db8a73d83ef659c1162.tar.gz
bcm5719-llvm-e1c30f74f7b974daed175db8a73d83ef659c1162.zip
[llvm-dwarfdump] - Refactor section name/uniqueness gathering.
As was requested in D36313 thread, with this patch section names and uniqueness calculated once, and not every time when a range is dumped. Differential revision: https://reviews.llvm.org/D36740 llvm-svn: 310923
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 703fc894918..eaf26bfa295 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -934,6 +934,7 @@ class DWARFObjInMemory final : public DWARFObject {
uint8_t AddressSize;
StringRef FileName;
const object::ObjectFile *Obj = nullptr;
+ std::vector<SectionName> SectionNames;
using TypeSectionMap = MapVector<object::SectionRef, DWARFSectionMap,
std::map<object::SectionRef, unsigned>>;
@@ -1055,9 +1056,13 @@ public:
AddressSize(Obj.getBytesInAddress()), FileName(Obj.getFileName()),
Obj(&Obj) {
+ StringMap<unsigned> SectionAmountMap;
for (const SectionRef &Section : Obj.sections()) {
StringRef Name;
Section.getName(Name);
+ ++SectionAmountMap[Name];
+ SectionNames.push_back({ Name, true });
+
// Skip BSS and Virtual sections, they aren't interesting.
if (Section.isBSS() || Section.isVirtual())
continue;
@@ -1179,6 +1184,10 @@ public:
Map->insert({Reloc.getOffset(), Rel});
}
}
+
+ for (SectionName &S : SectionNames)
+ if (SectionAmountMap[S.Name] > 1)
+ S.IsNameUnique = false;
}
Optional<RelocAddrEntry> find(const DWARFSection &S,
@@ -1192,6 +1201,10 @@ public:
const object::ObjectFile *getFile() const override { return Obj; }
+ ArrayRef<SectionName> getSectionNames() const override {
+ return SectionNames;
+ }
+
bool isLittleEndian() const override { return IsLittleEndian; }
StringRef getAbbrevDWOSection() const override { return AbbrevDWOSection; }
const DWARFSection &getLineDWOSection() const override {
OpenPOWER on IntegriCloud