diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-21 21:02:35 +0000 | 
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-21 21:02:35 +0000 | 
| commit | 967d6a691499368cbb942e178a2526f5c00ce879 (patch) | |
| tree | 3e3721f388e20721118b44c0af1cb29d50c734e1 | |
| parent | 6a902f9d036266abd7963ee60bcd1c2187110f80 (diff) | |
| download | bcm5719-llvm-967d6a691499368cbb942e178a2526f5c00ce879.tar.gz bcm5719-llvm-967d6a691499368cbb942e178a2526f5c00ce879.zip  | |
Stop forwarding (get|set)Aligment from MCSectionData to MCSection.
llvm-svn: 237956
| -rw-r--r-- | llvm/include/llvm/MC/MCAssembler.h | 3 | ||||
| -rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/MC/MCELFStreamer.cpp | 11 | ||||
| -rw-r--r-- | llvm/lib/MC/MCMachOStreamer.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/MC/WinCOFFObjectWriter.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/MC/WinCOFFStreamer.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp | 7 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | 26 | 
11 files changed, 39 insertions, 47 deletions
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h index 0116aed2442..564691e3e18 100644 --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -597,9 +597,6 @@ public:    MCSection &getSection() const { return *Section; } -  unsigned getAlignment() const; -  void setAlignment(unsigned Value); -    bool hasInstructions() const { return HasInstructions; }    void setHasInstructions(bool Value) { HasInstructions = Value; } diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 0e764de7d8d..cdd6b173b67 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1347,7 +1347,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,    for (const MCSectionData &SD : Asm) {      MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection()); -    uint64_t Padding = OffsetToAlignment(OS.tell(), SD.getAlignment()); +    uint64_t Padding = OffsetToAlignment(OS.tell(), Section.getAlignment());      WriteZeros(Padding);      // Remember the offset into the file for this section. diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index c2ddb93880e..481f91f2fb7 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -300,12 +300,6 @@ MCSectionData::MCSectionData(MCSection &Section, MCAssembler *A)      A->getSectionList().push_back(this);  } -unsigned MCSectionData::getAlignment() const { return Section->getAlignment(); } - -void MCSectionData::setAlignment(unsigned Value) { -  Section->setAlignment(Value); -} -  MCSectionData::iterator  MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {    if (Subsection == 0 && SubsectionFragmentMap.empty()) @@ -1259,8 +1253,7 @@ void MCSectionData::dump() {    raw_ostream &OS = llvm::errs();    OS << "<MCSectionData"; -  OS << " Alignment:" << getAlignment() -     << " Fragments:[\n      "; +  OS << " Fragments:[\n      ";    for (iterator it = begin(), ie = end(); it != ie; ++it) {      if (it != begin()) OS << ",\n      ";      it->dump(); diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index 7b02f1a4528..e666b554236 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -135,10 +135,9 @@ void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {  // needs to be aligned to at least the bundle size.  static void setSectionAlignmentForBundling(      const MCAssembler &Assembler, MCSectionData *Section) { -  if (Assembler.isBundlingEnabled() && Section && -      Section->hasInstructions() && -      Section->getAlignment() < Assembler.getBundleAlignSize()) -    Section->setAlignment(Assembler.getBundleAlignSize()); +  if (Assembler.isBundlingEnabled() && Section && Section->hasInstructions() && +      Section->getSection().getAlignment() < Assembler.getBundleAlignSize()) +    Section->getSection().setAlignment(Assembler.getBundleAlignSize());  }  void MCELFStreamer::ChangeSection(MCSection *Section, @@ -642,8 +641,8 @@ void MCELFStreamer::Flush() {      Symbol.getData().setFragment(F);      // Update the maximum alignment of the section if necessary. -    if (ByteAlignment > SectData.getAlignment()) -      SectData.setAlignment(ByteAlignment); +    if (ByteAlignment > Section.getAlignment()) +      Section.setAlignment(ByteAlignment);    }    LocalCommons.clear(); diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index c9777809a7f..3742a733d26 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -426,8 +426,8 @@ void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,    AssignSection(Symbol, Section);    // Update the maximum alignment on the zero fill section if necessary. -  if (ByteAlignment > SectData.getAlignment()) -    SectData.setAlignment(ByteAlignment); +  if (ByteAlignment > Section->getAlignment()) +    Section->setAlignment(ByteAlignment);  }  // This should always be called with the thread local bss section.  Like the diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index b6d67a81771..3f32a36194f 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -380,8 +380,9 @@ void MCObjectStreamer::EmitValueToAlignment(unsigned ByteAlignment,    insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit));    // Update the maximum alignment on the current section if necessary. -  if (ByteAlignment > getCurrentSectionData()->getAlignment()) -    getCurrentSectionData()->setAlignment(ByteAlignment); +  MCSection *CurSec = getCurrentSection().first; +  if (ByteAlignment > CurSec->getAlignment()) +    CurSec->setAlignment(ByteAlignment);  }  void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment, diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index 2799298d762..759b8c59568 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -115,7 +115,7 @@ uint64_t MachObjectWriter::getPaddingSize(const MCSectionData *SD,    const MCSectionData &NextSD = *Layout.getSectionOrder()[Next];    if (NextSD.getSection().isVirtualSection())      return 0; -  return OffsetToAlignment(EndAddr, NextSD.getAlignment()); +  return OffsetToAlignment(EndAddr, NextSD.getSection().getAlignment());  }  void MachObjectWriter::WriteHeader(unsigned NumLoadCommands, @@ -199,9 +199,10 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,                                      uint64_t RelocationsStart,                                      unsigned NumRelocations) {    uint64_t SectionSize = Layout.getSectionAddressSize(&SD); +  const MCSectionMachO &Section = cast<MCSectionMachO>(SD.getSection());    // The offset is unused for virtual sections. -  if (SD.getSection().isVirtualSection()) { +  if (Section.isVirtualSection()) {      assert(Layout.getSectionFileSize(&SD) == 0 && "Invalid file size!");      FileOffset = 0;    } @@ -212,7 +213,6 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,    uint64_t Start = OS.tell();    (void) Start; -  const MCSectionMachO &Section = cast<MCSectionMachO>(SD.getSection());    WriteBytes(Section.getSectionName(), 16);    WriteBytes(Section.getSegmentName(), 16);    if (is64Bit()) { @@ -228,8 +228,8 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,    if (SD.hasInstructions())      Flags |= MachO::S_ATTR_SOME_INSTRUCTIONS; -  assert(isPowerOf2_32(SD.getAlignment()) && "Invalid alignment!"); -  Write32(Log2_32(SD.getAlignment())); +  assert(isPowerOf2_32(Section.getAlignment()) && "Invalid alignment!"); +  Write32(Log2_32(Section.getAlignment()));    Write32(NumRelocations ? RelocationsStart : 0);    Write32(NumRelocations);    Write32(Flags); @@ -645,7 +645,8 @@ void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm,    const SmallVectorImpl<MCSectionData*> &Order = Layout.getSectionOrder();    for (int i = 0, n = Order.size(); i != n ; ++i) {      const MCSectionData *SD = Order[i]; -    StartAddress = RoundUpToAlignment(StartAddress, SD->getAlignment()); +    StartAddress = +        RoundUpToAlignment(StartAddress, SD->getSection().getAlignment());      SectionAddress[SD] = StartAddress;      StartAddress += Layout.getSectionAddressSize(SD); diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp index d5bffe93936..565bca3ee93 100644 --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -322,7 +322,7 @@ void WinCOFFObjectWriter::DefineSection(MCSectionData const &SectionData) {    coff_section->Header.Characteristics = Sec.getCharacteristics();    uint32_t &Characteristics = coff_section->Header.Characteristics; -  switch (SectionData.getAlignment()) { +  switch (Sec.getAlignment()) {    case 1:    Characteristics |= COFF::IMAGE_SCN_ALIGN_1BYTES;    break;    case 2:    Characteristics |= COFF::IMAGE_SCN_ALIGN_2BYTES;    break;    case 4:    Characteristics |= COFF::IMAGE_SCN_ALIGN_4BYTES;    break; diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp index d048f287593..20c909db84a 100644 --- a/llvm/lib/MC/WinCOFFStreamer.cpp +++ b/llvm/lib/MC/WinCOFFStreamer.cpp @@ -221,8 +221,8 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,    MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();    MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section); -  if (SectionData.getAlignment() < ByteAlignment) -    SectionData.setAlignment(ByteAlignment); +  if (Section->getAlignment() < ByteAlignment) +    Section->setAlignment(ByteAlignment);    MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);    SD.setExternal(false); diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp index 272186240ba..076beedfa66 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp @@ -31,7 +31,8 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {      MCSectionELF *Sec =          Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,                                ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, ""); -    MCA.getOrCreateSectionData(*Sec).setAlignment(8); +    MCA.getOrCreateSectionData(*Sec); +    Sec->setAlignment(8);      Streamer->SwitchSection(Sec);      Streamer->EmitIntValue(ELF::ODK_REGINFO, 1);  // kind @@ -48,8 +49,8 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {    } else {      MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,                                                ELF::SHF_ALLOC, 24, ""); -    MCA.getOrCreateSectionData(*Sec) -        .setAlignment(MTS->getABI().IsN32() ? 8 : 4); +    MCA.getOrCreateSectionData(*Sec); +    Sec->setAlignment(MTS->getABI().IsN32() ? 8 : 4);      Streamer->SwitchSection(Sec);      Streamer->EmitIntValue(ri_gprmask, 4); diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index 0bb04c58520..f14160d2104 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -459,16 +459,16 @@ void MipsTargetELFStreamer::finish() {    const MCObjectFileInfo &OFI = *MCA.getContext().getObjectFileInfo();    // .bss, .text and .data are always at least 16-byte aligned. -  MCSectionData &TextSectionData = -      MCA.getOrCreateSectionData(*OFI.getTextSection()); -  MCSectionData &DataSectionData = -      MCA.getOrCreateSectionData(*OFI.getDataSection()); -  MCSectionData &BSSSectionData = -      MCA.getOrCreateSectionData(*OFI.getBSSSection()); +  MCSection &TextSection = *OFI.getTextSection(); +  MCA.getOrCreateSectionData(TextSection); +  MCSection &DataSection = *OFI.getDataSection(); +  MCA.getOrCreateSectionData(DataSection); +  MCSection &BSSSection = *OFI.getBSSSection(); +  MCA.getOrCreateSectionData(BSSSection); -  TextSectionData.setAlignment(std::max(16u, TextSectionData.getAlignment())); -  DataSectionData.setAlignment(std::max(16u, DataSectionData.getAlignment())); -  BSSSectionData.setAlignment(std::max(16u, BSSSectionData.getAlignment())); +  TextSection.setAlignment(std::max(16u, TextSection.getAlignment())); +  DataSection.setAlignment(std::max(16u, DataSection.getAlignment())); +  BSSSection.setAlignment(std::max(16u, BSSSection.getAlignment()));    uint64_t Features = STI.getFeatureBits(); @@ -570,8 +570,8 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {    const MCSymbolRefExpr *ExprRef =        MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context); -  MCSectionData &SecData = MCA.getOrCreateSectionData(*Sec); -  SecData.setAlignment(4); +  MCA.getOrCreateSectionData(*Sec); +  Sec->setAlignment(4);    OS.PushSection(); @@ -788,8 +788,8 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {    MCStreamer &OS = getStreamer();    MCSectionELF *Sec = Context.getELFSection(        ".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, ""); -  MCSectionData &ABIShndxSD = MCA.getOrCreateSectionData(*Sec); -  ABIShndxSD.setAlignment(8); +  MCA.getOrCreateSectionData(*Sec); +  Sec->setAlignment(8);    OS.SwitchSection(Sec);    OS << ABIFlagsSection;  | 

