summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-18 01:21:08 +0000
committerChris Lattner <sabre@nondot.org>2010-01-18 01:21:08 +0000
commit1d8b954b43ee49cfd20fd8af59ff8c5144fd39c4 (patch)
treeae2641f98660228712a90ffb1b94186ac64b1e98
parent8c21ffdcc60fe8489c5dd3a151ef026a90625bfc (diff)
downloadbcm5719-llvm-1d8b954b43ee49cfd20fd8af59ff8c5144fd39c4.tar.gz
bcm5719-llvm-1d8b954b43ee49cfd20fd8af59ff8c5144fd39c4.zip
switch x86 zerofill emission over to use MCStreamer.
llvm-svn: 93702
-rw-r--r--llvm/include/llvm/MC/MCAsmInfo.h2
-rw-r--r--llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp15
2 files changed, 14 insertions, 3 deletions
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index fb69630ff52..1d90feb09b9 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -316,6 +316,8 @@ namespace llvm {
const char *getZeroFillDirective() const {
return ZeroFillDirective;
}
+ bool hasZeroFillDirective() const { return ZeroFillDirective != 0; }
+
const char *getNonexecutableStackDirective() const {
return NonexecutableStackDirective;
}
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index 10d2e3039a6..a24a4f1746d 100644
--- a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -685,10 +685,19 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// Don't put things that should go in the cstring section into "comm".
!TheSection->getKind().isMergeableCString()) {
if (GVar->hasExternalLinkage()) {
- if (const char *Directive = MAI->getZeroFillDirective()) {
+ if (MAI->hasZeroFillDirective()) {
+ // .globl _foo
OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
- O << Directive << "__DATA, __common, " << *GVSym;
- O << ", " << Size << ", " << Align << '\n';
+ // .zerofill __DATA, __common, _foo, 400, 5
+ TargetLoweringObjectFileMachO &TLOFMacho =
+ static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
+ // FIXME: This stuff should already be handled by SectionForGlobal!
+ const MCSection *TheSection =
+ TLOFMacho.getMachOSection("__DATA", "__common",
+ MCSectionMachO::S_ZEROFILL,
+ SectionKind::getBSS());
+
+ OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << Align);
return;
}
}
OpenPOWER on IntegriCloud