split function stub printing out to its own function,

no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94030 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-20 21:19:44 +00:00
parent d3ec0b5446
commit 917d628256

View File

@@ -390,6 +390,8 @@ namespace {
bool doFinalization(Module &M);
void EmitStartOfAsmFile(Module &M);
void EmitFunctionStubs();
void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<MachineModuleInfo>();
@@ -842,23 +844,17 @@ void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {
OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
}
bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
const TargetData *TD = TM.getTargetData();
void PPCDarwinAsmPrinter::EmitFunctionStubs() {
bool isPPC64 = TM.getTargetData()->getPointerSizeInBits() == 64;
bool isPPC64 = TD->getPointerSizeInBits() == 64;
// Darwin/PPC always uses mach-o.
TargetLoweringObjectFileMachO &TLOFMacho =
static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
MachineModuleInfoMachO &MMIMacho =
MMI->getObjFileInfo<MachineModuleInfoMachO>();
const MCSection *LSPSection = 0;
if (!FnStubs.empty()) // .lazy_symbol_pointer
LSPSection = TLOFMacho.getLazySymbolPointerSection();
// .lazy_symbol_pointer
const MCSection *LSPSection = TLOFMacho.getLazySymbolPointerSection();
// Output stubs for dynamically-linked functions
if (TM.getRelocationModel() == Reloc::PIC_ && !FnStubs.empty()) {
if (TM.getRelocationModel() == Reloc::PIC_) {
const MCSection *StubSection =
TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1",
MCSectionMachO::S_SYMBOL_STUBS |
@@ -889,7 +885,10 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
O << "\t.indirect_symbol " << *I->first << '\n';
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
}
} else if (!FnStubs.empty()) {
O << '\n';
return;
}
const MCSection *StubSection =
TLOFMacho.getMachOSection("__TEXT","__symbol_stub1",
MCSectionMachO::S_SYMBOL_STUBS |
@@ -914,9 +913,22 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
O << "\t.indirect_symbol " << *I->first << '\n';
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
}
}
O << '\n';
}
bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
bool isPPC64 = TM.getTargetData()->getPointerSizeInBits() == 64;
// Darwin/PPC always uses mach-o.
TargetLoweringObjectFileMachO &TLOFMacho =
static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
MachineModuleInfoMachO &MMIMacho =
MMI->getObjFileInfo<MachineModuleInfoMachO>();
if (!FnStubs.empty())
EmitFunctionStubs();
if (MAI->doesSupportExceptionHandling() && MMI) {
// Add the (possibly multiple) personalities to the set of global values.