summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 04:39:15 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 04:39:15 +0000
commit6a160517a0690fc9ddda4511174e08d8d5557821 (patch)
tree5dbfe144342fabfbf728b786dca8c4e881abed2c /llvm/lib/Target/ARM
parente9d28b19cf3864c0e44e15036dc71e8e4eb31088 (diff)
downloadbcm5719-llvm-6a160517a0690fc9ddda4511174e08d8d5557821.tar.gz
bcm5719-llvm-6a160517a0690fc9ddda4511174e08d8d5557821.zip
hoist handling of external globals and special globals up to common code.
This makes a similar code dead in all the other targets, I'll clean it up in a bit. This also moves handling of lcomm up before acquisition of a section, since lcomm never needs a section. llvm-svn: 93851
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r--llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 070c29a24dd..b1c1f55f17f 100644
--- a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -1167,13 +1167,6 @@ void ARMAsmPrinter::EmitStartOfAsmFile(Module &M) {
void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
const TargetData *TD = TM.getTargetData();
- if (!GVar->hasInitializer()) // External global require no code
- return;
-
- // Check to see if this is a special global used by LLVM, if so, emit it.
- if (EmitSpecialLLVMGlobal(GVar))
- return;
-
MCSymbol *GVarSym = GetGlobalValueSymbol(GVar);
Constant *C = GVar->getInitializer();
@@ -1206,25 +1199,12 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
return;
}
- const MCSection *TheSection =
- getObjFileLowering().SectionForGlobal(GVar, GVKind, Mang, TM);
-
- // Handle the zerofill directive on darwin, which is a special form of BSS
- // emission.
- if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) {
- // .globl _foo
- OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- // .zerofill __DATA, __common, _foo, 400, 5
- OutStreamer.EmitZerofill(TheSection, GVarSym, Size, 1 << Align);
- return;
- }
-
if (GVKind.isBSSLocal()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
-
+
if (isDarwin) {
O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size
- << ',' << Align;
+ << ',' << Align;
} else if (MAI->getLCOMMDirective() != NULL) {
O << MAI->getLCOMMDirective() << *GVarSym << "," << Size;
} else {
@@ -1242,7 +1222,20 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
O << "\n";
return;
}
-
+
+ const MCSection *TheSection =
+ getObjFileLowering().SectionForGlobal(GVar, GVKind, Mang, TM);
+
+ // Handle the zerofill directive on darwin, which is a special form of BSS
+ // emission.
+ if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) {
+ // .globl _foo
+ OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
+ // .zerofill __DATA, __common, _foo, 400, 5
+ OutStreamer.EmitZerofill(TheSection, GVarSym, Size, 1 << Align);
+ return;
+ }
+
OutStreamer.SwitchSection(TheSection);
switch (GVar->getLinkage()) {
OpenPOWER on IntegriCloud