Xcore target

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187562 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Robert Lytton 2013-08-01 07:52:05 +00:00
parent f71698747e
commit 98369fb0e7
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