diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-15 00:55:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-15 00:55:58 +0000 |
commit | ea56f109db4d27475999af9b64ae6d74a858e329 (patch) | |
tree | 85e0d2fabc4ba6f5e83923c50155a60682d2955d | |
parent | 21da1ed4f501ec2fbbda1795131aa9cfef565381 (diff) | |
download | external_llvm-ea56f109db4d27475999af9b64ae6d74a858e329.zip external_llvm-ea56f109db4d27475999af9b64ae6d74a858e329.tar.gz external_llvm-ea56f109db4d27475999af9b64ae6d74a858e329.tar.bz2 |
minor cleanups: only switch sections once before all function stubs, instead of
before each one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75718 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 37f0fdb..6715181 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -366,7 +366,8 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { case MachineOperand::MO_ExternalSymbol: // Computing the address of an external symbol, not calling it. if (TM.getRelocationModel() != Reloc::Static) { - std::string Name(TAI->getGlobalPrefix()); Name += MO.getSymbolName(); + std::string Name(TAI->getGlobalPrefix()); + Name += MO.getSymbolName(); GVStubs.insert(Name); printSuffixedName(Name, "$non_lazy_ptr"); return; @@ -381,17 +382,15 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { // External or weakly linked global variables need non-lazily-resolved stubs if (TM.getRelocationModel() != Reloc::Static) { if (GV->isDeclaration() || GV->isWeakForLinker()) { - if (GV->hasHiddenVisibility()) { - if (GV->isDeclaration() || GV->hasCommonLinkage() || - GV->hasAvailableExternallyLinkage()) { - HiddenGVStubs.insert(Name); - printSuffixedName(Name, "$non_lazy_ptr"); - } else { - O << Name; - } - } else { + if (!GV->hasHiddenVisibility()) { GVStubs.insert(Name); printSuffixedName(Name, "$non_lazy_ptr"); + } else if (GV->isDeclaration() || GV->hasCommonLinkage() || + GV->hasAvailableExternallyLinkage()) { + HiddenGVStubs.insert(Name); + printSuffixedName(Name, "$non_lazy_ptr"); + } else { + O << Name; } return; } @@ -962,11 +961,11 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) { bool isPPC64 = TD->getPointerSizeInBits() == 64; // Output stubs for dynamically-linked functions - if (TM.getRelocationModel() == Reloc::PIC_) { + if (TM.getRelocationModel() == Reloc::PIC_ && !FnStubs.empty()) { + SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs," + "pure_instructions,32"); for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { - SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs," - "pure_instructions,32"); EmitAlignment(4); const char *p = i->getKeyData(); bool hasQuote = p[0]=='\"'; @@ -1017,11 +1016,11 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) { else O << "\t.long dyld_stub_binding_helper\n"; } - } else { + } else if (!FnStubs.empty()) { + SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs," + "pure_instructions,16"); for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { - SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs," - "pure_instructions,16"); EmitAlignment(4); const char *p = i->getKeyData(); printSuffixedName(p, "$stub"); |