[ELF] Use SmallVector for some global variables (*Files and *Sections). NFC
My lld executable is 26+KiB smaller.
This commit is contained in:
1 parent
856550ca79
commit
ba948c5a9c
7 files changed
+17
-17
No files matched your search
@@ -43,12 +43,12 @@ using namespace lld::elf;
|
||||
bool InputFile::isInGroup;
|
||||
uint32_t InputFile::nextGroupId;
|
||||
|
||||
std::vector<ArchiveFile *> elf::archiveFiles;
|
||||
std::vector<BinaryFile *> elf::binaryFiles;
|
||||
std::vector<BitcodeFile *> elf::bitcodeFiles;
|
||||
std::vector<BitcodeFile *> elf::lazyBitcodeFiles;
|
||||
std::vector<ELFFileBase *> elf::objectFiles;
|
||||
std::vector<SharedFile *> elf::sharedFiles;
|
||||
SmallVector<ArchiveFile *, 0> elf::archiveFiles;
|
||||
SmallVector<BinaryFile *, 0> elf::binaryFiles;
|
||||
SmallVector<BitcodeFile *, 0> elf::bitcodeFiles;
|
||||
SmallVector<BitcodeFile *, 0> elf::lazyBitcodeFiles;
|
||||
SmallVector<ELFFileBase *, 0> elf::objectFiles;
|
||||
SmallVector<SharedFile *, 0> elf::sharedFiles;
|
||||
|
||||
std::unique_ptr<TarWriter> elf::tar;
|
||||
|
||||
|
||||
@@ -396,12 +396,12 @@ inline bool isBitcode(MemoryBufferRef mb) {
|
||||
|
||||
std::string replaceThinLTOSuffix(StringRef path);
|
||||
|
||||
extern std::vector<ArchiveFile *> archiveFiles;
|
||||
extern std::vector<BinaryFile *> binaryFiles;
|
||||
extern std::vector<BitcodeFile *> bitcodeFiles;
|
||||
extern std::vector<BitcodeFile *> lazyBitcodeFiles;
|
||||
extern std::vector<ELFFileBase *> objectFiles;
|
||||
extern std::vector<SharedFile *> sharedFiles;
|
||||
extern SmallVector<ArchiveFile *, 0> archiveFiles;
|
||||
extern SmallVector<BinaryFile *, 0> binaryFiles;
|
||||
extern SmallVector<BitcodeFile *, 0> bitcodeFiles;
|
||||
extern SmallVector<BitcodeFile *, 0> lazyBitcodeFiles;
|
||||
extern SmallVector<ELFFileBase *, 0> objectFiles;
|
||||
extern SmallVector<SharedFile *, 0> sharedFiles;
|
||||
|
||||
} // namespace elf
|
||||
} // namespace lld
|
||||
|
||||
@@ -40,7 +40,7 @@ using namespace llvm::sys;
|
||||
using namespace lld;
|
||||
using namespace lld::elf;
|
||||
|
||||
std::vector<InputSectionBase *> elf::inputSections;
|
||||
SmallVector<InputSectionBase *, 0> elf::inputSections;
|
||||
DenseSet<std::pair<const Symbol *, uint64_t>> elf::ppc64noTocRelax;
|
||||
|
||||
// Returns a string to construct an error message.
|
||||
|
||||
@@ -394,7 +394,7 @@ inline bool isDebugSection(const InputSectionBase &sec) {
|
||||
}
|
||||
|
||||
// The list of all input sections.
|
||||
extern std::vector<InputSectionBase *> inputSections;
|
||||
extern SmallVector<InputSectionBase *, 0> inputSections;
|
||||
|
||||
// The set of TOC entries (.toc + addend) for which we should not apply
|
||||
// toc-indirect to toc-relative relaxation. const Symbol * refers to the
|
||||
|
||||
@@ -40,7 +40,7 @@ OutputSection *Out::preinitArray;
|
||||
OutputSection *Out::initArray;
|
||||
OutputSection *Out::finiArray;
|
||||
|
||||
std::vector<OutputSection *> elf::outputSections;
|
||||
SmallVector<OutputSection *, 0> elf::outputSections;
|
||||
|
||||
uint32_t OutputSection::getPhdrFlags() const {
|
||||
uint32_t ret = 0;
|
||||
|
||||
@@ -138,7 +138,7 @@ struct Out {
|
||||
|
||||
uint64_t getHeaderSize();
|
||||
|
||||
extern std::vector<OutputSection *> outputSections;
|
||||
extern llvm::SmallVector<OutputSection *, 0> outputSections;
|
||||
} // namespace elf
|
||||
} // namespace lld
|
||||
|
||||
|
||||
+1
-1
@@ -1246,7 +1246,7 @@ static void maybeShuffle(DenseMap<const InputSectionBase *, int> &order) {
|
||||
if (config->shuffleSections.empty())
|
||||
return;
|
||||
|
||||
std::vector<InputSectionBase *> matched, sections = inputSections;
|
||||
SmallVector<InputSectionBase *, 0> matched, sections = inputSections;
|
||||
matched.reserve(sections.size());
|
||||
for (const auto &patAndSeed : config->shuffleSections) {
|
||||
matched.clear();
|
||||
|
||||
Reference in new issue
Block a user