diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-10-05 02:42:20 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-10-05 02:42:20 +0000 |
| commit | 028d663ee6c490745fca5fd8a970d35de352b8f4 (patch) | |
| tree | db21b38b53690f79b3bf44495f8f99fa309a56a9 /llvm | |
| parent | 0dca9271487a1afe253760b8c0850ea6453c3116 (diff) | |
| download | bcm5719-llvm-028d663ee6c490745fca5fd8a970d35de352b8f4.tar.gz bcm5719-llvm-028d663ee6c490745fca5fd8a970d35de352b8f4.zip | |
Move getSectionForFunction to AsmPrinter, change it to return a string.
llvm-svn: 30735
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 19 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 11 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h | 6 |
3 files changed, 17 insertions, 19 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 252109a4212..b7e7f2878e4 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/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!"); diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index f767a4428d6..02ba912fbf4 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -51,14 +51,3 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) { 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"; - } -} diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h index 6188862e9f7..ed8574c40d6 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h +++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h @@ -23,12 +23,6 @@ namespace llvm { 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 |

