Xcore target

Fix emitArrayBound() calling OutStreamer.Emit*() multiple times when trying to print a single line

llvm-svn: 187562
This commit is contained in:
Robert Lytton 2013-08-01 07:52:05 +00:00
parent ad5ccc2d75
commit b4787a159d
2 changed files with 13 additions and 6 deletions

View File

@ -83,12 +83,15 @@ void XCoreAsmPrinter::emitArrayBound(MCSymbol *Sym, const GlobalVariable *GV) {
GV->hasWeakLinkage()) ||
GV->hasLinkOnceLinkage()) && "Unexpected linkage");
if (ArrayType *ATy = dyn_cast<ArrayType>(
cast<PointerType>(GV->getType())->getElementType())) {
OutStreamer.EmitSymbolAttribute(Sym, MCSA_Global);
// FIXME: MCStreamerize.
OutStreamer.EmitRawText(StringRef(".globound"));
OutStreamer.EmitRawText("\t.set\t" + Twine(Sym->getName()));
OutStreamer.EmitRawText(".globound," + Twine(ATy->getNumElements()));
cast<PointerType>(GV->getType())->getElementType())) {
MCSymbol *SymGlob = OutContext.GetOrCreateSymbol(
Twine(Sym->getName() + StringRef(".globound")));
OutStreamer.EmitSymbolAttribute(SymGlob, MCSA_Global);
OutStreamer.EmitRawText("\t.set\t" + Twine(Sym->getName()) +
".globound," + Twine(ATy->getNumElements()));
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
// TODO Use COMDAT groups for LinkOnceLinkage
OutStreamer.EmitRawText(MAI->getWeakDefDirective() +Twine(Sym->getName())+

View File

@ -90,3 +90,7 @@ entry:
@G8 = internal global i32 9312
; CHECK: .section .dp.data,"awd",@progbits
; CHECK: G8:
@array = global [10 x i16] zeroinitializer, align 2
; CHECK: .globl array.globound
; CHECK: .set array.globound,10