aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-11-28 18:21:52 +0000
committerJim Laskey <jlaskey@mac.com>2006-11-28 18:21:52 +0000
commit2ada08536e30dbcbea21addc814f3bf8a394a4ee (patch)
tree796c70b07d5e5600bb8dd9650174502f98e9d0ad
parente9bd7b2e03252391dce5cacd4fcf68df4d4eef7a (diff)
downloadexternal_llvm-2ada08536e30dbcbea21addc814f3bf8a394a4ee.zip
external_llvm-2ada08536e30dbcbea21addc814f3bf8a394a4ee.tar.gz
external_llvm-2ada08536e30dbcbea21addc814f3bf8a394a4ee.tar.bz2
Prime text sections to improve branch locality in large object files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31969 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 7ac4233..b5962ea 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/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;