[lld] r243980 - Remove SymbolTable::getChunks.
Rafael Espindola
rafael.espindola at gmail.com
Tue Aug 4 06:39:31 PDT 2015
Author: rafael
Date: Tue Aug 4 08:39:30 2015
New Revision: 243980
URL: http://llvm.org/viewvc/llvm-project?rev=243980&view=rev
Log:
Remove SymbolTable::getChunks.
When we were using a std::sort over all the chunks we needed to put them in a
single storage.
Now that we just iterate over them and use a map to find the output section,
we can avoid allocating the temporary storage.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=243980&r1=243979&r2=243980&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Aug 4 08:39:30 2015
@@ -68,15 +68,6 @@ template <class ELFT> void SymbolTable<E
error(Twine("duplicate symbol: ") + Name);
}
-template <class ELFT> std::vector<Chunk *> SymbolTable<ELFT>::getChunks() {
- std::vector<Chunk *> Res;
- for (std::unique_ptr<ObjectFile<ELFT>> &File : ObjectFiles) {
- ArrayRef<Chunk *> V = File->getChunks();
- Res.insert(Res.end(), V.begin(), V.end());
- }
- return Res;
-}
-
namespace lld {
namespace elf2 {
template class SymbolTable<object::ELF32LE>;
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=243980&r1=243979&r2=243980&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Tue Aug 4 08:39:30 2015
@@ -38,9 +38,6 @@ public:
// Print an error message on undefined symbols.
void reportRemainingUndefines();
- // Returns a list of chunks of selected symbols.
- std::vector<Chunk *> getChunks();
-
// The writer needs to infer the machine type from the object files.
std::vector<std::unique_ptr<ObjectFile<ELFT>>> ObjectFiles;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=243980&r1=243979&r2=243980&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Aug 4 08:39:30 2015
@@ -81,13 +81,15 @@ void OutputSection::writeHeaderTo(Elf_Sh
// Create output section objects and add them to OutputSections.
template <class ELFT> void Writer<ELFT>::createSections() {
SmallDenseMap<StringRef, OutputSection *> Map;
- for (Chunk *C : Symtab->getChunks()) {
- OutputSection *&Sec = Map[C->getSectionName()];
- if (!Sec) {
- Sec = new (CAlloc.Allocate()) OutputSection(C->getSectionName());
- OutputSections.push_back(Sec);
+ for (std::unique_ptr<ObjectFile<ELFT>> &File : Symtab->ObjectFiles) {
+ for (Chunk *C : File->getChunks()) {
+ OutputSection *&Sec = Map[C->getSectionName()];
+ if (!Sec) {
+ Sec = new (CAlloc.Allocate()) OutputSection(C->getSectionName());
+ OutputSections.push_back(Sec);
+ }
+ Sec->addChunk<ELFT>(C);
}
- Sec->addChunk<ELFT>(C);
}
}
More information about the llvm-commits
mailing list