diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-11-28 18:21:52 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-11-28 18:21:52 +0000 |
commit | ec05b046c716e8b286e1cbb12cca1dbcabff1a38 (patch) | |
tree | 0588ad688ff75b8a97f938a1b25bcc732281480f /llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | |
parent | f4e2e009d9d8e6d12c21a1d17504ad0602a1c203 (diff) | |
download | bcm5719-llvm-ec05b046c716e8b286e1cbb12cca1dbcabff1a38.tar.gz bcm5719-llvm-ec05b046c716e8b286e1cbb12cca1dbcabff1a38.zip |
Prime text sections to improve branch locality in large object files.
llvm-svn: 31969
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 7ac423348ab..b5962ea215a 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -543,6 +543,19 @@ bool DarwinAsmPrinter::doInitialization(Module &M) { // Darwin wants symbols to be quoted if they have complex names. Mang->setUseQuotes(true); + // Prime text sections so they are adjacent. This reduces the likelihood a + // large data or debug section causes a branch to exceed 16M limit. + SwitchToTextSection(".section __TEXT,__textcoal_nt,coalesced," + "pure_instructions"); + if (TM.getRelocationModel() == Reloc::PIC_) { + SwitchToTextSection(".section __TEXT,__picsymbolstub1,symbol_stubs," + "pure_instructions,32"); + } else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) { + SwitchToTextSection(".section __TEXT,__symbol_stub1,symbol_stubs," + "pure_instructions,16"); + } + SwitchToTextSection(TAI->getTextSection()); + // Emit initial debug information. DW.BeginModule(&M); return false; |