[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCTargetAsmInfo.cpp PPCTargetAsmInfo.h
Chris Lattner
sabre at nondot.org
Wed Oct 4 17:36:04 PDT 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCAsmPrinter.cpp updated: 1.198 -> 1.199
PPCTargetAsmInfo.cpp updated: 1.3 -> 1.4
PPCTargetAsmInfo.h updated: 1.1 -> 1.2
---
Log message:
implement DarwinTargetAsmInfo::getSectionForFunction, use it when outputting
function bodies
---
Diffs of the changes: (+21 -6)
PPCAsmPrinter.cpp | 6 ++----
PPCTargetAsmInfo.cpp | 14 +++++++++++++-
PPCTargetAsmInfo.h | 7 ++++++-
3 files changed, 21 insertions(+), 6 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.198 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.199
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.198 Wed Oct 4 19:26:05 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Oct 4 19:35:50 2006
@@ -422,19 +422,17 @@
// Print out labels for the function.
const Function *F = MF.getFunction();
+ SwitchToTextSection(TAI->getSectionForFunction(*F), F);
+
switch (F->getLinkage()) {
default: assert(0 && "Unknown linkage type!");
case Function::InternalLinkage: // Symbols default to internal.
- SwitchToTextSection("\t.text", F);
break;
case Function::ExternalLinkage:
- SwitchToTextSection("\t.text", F);
O << "\t.globl\t" << CurrentFnName << "\n";
break;
case Function::WeakLinkage:
case Function::LinkOnceLinkage:
- SwitchToTextSection(
- ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F);
O << "\t.globl\t" << CurrentFnName << "\n";
O << "\t.weak_definition\t" << CurrentFnName << "\n";
break;
Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.3 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.4
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.3 Mon Sep 25 22:39:53 2006
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Wed Oct 4 19:35:50 2006
@@ -13,7 +13,7 @@
#include "PPCTargetAsmInfo.h"
#include "PPCTargetMachine.h"
-
+#include "llvm/Function.h"
using namespace llvm;
DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) {
@@ -50,3 +50,15 @@
DwarfRangesSection = ".section __DWARF,__debug_ranges";
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo";
}
+
+
+const char *DarwinTargetAsmInfo::getSectionForFunction(const Function &F) const{
+ switch (F.getLinkage()) {
+ default: assert(0 && "Unknown linkage type!");
+ case Function::ExternalLinkage:
+ case Function::InternalLinkage: return TextSection;
+ case Function::WeakLinkage:
+ case Function::LinkOnceLinkage:
+ return ".section __TEXT,__textcoal_nt,coalesced,pure_instructions";
+ }
+}
Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.1 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.2
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.1 Thu Sep 7 17:05:02 2006
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h Wed Oct 4 19:35:50 2006
@@ -23,9 +23,14 @@
struct DarwinTargetAsmInfo : public TargetAsmInfo {
DarwinTargetAsmInfo(const PPCTargetMachine &TM);
+
+ /// getSectionForFunction - Return the section that we should emit the
+ /// specified function body into. This defaults to 'TextSection'. This
+ /// should most likely be overridden by the target to put linkonce/weak
+ /// functions into special sections.
+ virtual const char *getSectionForFunction(const Function &F) const;
};
-
} // namespace llvm
#endif
More information about the llvm-commits
mailing list