aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-05-19 21:38:18 +0000
committerDale Johannesen <dalej@apple.com>2008-05-19 21:38:18 +0000
commitc215b3ef5d9627f5fb6fe9034e46bc29ae592916 (patch)
tree4c9eed2f1deea199d388cce1b02a4b3e081a71cf /lib/Target/PowerPC/PPCAsmPrinter.cpp
parent7be1c454c96dc5fa41ac10d014f76350df94f9cf (diff)
Handle quoted names when constructing $stub's,
$non_lazy_ptr's and $lazy_ptr's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp53
1 files changed, 35 insertions, 18 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index bd4975c42f..75bf3b36e3 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -189,7 +189,7 @@ namespace {
// Dynamically-resolved functions need a stub for the function.
std::string Name = Mang->getValueName(GV);
FnStubs.insert(Name);
- O << "L" << Name << "$stub";
+ printSuffixedName(Name, "$stub");
if (GV->hasExternalWeakLinkage())
ExtWeakSymbols.insert(GV);
return;
@@ -198,7 +198,7 @@ namespace {
if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
std::string Name(TAI->getGlobalPrefix()); Name += MO.getSymbolName();
FnStubs.insert(Name);
- O << "L" << Name << "$stub";
+ printSuffixedName(Name, "$stub");
return;
}
}
@@ -377,7 +377,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
if (TM.getRelocationModel() != Reloc::Static) {
std::string Name(TAI->getGlobalPrefix()); Name += MO.getSymbolName();
GVStubs.insert(Name);
- O << "L" << Name << "$non_lazy_ptr";
+ printSuffixedName(Name, "$non_lazy_ptr");
return;
}
O << TAI->getGlobalPrefix() << MO.getSymbolName();
@@ -392,7 +392,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) {
GVStubs.insert(Name);
- O << "L" << Name << "$non_lazy_ptr";
+ printSuffixedName(Name, "$non_lazy_ptr");
if (GV->hasExternalWeakLinkage())
ExtWeakSymbols.insert(GV);
return;
@@ -422,7 +422,7 @@ void PPCAsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) {
std::string Name = getGlobalLinkName(GV);
if (TM.getRelocationModel() != Reloc::Static) {
GVStubs.insert(Name);
- O << "L" << Name << "$non_lazy_ptr";
+ printSuffixedName(Name, "$non_lazy_ptr");
return;
}
O << Name;
@@ -1051,22 +1051,30 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs,"
"pure_instructions,32");
EmitAlignment(4);
- O << "L" << *i << "$stub:\n";
+ std::string p = *i;
+ std::string L0p = (p[0]=='\"') ? "\"L0$" + p.substr(1) : "L0$" + p ;
+ printSuffixedName(p, "$stub");
+ O << ":\n";
O << "\t.indirect_symbol " << *i << "\n";
O << "\tmflr r0\n";
- O << "\tbcl 20,31,L0$" << *i << "\n";
- O << "L0$" << *i << ":\n";
+ O << "\tbcl 20,31," << L0p << "\n";
+ O << L0p << ":\n";
O << "\tmflr r11\n";
- O << "\taddis r11,r11,ha16(L" << *i << "$lazy_ptr-L0$" << *i << ")\n";
+ O << "\taddis r11,r11,ha16(";
+ printSuffixedName(p, "$lazy_ptr");
+ O << "-" << L0p << ")\n";
O << "\tmtlr r0\n";
if (isPPC64)
- O << "\tldu r12,lo16(L" << *i << "$lazy_ptr-L0$" << *i << ")(r11)\n";
+ O << "\tldu r12,lo16(";
else
- O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr-L0$" << *i << ")(r11)\n";
+ O << "\tlwzu r12,lo16(";
+ printSuffixedName(p, "$lazy_ptr");
+ O << "-" << L0p << ")(r11)\n";
O << "\tmtctr r12\n";
O << "\tbctr\n";
SwitchToDataSection(".lazy_symbol_pointer");
- O << "L" << *i << "$lazy_ptr:\n";
+ printSuffixedName(p, "$lazy_ptr");
+ O << ":\n";
O << "\t.indirect_symbol " << *i << "\n";
if (isPPC64)
O << "\t.quad dyld_stub_binding_helper\n";
@@ -1079,17 +1087,24 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
"pure_instructions,16");
EmitAlignment(4);
- O << "L" << *i << "$stub:\n";
+ std::string p = *i;
+ printSuffixedName(p, "$stub");
+ O << ":\n";
O << "\t.indirect_symbol " << *i << "\n";
- O << "\tlis r11,ha16(L" << *i << "$lazy_ptr)\n";
+ O << "\tlis r11,ha16(";
+ printSuffixedName(p, "$lazy_ptr");
+ O << ")\n";
if (isPPC64)
- O << "\tldu r12,lo16(L" << *i << "$lazy_ptr)(r11)\n";
+ O << "\tldu r12,lo16(";
else
- O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr)(r11)\n";
+ O << "\tlwzu r12,lo16(";
+ printSuffixedName(p, "$lazy_ptr");
+ O << ")(r11)\n";
O << "\tmtctr r12\n";
O << "\tbctr\n";
SwitchToDataSection(".lazy_symbol_pointer");
- O << "L" << *i << "$lazy_ptr:\n";
+ printSuffixedName(p, "$lazy_ptr");
+ O << ":\n";
O << "\t.indirect_symbol " << *i << "\n";
if (isPPC64)
O << "\t.quad dyld_stub_binding_helper\n";
@@ -1115,7 +1130,9 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
SwitchToDataSection(".non_lazy_symbol_pointer");
for (std::set<std::string>::iterator I = GVStubs.begin(),
E = GVStubs.end(); I != E; ++I) {
- O << "L" << *I << "$non_lazy_ptr:\n";
+ std::string p = *I;
+ printSuffixedName(p, "$non_lazy_ptr");
+ O << ":\n";
O << "\t.indirect_symbol " << *I << "\n";
if (isPPC64)
O << "\t.quad\t0\n";