Use MCFillFragment for zero-initialized data.

It fixes PR16338 (ICE when compiling very large two-dimensional array).

Differential Revision: http://llvm-reviews.chandlerc.com/D1043


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Serge Pavlov
2013-06-27 14:35:03 +00:00
parent 31d2f08f88
commit b02f1e9a6b
5 changed files with 21 additions and 8 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSection.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
@ -374,6 +375,12 @@ void MCObjectStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue,
getOrCreateDataFragment()->getContents().append(NumBytes, FillValue);
}
void MCObjectStreamer::EmitZeros(uint64_t NumBytes, unsigned AddrSpace) {
assert(AddrSpace == 0 && "Address space must be 0!");
unsigned ItemSize = getCurrentSection().first->isVirtualSection() ? 0 : 1;
insert(new MCFillFragment(0, ItemSize, NumBytes));
}
void MCObjectStreamer::FinishImpl() {
// Dump out the dwarf file & directory tables and line tables.
const MCSymbol *LineSectionSymbol = NULL;