diff options
author | Stefan Pintilie <stefanp@ca.ibm.com> | 2023-09-07 09:38:56 -0400 |
---|---|---|
committer | Stefan Pintilie <stefanp@ca.ibm.com> | 2023-09-07 11:14:56 -0400 |
commit | 84e2fd7ee4a9bf76834151a802245bd0b6de8fd0 (patch) | |
tree | a9e2a0afa3415bf8fd39001f8cca51f2367a55cb /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | |
parent | 8d18671d8126a9c1ce930b91325e4cf30cb3bb8d (diff) | |
download | llvm-84e2fd7ee4a9bf76834151a802245bd0b6de8fd0.zip llvm-84e2fd7ee4a9bf76834151a802245bd0b6de8fd0.tar.gz llvm-84e2fd7ee4a9bf76834151a802245bd0b6de8fd0.tar.bz2 |
[PowerPC] Add a pass to merge all of the constant global arrays into one pool.
On PowerPC the number of TOC entries must be kept low for large
applications. In order to reduce the number of constant global arrays
we can pool them into one structure and then access them as the base
address of that structure plus some offset. The constant global arrays
may be arrays of `i8` which are constant strings but they may also be
arrays of `i32, i64, etc...`.
Reviewed By: lei, amyk
Differential Revision: https://reviews.llvm.org/D155730
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 3858d44..52bbfea 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -100,6 +100,11 @@ static cl::opt<bool> cl::desc("Expand eligible cr-logical binary ops to branches"), cl::init(true), cl::Hidden); +static cl::opt<bool> MergeStringPool( + "ppc-merge-string-pool", + cl::desc("Merge all of the strings in a module into one pool"), + cl::init(false), cl::Hidden); + static cl::opt<bool> EnablePPCGenScalarMASSEntries( "enable-ppc-gen-scalar-mass", cl::init(false), cl::desc("Enable lowering math functions to their corresponding MASS " @@ -137,6 +142,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTarget() { initializeGlobalISel(PR); initializePPCCTRLoopsPass(PR); initializePPCDAGToDAGISelPass(PR); + initializePPCMergeStringPoolPass(PR); } static bool isLittleEndianTriple(const Triple &T) { @@ -484,6 +490,9 @@ void PPCPassConfig::addIRPasses() { } bool PPCPassConfig::addPreISel() { + if (MergeStringPool && getOptLevel() != CodeGenOpt::None) + addPass(createPPCMergeStringPoolPass()); + if (!DisableInstrFormPrep && getOptLevel() != CodeGenOpt::None) addPass(createPPCLoopInstrFormPrepPass(getPPCTargetMachine())); |