[llvm] r236049 - Avoid one more walk over all sections. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Tue Apr 28 15:03:22 PDT 2015
Author: rafael
Date: Tue Apr 28 17:03:22 2015
New Revision: 236049
URL: http://llvm.org/viewvc/llvm-project?rev=236049&view=rev
Log:
Avoid one more walk over all sections. NFC.
Set the group section index as they are created.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=236049&r1=236048&r2=236049&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Apr 28 17:03:22 2015
@@ -957,15 +957,6 @@ void ELFObjectWriter::maybeAddToGroup(MC
void ELFObjectWriter::computeIndexMap(
MCAssembler &Asm, std::vector<const MCSectionELF *> &Sections,
SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap) {
- for (const MCSectionData &SD : Asm) {
- const MCSectionELF &Section =
- static_cast<const MCSectionELF &>(SD.getSection());
- if (Section.getType() != ELF::SHT_GROUP)
- continue;
- Sections.push_back(&Section);
- SectionIndexMap[&Section] = Sections.size();
- }
-
std::vector<const MCSectionELF *> RelSections;
for (const MCSectionData &SD : Asm) {
const MCSectionELF &Section =
@@ -1465,6 +1456,9 @@ void ELFObjectWriter::createIndexedSecti
const MCSectionELF *&Group = RevGroupMap[SignatureSymbol];
if (!Group) {
Group = Ctx.createELFGroupSection(SignatureSymbol);
+ Sections.push_back(Group);
+ SectionIndexMap[Group] = Sections.size();
+
MCSectionData &Data = Asm.getOrCreateSectionData(*Group);
Data.setAlignment(4);
MCDataFragment *F = new MCDataFragment(&Data);
More information about the llvm-commits
mailing list