summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-12-04 19:06:58 +0000
committerEric Christopher <echristo@gmail.com>2013-12-04 19:06:58 +0000
commit270ba4a5d355d5b605da4d24ac02e71858fd9df2 (patch)
tree4b82c4fd299f515f04f58b5ee3ceeffad0a2993f /llvm/lib
parentc6931fcf49607daad21aa36118f860a2e8186ef1 (diff)
downloadbcm5719-llvm-270ba4a5d355d5b605da4d24ac02e71858fd9df2.tar.gz
bcm5719-llvm-270ba4a5d355d5b605da4d24ac02e71858fd9df2.zip
Use move and stack allocation for RangeSpanLists. As a result make
a few things more const as well because we're now using const references to refer to iterators. llvm-svn: 196398
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp22
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h12
3 files changed, 17 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index be585dc03e7..5e6d37328ef 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -471,17 +471,17 @@ void DwarfDebug::addScopeRangeList(CompileUnit *TheCU, DIE *ScopeDIE,
// emitting it appropriately.
TheCU->addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges,
Asm->GetTempSymbol("debug_ranges", GlobalRangeCount));
- RangeSpanList *List = new RangeSpanList(GlobalRangeCount++);
+ RangeSpanList List(GlobalRangeCount++);
for (SmallVectorImpl<InsnRange>::const_iterator RI = Range.begin(),
RE = Range.end();
RI != RE; ++RI) {
RangeSpan Span(getLabelBeforeInsn(RI->first),
getLabelAfterInsn(RI->second));
- List->addRange(Span);
+ List.addRange(llvm_move(Span));
}
// Add the range list to the set of ranges to be emitted.
- TheCU->addRangeList(List);
+ TheCU->addRangeList(llvm_move(List));
}
// Construct new DW_TAG_lexical_block for this scope and attach
@@ -2938,22 +2938,22 @@ void DwarfDebug::emitDebugRanges() {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("gnu_ranges", ID));
// Iterate over the misc ranges for the compile units in the module.
- const SmallVectorImpl<RangeSpanList *> &RangeLists = TheCU->getRangeLists();
- for (SmallVectorImpl<RangeSpanList *>::const_iterator
+ const SmallVectorImpl<RangeSpanList> &RangeLists = TheCU->getRangeLists();
+ for (SmallVectorImpl<RangeSpanList>::const_iterator
I = RangeLists.begin(),
E = RangeLists.end();
I != E; ++I) {
- RangeSpanList *List = *I;
+ const RangeSpanList &List = *I;
// Emit a symbol so we can find the beginning of the range.
Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol("debug_ranges", List->getIndex()));
+ Asm->GetTempSymbol("debug_ranges", List.getIndex()));
for (SmallVectorImpl<RangeSpan>::const_iterator
- I = List->getRanges().begin(),
- E = List->getRanges().end();
- I != E; ++I) {
- RangeSpan Range = *I;
+ RI = List.getRanges().begin(),
+ RE = List.getRanges().end();
+ RI != RE; ++RI) {
+ const RangeSpan &Range = *RI;
// We occasionally have ranges without begin/end labels.
// FIXME: Verify and fix.
const MCSymbol *Begin = Range.getStart();
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index d3504f8a8f6..d93f46e80d8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -59,10 +59,6 @@ TypeUnit::TypeUnit(unsigned UID, DIE *D, uint16_t Language, AsmPrinter *A,
Unit::~Unit() {
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
DIEBlocks[j]->~DIEBlock();
- for (SmallVectorImpl<RangeSpanList *>::iterator RI = getRangeLists().begin(),
- RE = getRangeLists().end();
- RI != RE; ++RI)
- delete *RI;
}
/// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 89fbd307a85..ce9faf02509 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -35,8 +35,8 @@ class DbgVariable;
class RangeSpan {
public:
RangeSpan(MCSymbol *S, MCSymbol *E) : Start(S), End(E) {}
- const MCSymbol *getStart() { return Start; }
- const MCSymbol *getEnd() { return End; }
+ const MCSymbol *getStart() const { return Start; }
+ const MCSymbol *getEnd() const { return End; }
private:
const MCSymbol *Start, *End;
@@ -119,7 +119,7 @@ protected:
// List of range lists for a given compile unit, separate from the ranges for
// the CU itself.
- SmallVector<RangeSpanList *, 1> CURangeLists;
+ SmallVector<RangeSpanList, 1> CURangeLists;
// DIEValueAllocator - All DIEValues are allocated through this allocator.
BumpPtrAllocator DIEValueAllocator;
@@ -162,13 +162,13 @@ public:
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); }
+ void addRangeList(RangeSpanList Ranges) { CURangeLists.push_back(Ranges); }
/// getRangeLists - Get the vector of range lists.
- const SmallVectorImpl<RangeSpanList *> &getRangeLists() const {
+ const SmallVectorImpl<RangeSpanList> &getRangeLists() const {
return CURangeLists;
}
- SmallVectorImpl<RangeSpanList *> &getRangeLists() { return CURangeLists; }
+ SmallVectorImpl<RangeSpanList> &getRangeLists() { return CURangeLists; }
/// getParentContextString - Get a string containing the language specific
/// context for a global name.
OpenPOWER on IntegriCloud