[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCTargetAsmInfo.cpp PPCTargetAsmInfo.h
Chris Lattner
sabre at nondot.org
Wed Oct 4 19:42:34 PDT 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCAsmPrinter.cpp updated: 1.199 -> 1.200
PPCTargetAsmInfo.cpp updated: 1.4 -> 1.5
PPCTargetAsmInfo.h updated: 1.2 -> 1.3
---
Log message:
Move getSectionForFunction to AsmPrinter, change it to return a string.
---
Diffs of the changes: (+17 -19)
PPCAsmPrinter.cpp | 19 +++++++++++++++++--
PPCTargetAsmInfo.cpp | 11 -----------
PPCTargetAsmInfo.h | 6 ------
3 files changed, 17 insertions(+), 19 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.199 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.200
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.199 Wed Oct 4 19:35:50 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Oct 4 21:42:20 2006
@@ -238,7 +238,6 @@
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 @@
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 @@
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 @@
// 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!");
Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.4 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.5
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.4 Wed Oct 4 19:35:50 2006
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Wed Oct 4 21:42:20 2006
@@ -51,14 +51,3 @@
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.2 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.3
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.2 Wed Oct 4 19:35:50 2006
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h Wed Oct 4 21:42:20 2006
@@ -23,12 +23,6 @@
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
More information about the llvm-commits
mailing list