From 0709a7bd1a75191a13580ca2a505fa0f7c4326bd Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 21 May 2015 19:20:38 +0000 Subject: Move alignment from MCSectionData to MCSection. This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936 --- llvm/lib/MC/MCELFStreamer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/MC/MCELFStreamer.cpp') diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index fe54dcbd83c..7b02f1a4528 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -141,7 +141,7 @@ static void setSectionAlignmentForBundling( Section->setAlignment(Assembler.getBundleAlignSize()); } -void MCELFStreamer::ChangeSection(const MCSection *Section, +void MCELFStreamer::ChangeSection(MCSection *Section, const MCExpr *Subsection) { MCSectionData *CurSection = getCurrentSectionData(); if (CurSection && CurSection->isBundleLocked()) @@ -314,7 +314,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, MCELF::SetType(SD, ELF::STT_OBJECT); if (MCELF::GetBinding(SD) == ELF_STB_Local) { - const MCSection *Section = getAssembler().getContext().getELFSection( + MCSection *Section = getAssembler().getContext().getELFSection( ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC); AssignSection(Symbol, Section); @@ -369,7 +369,7 @@ void MCELFStreamer::EmitFileDirective(StringRef Filename) { } void MCELFStreamer::EmitIdent(StringRef IdentString) { - const MCSection *Comment = getAssembler().getContext().getELFSection( + MCSection *Comment = getAssembler().getContext().getELFSection( ".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, ""); PushSection(); SwitchSection(Comment); @@ -633,7 +633,7 @@ void MCELFStreamer::Flush() { const MCSymbol &Symbol = *i->Symbol; uint64_t Size = i->Size; unsigned ByteAlignment = i->ByteAlignment; - const MCSection &Section = Symbol.getSection(); + MCSection &Section = Symbol.getSection(); MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section); new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &SectData); @@ -693,12 +693,12 @@ void MCELFStreamer::EndCOFFSymbolDef() { llvm_unreachable("ELF doesn't support this directive"); } -void MCELFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol, +void MCELFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) { llvm_unreachable("ELF doesn't support this directive"); } -void MCELFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, +void MCELFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) { llvm_unreachable("ELF doesn't support this directive"); } -- cgit v1.2.3