aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2018-01-30 16:42:08 +0000
committerEd Maste <emaste@FreeBSD.org>2018-01-30 16:42:08 +0000
commit88e56272f9989b1c1d78c7d3f6346c0428e18db6 (patch)
tree38bdfe560cb782f04ceab57f221ec8484fea5de2 /contrib/llvm
parent00da656e30bb2500ddebf9870194a6239a1b5ff0 (diff)
downloadsrc-88e56272f9989b1c1d78c7d3f6346c0428e18db6.tar.gz
src-88e56272f9989b1c1d78c7d3f6346c0428e18db6.zip
Pull in r322123 from upstream llvm trunk (by Rafael EspĂ­ndola):
Don't create MCFillFragment directly. Instead use higher level APIs that take care of most bookkeeping.
Notes
Notes: svn path=/head/; revision=328595
Diffstat (limited to 'contrib/llvm')
-rw-r--r--contrib/llvm/lib/MC/MCMachOStreamer.cpp28
-rw-r--r--contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp19
2 files changed, 15 insertions, 32 deletions
diff --git a/contrib/llvm/lib/MC/MCMachOStreamer.cpp b/contrib/llvm/lib/MC/MCMachOStreamer.cpp
index 82b75afabb3c..3969143bb2c7 100644
--- a/contrib/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/contrib/llvm/lib/MC/MCMachOStreamer.cpp
@@ -411,29 +411,19 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
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.
assert(Section->isVirtualSection() && "Section does not have zerofill type!");
- assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
+ PushSection();
+ SwitchSection(Section);
- getAssembler().registerSymbol(*Symbol);
-
- // Emit an align fragment if necessary.
- if (ByteAlignment != 1)
- new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section);
-
- MCFragment *F = new MCFillFragment(0, Size, Section);
- Symbol->setFragment(F);
-
- // Update the maximum alignment on the zero fill section if necessary.
- if (ByteAlignment > Section->getAlignment())
- Section->setAlignment(ByteAlignment);
+ // The symbol may not be present, which only creates the section.
+ if (Symbol) {
+ EmitValueToAlignment(ByteAlignment, 0, 1, 0);
+ EmitLabel(Symbol);
+ EmitZeros(Size);
+ }
+ PopSection();
}
// This should always be called with the thread local bss section. Like the
diff --git a/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp b/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp
index c2583d95c5ed..8582d9adafb8 100644
--- a/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp
+++ b/contrib/llvm/lib/MC/MCWinCOFFStreamer.cpp
@@ -257,20 +257,13 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
auto *Symbol = cast<MCSymbolCOFF>(S);
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
- getAssembler().registerSection(*Section);
- if (Section->getAlignment() < ByteAlignment)
- Section->setAlignment(ByteAlignment);
-
- getAssembler().registerSymbol(*Symbol);
+ PushSection();
+ SwitchSection(Section);
+ EmitValueToAlignment(ByteAlignment, 0, 1, 0);
+ EmitLabel(Symbol);
Symbol->setExternal(false);
-
- if (ByteAlignment != 1)
- new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
- ByteAlignment, Section);
-
- MCFillFragment *Fragment = new MCFillFragment(
- /*Value=*/0, Size, Section);
- Symbol->setFragment(Fragment);
+ EmitZeros(Size);
+ PopSection();
}
void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,