use TLOF to compute the section for a function instead of

replicating the logic manually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-03 22:32:50 +00:00
parent 5544c6cad8
commit 5e44e472d6

View File

@ -253,18 +253,19 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
// NOTE: we don't print out constant pools here, they are handled as // NOTE: we don't print out constant pools here, they are handled as
// instructions. // instructions.
O << "\n"; O << '\n';
// Print out labels for the function. // Print out labels for the function.
const Function *F = MF.getFunction(); const Function *F = MF.getFunction();
SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
switch (F->getLinkage()) { switch (F->getLinkage()) {
default: llvm_unreachable("Unknown linkage type!"); default: llvm_unreachable("Unknown linkage type!");
case Function::PrivateLinkage: case Function::PrivateLinkage:
case Function::LinkerPrivateLinkage: case Function::LinkerPrivateLinkage:
case Function::InternalLinkage: case Function::InternalLinkage:
SwitchToTextSection("\t.text", F);
break; break;
case Function::ExternalLinkage: case Function::ExternalLinkage:
SwitchToTextSection("\t.text", F);
O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.globl\t" << CurrentFnName << "\n";
break; break;
case Function::WeakAnyLinkage: case Function::WeakAnyLinkage:
@ -272,8 +273,6 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::LinkOnceAnyLinkage: case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage: case Function::LinkOnceODRLinkage:
if (Subtarget->isTargetDarwin()) { if (Subtarget->isTargetDarwin()) {
SwitchToTextSection(
".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F);
O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.globl\t" << CurrentFnName << "\n";
O << "\t.weak_definition\t" << CurrentFnName << "\n"; O << "\t.weak_definition\t" << CurrentFnName << "\n";
} else { } else {