eliminate a bunch of printSuffixedName's by using info computed from

Mangler in FnStubs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75731 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-07-15 02:33:19 +00:00
parent 9ec8facd10
commit defd3000dc

View File

@ -988,11 +988,12 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end(); for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) { I != E; ++I) {
EmitAlignment(4); EmitAlignment(4);
const FnStubInfo &Info = I->second;
const char *p = I->getKeyData(); const char *p = I->getKeyData();
bool hasQuote = p[0]=='\"'; bool hasQuote = p[0]=='\"';
printSuffixedName(p, "$stub"); O << Info.Stub << ":\n";
O << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << '\n';
O << "\t.indirect_symbol " << p << '\n';
O << "\tmflr r0\n"; O << "\tmflr r0\n";
O << "\tbcl 20,31,"; O << "\tbcl 20,31,";
if (hasQuote) if (hasQuote)
@ -1006,9 +1007,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
O << "L0$" << p; O << "L0$" << p;
O << ":\n"; O << ":\n";
O << "\tmflr r11\n"; O << "\tmflr r11\n";
O << "\taddis r11,r11,ha16("; O << "\taddis r11,r11,ha16(" << Info.LazyPtr << "-";
printSuffixedName(p, "$lazy_ptr");
O << "-";
if (hasQuote) if (hasQuote)
O << "\"L0$" << &p[1]; O << "\"L0$" << &p[1];
else else
@ -1019,8 +1018,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
O << "\tldu r12,lo16("; O << "\tldu r12,lo16(";
else else
O << "\tlwzu r12,lo16("; O << "\tlwzu r12,lo16(";
printSuffixedName(p, "$lazy_ptr"); O << Info.LazyPtr << "-";
O << "-";
if (hasQuote) if (hasQuote)
O << "\"L0$" << &p[1]; O << "\"L0$" << &p[1];
else else
@ -1029,9 +1027,8 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
O << "\tmtctr r12\n"; O << "\tmtctr r12\n";
O << "\tbctr\n"; O << "\tbctr\n";
SwitchToDataSection(".lazy_symbol_pointer"); SwitchToDataSection(".lazy_symbol_pointer");
printSuffixedName(p, "$lazy_ptr"); O << Info.LazyPtr << ":\n";
O << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << '\n';
O << "\t.indirect_symbol " << p << '\n';
if (isPPC64) if (isPPC64)
O << "\t.quad dyld_stub_binding_helper\n"; O << "\t.quad dyld_stub_binding_helper\n";
else else
@ -1043,25 +1040,20 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end(); for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) { I != E; ++I) {
EmitAlignment(4); EmitAlignment(4);
const char *p = I->getKeyData(); const FnStubInfo &Info = I->second;
printSuffixedName(p, "$stub"); O << Info.Stub << ":\n";
O << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << '\n';
O << "\t.indirect_symbol " << p << '\n'; O << "\tlis r11,ha16(" << Info.LazyPtr << ")\n";
O << "\tlis r11,ha16(";
printSuffixedName(p, "$lazy_ptr");
O << ")\n";
if (isPPC64) if (isPPC64)
O << "\tldu r12,lo16("; O << "\tldu r12,lo16(";
else else
O << "\tlwzu r12,lo16("; O << "\tlwzu r12,lo16(";
printSuffixedName(p, "$lazy_ptr"); O << Info.LazyPtr << ")(r11)\n";
O << ")(r11)\n";
O << "\tmtctr r12\n"; O << "\tmtctr r12\n";
O << "\tbctr\n"; O << "\tbctr\n";
SwitchToDataSection(".lazy_symbol_pointer"); SwitchToDataSection(".lazy_symbol_pointer");
printSuffixedName(p, "$lazy_ptr"); O << Info.LazyPtr << ":\n";
O << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << '\n';
O << "\t.indirect_symbol " << p << '\n';
if (isPPC64) if (isPPC64)
O << "\t.quad dyld_stub_binding_helper\n"; O << "\t.quad dyld_stub_binding_helper\n";
else else