diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-19 04:39:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-19 04:39:15 +0000 |
commit | d960947255c0e5d28eab6d76a02222133af1f1f6 (patch) | |
tree | 604d4db965eed12c4ce27a78e96ac0d9b66c487c /lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | |
parent | 2f2fe05fa39eac3b0067ccadd5dd8c985d5a09fe (diff) | |
download | external_llvm-d960947255c0e5d28eab6d76a02222133af1f1f6.tar.gz external_llvm-d960947255c0e5d28eab6d76a02222133af1f1f6.tar.bz2 external_llvm-d960947255c0e5d28eab6d76a02222133af1f1f6.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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp')
-rw-r--r-- | lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index a1c117dd04..6b8408f08a 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -697,14 +697,6 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { const TargetData *TD = TM.getTargetData(); - - if (!GVar->hasInitializer()) - return; // External global require no code - - // Check to see if this is a special global used by LLVM, if so, emit it. - if (EmitSpecialLLVMGlobal(GVar)) - return; - MCSymbol *GVarSym = GetGlobalValueSymbol(GVar); printVisibility(GVarSym, GVar->getVisibility()); @@ -929,13 +921,6 @@ void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) { void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { const TargetData *TD = TM.getTargetData(); - if (!GVar->hasInitializer()) - return; // External global require no code - - // Check to see if this is a special global used by LLVM, if so, emit it. - if (EmitSpecialLLVMGlobal(GVar)) - return; - MCSymbol *GVarSym = GetGlobalValueSymbol(GVar); printVisibility(GVarSym, GVar->getVisibility()); @@ -963,6 +948,20 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { return; } + if (GVKind.isBSSLocal()) { + if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. + + O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size << ',' << Align; + + if (VerboseAsm) { + O << "\t\t" << MAI->getCommentString() << " '"; + WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent()); + O << "'"; + } + O << '\n'; + return; + } + const MCSection *TheSection = getObjFileLowering().SectionForGlobal(GVar, GVKind, Mang, TM); @@ -976,20 +975,6 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { return; } - if (GVKind.isBSSLocal()) { - if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. - - O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size << ',' << Align; - - if (VerboseAsm) { - O << "\t\t" << MAI->getCommentString() << " '"; - WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent()); - O << "'"; - } - O << '\n'; - return; - } - OutStreamer.SwitchSection(TheSection); switch (GVar->getLinkage()) { |