aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp14
-rw-r--r--lib/MC/MCAsmStreamer.cpp2
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index c22e501..48add10 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -436,7 +436,7 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
// Emit inter-object padding for alignment.
unsigned AlignMask = CPE.getAlignment() - 1;
unsigned NewOffset = (Offset + AlignMask) & ~AlignMask;
- EmitZeros(NewOffset - Offset);
+ OutStreamer.EmitFill(NewOffset - Offset);
const Type *Ty = CPE.getType();
Offset = NewOffset + TM.getTargetData()->getTypeAllocSize(Ty);
@@ -917,8 +917,8 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV,
///
void AsmPrinter::EmitZeros(uint64_t NumZeros, unsigned AddrSpace) const {
if (NumZeros == 0) return;
- if (MAI->getZeroDirective()) {
- O << MAI->getZeroDirective() << NumZeros << '\n';
+ if (MAI->getZeroDirective() || AddrSpace == 0) {
+ OutStreamer.EmitFill(NumZeros);
} else {
for (; NumZeros; --NumZeros)
O << MAI->getData8bitsDirective(AddrSpace) << "0\n";
@@ -1417,13 +1417,11 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
const Type *type = CV->getType();
unsigned Size = TD->getTypeAllocSize(type);
- if (CV->isNullValue() || isa<UndefValue>(CV)) {
- EmitZeros(Size, AddrSpace);
- return;
- }
+ if (CV->isNullValue() || isa<UndefValue>(CV))
+ return EmitZeros(Size, AddrSpace);
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
- EmitGlobalConstantArray(CVA , AddrSpace);
+ EmitGlobalConstantArray(CVA, AddrSpace);
return;
}
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index 317e74d..1fd048e 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -203,6 +203,8 @@ void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size) {
/// EmitFill - Emit NumBytes bytes worth of the value specified by
/// FillValue. This implements directives such as '.space'.
void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
+ if (NumBytes == 0) return;
+
if (const char *ZeroDirective = MAI.getZeroDirective()) {
OS << ZeroDirective << NumBytes;
if (FillValue != 0)