mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-06 18:17:04 +00:00
Replace getOrCreateSectionData with registerSection.
There is now no SectionData to be created. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,7 +40,6 @@ class MCExpr;
|
|||||||
class MCFragment;
|
class MCFragment;
|
||||||
class MCObjectWriter;
|
class MCObjectWriter;
|
||||||
class MCSection;
|
class MCSection;
|
||||||
class MCSectionData;
|
|
||||||
class MCSubtargetInfo;
|
class MCSubtargetInfo;
|
||||||
class MCValue;
|
class MCValue;
|
||||||
class MCAsmBackend;
|
class MCAsmBackend;
|
||||||
@@ -884,13 +883,7 @@ public:
|
|||||||
/// \name Backend Data Access
|
/// \name Backend Data Access
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
MCSectionData &getOrCreateSectionData(MCSection &Section,
|
bool registerSection(MCSection &Section) { return Sections.insert(&Section); }
|
||||||
bool *Created = nullptr) {
|
|
||||||
bool C = Sections.insert(&Section);
|
|
||||||
if (Created)
|
|
||||||
*Created = C;
|
|
||||||
return Section.getSectionData();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasSymbolData(const MCSymbol &Symbol) const { return Symbol.hasData(); }
|
bool hasSymbolData(const MCSymbol &Symbol) const { return Symbol.hasData(); }
|
||||||
|
|
||||||
|
@@ -637,11 +637,10 @@ void MCELFStreamer::Flush() {
|
|||||||
unsigned ByteAlignment = i->ByteAlignment;
|
unsigned ByteAlignment = i->ByteAlignment;
|
||||||
MCSection &Section = Symbol.getSection();
|
MCSection &Section = Symbol.getSection();
|
||||||
|
|
||||||
MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section);
|
getAssembler().registerSection(Section);
|
||||||
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment,
|
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &Section);
|
||||||
&SectData.getSection());
|
|
||||||
|
|
||||||
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData.getSection());
|
MCFragment *F = new MCFillFragment(0, 0, Size, &Section);
|
||||||
Symbol.getData().setFragment(F);
|
Symbol.getData().setFragment(F);
|
||||||
|
|
||||||
// Update the maximum alignment of the section if necessary.
|
// Update the maximum alignment of the section if necessary.
|
||||||
|
@@ -403,7 +403,7 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
|
|
||||||
void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
MCSectionData &SectData = getAssembler().getOrCreateSectionData(*Section);
|
getAssembler().registerSection(*Section);
|
||||||
|
|
||||||
// The symbol may not be present, which only creates the section.
|
// The symbol may not be present, which only creates the section.
|
||||||
if (!Symbol)
|
if (!Symbol)
|
||||||
@@ -418,10 +418,9 @@ void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
|
|
||||||
// Emit an align fragment if necessary.
|
// Emit an align fragment if necessary.
|
||||||
if (ByteAlignment != 1)
|
if (ByteAlignment != 1)
|
||||||
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment,
|
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section);
|
||||||
&SectData.getSection());
|
|
||||||
|
|
||||||
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData.getSection());
|
MCFragment *F = new MCFillFragment(0, 0, Size, Section);
|
||||||
SD.setFragment(F);
|
SD.setFragment(F);
|
||||||
|
|
||||||
AssignSection(Symbol, Section);
|
AssignSection(Symbol, Section);
|
||||||
|
@@ -211,8 +211,7 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
|
|||||||
assert(Section && "Cannot switch to a null section!");
|
assert(Section && "Cannot switch to a null section!");
|
||||||
flushPendingLabels(nullptr);
|
flushPendingLabels(nullptr);
|
||||||
|
|
||||||
bool Created;
|
bool Created = getAssembler().registerSection(*Section);
|
||||||
getAssembler().getOrCreateSectionData(*Section, &Created);
|
|
||||||
CurSectionData = Section;
|
CurSectionData = Section;
|
||||||
|
|
||||||
int64_t IntSubsection = 0;
|
int64_t IntSubsection = 0;
|
||||||
|
@@ -220,7 +220,7 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
|
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
|
||||||
|
|
||||||
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
||||||
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
|
getAssembler().registerSection(*Section);
|
||||||
if (Section->getAlignment() < ByteAlignment)
|
if (Section->getAlignment() < ByteAlignment)
|
||||||
Section->setAlignment(ByteAlignment);
|
Section->setAlignment(ByteAlignment);
|
||||||
|
|
||||||
@@ -231,10 +231,10 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
|
|
||||||
if (ByteAlignment != 1)
|
if (ByteAlignment != 1)
|
||||||
new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
|
new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
|
||||||
ByteAlignment, &SectionData.getSection());
|
ByteAlignment, Section);
|
||||||
|
|
||||||
MCFillFragment *Fragment = new MCFillFragment(
|
MCFillFragment *Fragment = new MCFillFragment(
|
||||||
/*Value=*/0, /*ValueSize=*/0, Size, &SectionData.getSection());
|
/*Value=*/0, /*ValueSize=*/0, Size, Section);
|
||||||
SD.setFragment(Fragment);
|
SD.setFragment(Fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
|||||||
MCSectionELF *Sec =
|
MCSectionELF *Sec =
|
||||||
Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
|
Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
|
||||||
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
|
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
|
||||||
MCA.getOrCreateSectionData(*Sec);
|
MCA.registerSection(*Sec);
|
||||||
Sec->setAlignment(8);
|
Sec->setAlignment(8);
|
||||||
Streamer->SwitchSection(Sec);
|
Streamer->SwitchSection(Sec);
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
|||||||
} else {
|
} else {
|
||||||
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
|
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
|
||||||
ELF::SHF_ALLOC, 24, "");
|
ELF::SHF_ALLOC, 24, "");
|
||||||
MCA.getOrCreateSectionData(*Sec);
|
MCA.registerSection(*Sec);
|
||||||
Sec->setAlignment(MTS->getABI().IsN32() ? 8 : 4);
|
Sec->setAlignment(MTS->getABI().IsN32() ? 8 : 4);
|
||||||
Streamer->SwitchSection(Sec);
|
Streamer->SwitchSection(Sec);
|
||||||
|
|
||||||
|
@@ -460,11 +460,11 @@ void MipsTargetELFStreamer::finish() {
|
|||||||
|
|
||||||
// .bss, .text and .data are always at least 16-byte aligned.
|
// .bss, .text and .data are always at least 16-byte aligned.
|
||||||
MCSection &TextSection = *OFI.getTextSection();
|
MCSection &TextSection = *OFI.getTextSection();
|
||||||
MCA.getOrCreateSectionData(TextSection);
|
MCA.registerSection(TextSection);
|
||||||
MCSection &DataSection = *OFI.getDataSection();
|
MCSection &DataSection = *OFI.getDataSection();
|
||||||
MCA.getOrCreateSectionData(DataSection);
|
MCA.registerSection(DataSection);
|
||||||
MCSection &BSSSection = *OFI.getBSSSection();
|
MCSection &BSSSection = *OFI.getBSSSection();
|
||||||
MCA.getOrCreateSectionData(BSSSection);
|
MCA.registerSection(BSSSection);
|
||||||
|
|
||||||
TextSection.setAlignment(std::max(16u, TextSection.getAlignment()));
|
TextSection.setAlignment(std::max(16u, TextSection.getAlignment()));
|
||||||
DataSection.setAlignment(std::max(16u, DataSection.getAlignment()));
|
DataSection.setAlignment(std::max(16u, DataSection.getAlignment()));
|
||||||
@@ -570,7 +570,7 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
|
|||||||
const MCSymbolRefExpr *ExprRef =
|
const MCSymbolRefExpr *ExprRef =
|
||||||
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
|
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
|
||||||
|
|
||||||
MCA.getOrCreateSectionData(*Sec);
|
MCA.registerSection(*Sec);
|
||||||
Sec->setAlignment(4);
|
Sec->setAlignment(4);
|
||||||
|
|
||||||
OS.PushSection();
|
OS.PushSection();
|
||||||
@@ -788,7 +788,7 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {
|
|||||||
MCStreamer &OS = getStreamer();
|
MCStreamer &OS = getStreamer();
|
||||||
MCSectionELF *Sec = Context.getELFSection(
|
MCSectionELF *Sec = Context.getELFSection(
|
||||||
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
|
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
|
||||||
MCA.getOrCreateSectionData(*Sec);
|
MCA.registerSection(*Sec);
|
||||||
Sec->setAlignment(8);
|
Sec->setAlignment(8);
|
||||||
OS.SwitchSection(Sec);
|
OS.SwitchSection(Sec);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user