aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-05 02:42:20 +0000
committerChris Lattner <sabre@nondot.org>2006-10-05 02:42:20 +0000
commit9b7ce7da820ada2cdada185de9c9aa94298e485e (patch)
tree514e09330249da48ea28bef8edddea6757cf0bd7 /lib/Target/PowerPC/PPCAsmPrinter.cpp
parent1279b7c2a9849b499d5997d7efb5c0d6e902ca62 (diff)
Move getSectionForFunction to AsmPrinter, change it to return a string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 252109a421..b7e7f2878e 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -238,7 +238,6 @@ namespace {
virtual bool runOnMachineFunction(MachineFunction &F) = 0;
virtual bool doFinalization(Module &M) = 0;
-
};
/// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS
@@ -267,6 +266,9 @@ namespace {
PPCAsmPrinter::getAnalysisUsage(AU);
}
+ /// getSectionForFunction - Return the section that we should emit the
+ /// specified function body into.
+ virtual std::string getSectionForFunction(const Function &F) const;
};
} // end of anonymous namespace
@@ -408,6 +410,19 @@ void PPCAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
return;
}
+
+
+std::string DarwinAsmPrinter::getSectionForFunction(const Function &F) const {
+ switch (F.getLinkage()) {
+ default: assert(0 && "Unknown linkage type!");
+ case Function::ExternalLinkage:
+ case Function::InternalLinkage: return TAI->getTextSection();
+ case Function::WeakLinkage:
+ case Function::LinkOnceLinkage:
+ return ".section __TEXT,__textcoal_nt,coalesced,pure_instructions";
+ }
+}
+
/// runOnMachineFunction - This uses the printMachineInstruction()
/// method to print assembly for each instruction.
///
@@ -422,7 +437,7 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToTextSection(TAI->getSectionForFunction(*F), F);
+ SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
switch (F->getLinkage()) {
default: assert(0 && "Unknown linkage type!");