mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-26 14:25:18 +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:
parent
9ec47b85c7
commit
b14ebd6a1d
@ -40,7 +40,6 @@ class MCExpr;
|
||||
class MCFragment;
|
||||
class MCObjectWriter;
|
||||
class MCSection;
|
||||
class MCSectionData;
|
||||
class MCSubtargetInfo;
|
||||
class MCValue;
|
||||
class MCAsmBackend;
|
||||
@ -884,13 +883,7 @@ public:
|
||||
/// \name Backend Data Access
|
||||
/// @{
|
||||
|
||||
MCSectionData &getOrCreateSectionData(MCSection &Section,
|
||||
bool *Created = nullptr) {
|
||||
bool C = Sections.insert(&Section);
|
||||
if (Created)
|
||||
*Created = C;
|
||||
return Section.getSectionData();
|
||||
}
|
||||
bool registerSection(MCSection &Section) { return Sections.insert(&Section); }
|
||||
|
||||
bool hasSymbolData(const MCSymbol &Symbol) const { return Symbol.hasData(); }
|
||||
|
||||
|
@ -637,11 +637,10 @@ void MCELFStreamer::Flush() {
|
||||
unsigned ByteAlignment = i->ByteAlignment;
|
||||
MCSection &Section = Symbol.getSection();
|
||||
|
||||
MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section);
|
||||
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment,
|
||||
&SectData.getSection());
|
||||
getAssembler().registerSection(Section);
|
||||
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &Section);
|
||||
|
||||
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData.getSection());
|
||||
MCFragment *F = new MCFillFragment(0, 0, Size, &Section);
|
||||
Symbol.getData().setFragment(F);
|
||||
|
||||
// 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,
|
||||
uint64_t Size, unsigned ByteAlignment) {
|
||||
MCSectionData &SectData = getAssembler().getOrCreateSectionData(*Section);
|
||||
getAssembler().registerSection(*Section);
|
||||
|
||||
// The symbol may not be present, which only creates the section.
|
||||
if (!Symbol)
|
||||
@ -418,10 +418,9 @@ void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||
|
||||
// Emit an align fragment if necessary.
|
||||
if (ByteAlignment != 1)
|
||||
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment,
|
||||
&SectData.getSection());
|
||||
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section);
|
||||
|
||||
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData.getSection());
|
||||
MCFragment *F = new MCFillFragment(0, 0, Size, Section);
|
||||
SD.setFragment(F);
|
||||
|
||||
AssignSection(Symbol, Section);
|
||||
|
@ -211,8 +211,7 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
|
||||
assert(Section && "Cannot switch to a null section!");
|
||||
flushPendingLabels(nullptr);
|
||||
|
||||
bool Created;
|
||||
getAssembler().getOrCreateSectionData(*Section, &Created);
|
||||
bool Created = getAssembler().registerSection(*Section);
|
||||
CurSectionData = Section;
|
||||
|
||||
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!");
|
||||
|
||||
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
||||
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
|
||||
getAssembler().registerSection(*Section);
|
||||
if (Section->getAlignment() < ByteAlignment)
|
||||
Section->setAlignment(ByteAlignment);
|
||||
|
||||
@ -231,10 +231,10 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||
|
||||
if (ByteAlignment != 1)
|
||||
new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
|
||||
ByteAlignment, &SectionData.getSection());
|
||||
ByteAlignment, Section);
|
||||
|
||||
MCFillFragment *Fragment = new MCFillFragment(
|
||||
/*Value=*/0, /*ValueSize=*/0, Size, &SectionData.getSection());
|
||||
/*Value=*/0, /*ValueSize=*/0, Size, Section);
|
||||
SD.setFragment(Fragment);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
||||
MCSectionELF *Sec =
|
||||
Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
|
||||
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
|
||||
MCA.getOrCreateSectionData(*Sec);
|
||||
MCA.registerSection(*Sec);
|
||||
Sec->setAlignment(8);
|
||||
Streamer->SwitchSection(Sec);
|
||||
|
||||
@ -49,7 +49,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
||||
} else {
|
||||
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
|
||||
ELF::SHF_ALLOC, 24, "");
|
||||
MCA.getOrCreateSectionData(*Sec);
|
||||
MCA.registerSection(*Sec);
|
||||
Sec->setAlignment(MTS->getABI().IsN32() ? 8 : 4);
|
||||
Streamer->SwitchSection(Sec);
|
||||
|
||||
|
@ -460,11 +460,11 @@ void MipsTargetELFStreamer::finish() {
|
||||
|
||||
// .bss, .text and .data are always at least 16-byte aligned.
|
||||
MCSection &TextSection = *OFI.getTextSection();
|
||||
MCA.getOrCreateSectionData(TextSection);
|
||||
MCA.registerSection(TextSection);
|
||||
MCSection &DataSection = *OFI.getDataSection();
|
||||
MCA.getOrCreateSectionData(DataSection);
|
||||
MCA.registerSection(DataSection);
|
||||
MCSection &BSSSection = *OFI.getBSSSection();
|
||||
MCA.getOrCreateSectionData(BSSSection);
|
||||
MCA.registerSection(BSSSection);
|
||||
|
||||
TextSection.setAlignment(std::max(16u, TextSection.getAlignment()));
|
||||
DataSection.setAlignment(std::max(16u, DataSection.getAlignment()));
|
||||
@ -570,7 +570,7 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
|
||||
const MCSymbolRefExpr *ExprRef =
|
||||
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
|
||||
|
||||
MCA.getOrCreateSectionData(*Sec);
|
||||
MCA.registerSection(*Sec);
|
||||
Sec->setAlignment(4);
|
||||
|
||||
OS.PushSection();
|
||||
@ -788,7 +788,7 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {
|
||||
MCStreamer &OS = getStreamer();
|
||||
MCSectionELF *Sec = Context.getELFSection(
|
||||
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
|
||||
MCA.getOrCreateSectionData(*Sec);
|
||||
MCA.registerSection(*Sec);
|
||||
Sec->setAlignment(8);
|
||||
OS.SwitchSection(Sec);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user