mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-05 03:36:43 +00:00
Don't create MCFillFragment directly.
Instead use higher level APIs that take care of most bookkeeping. llvm-svn: 322123
This commit is contained in:
parent
9ebc8a13dc
commit
1bbec740b6
@ -411,29 +411,19 @@ 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) {
|
||||||
getAssembler().registerSection(*Section);
|
|
||||||
|
|
||||||
// The symbol may not be present, which only creates the section.
|
|
||||||
if (!Symbol)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// On darwin all virtual sections have zerofill type.
|
// On darwin all virtual sections have zerofill type.
|
||||||
assert(Section->isVirtualSection() && "Section does not have zerofill type!");
|
assert(Section->isVirtualSection() && "Section does not have zerofill type!");
|
||||||
|
|
||||||
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
PushSection();
|
||||||
|
SwitchSection(Section);
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
// The symbol may not be present, which only creates the section.
|
||||||
|
if (Symbol) {
|
||||||
// Emit an align fragment if necessary.
|
EmitValueToAlignment(ByteAlignment, 0, 1, 0);
|
||||||
if (ByteAlignment != 1)
|
EmitLabel(Symbol);
|
||||||
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section);
|
EmitZeros(Size);
|
||||||
|
}
|
||||||
MCFragment *F = new MCFillFragment(0, Size, Section);
|
PopSection();
|
||||||
Symbol->setFragment(F);
|
|
||||||
|
|
||||||
// Update the maximum alignment on the zero fill section if necessary.
|
|
||||||
if (ByteAlignment > Section->getAlignment())
|
|
||||||
Section->setAlignment(ByteAlignment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should always be called with the thread local bss section. Like the
|
// This should always be called with the thread local bss section. Like the
|
||||||
|
@ -257,20 +257,13 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
|
|||||||
auto *Symbol = cast<MCSymbolCOFF>(S);
|
auto *Symbol = cast<MCSymbolCOFF>(S);
|
||||||
|
|
||||||
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
||||||
getAssembler().registerSection(*Section);
|
PushSection();
|
||||||
if (Section->getAlignment() < ByteAlignment)
|
SwitchSection(Section);
|
||||||
Section->setAlignment(ByteAlignment);
|
EmitValueToAlignment(ByteAlignment, 0, 1, 0);
|
||||||
|
EmitLabel(Symbol);
|
||||||
getAssembler().registerSymbol(*Symbol);
|
|
||||||
Symbol->setExternal(false);
|
Symbol->setExternal(false);
|
||||||
|
EmitZeros(Size);
|
||||||
if (ByteAlignment != 1)
|
PopSection();
|
||||||
new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
|
|
||||||
ByteAlignment, Section);
|
|
||||||
|
|
||||||
MCFillFragment *Fragment = new MCFillFragment(
|
|
||||||
/*Value=*/0, Size, Section);
|
|
||||||
Symbol->setFragment(Fragment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user