mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
Implement global merge optimization for global variables.
This commit implements two command line switches -global-merge-on-external and -global-merge-aligned, and both of them are false by default, so this optimization is disabled by default for all targets. For ARM64, some back-end behaviors need to be tuned to get this optimization further enabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -5560,3 +5560,17 @@ unsigned AArch64TargetLowering::getMaximalGlobalOffset() const {
|
||||
return 4095;
|
||||
}
|
||||
|
||||
/// getGlobalMergeAlignment - Set alignment to be the max size of merged
|
||||
/// global variable data structure, and make it aligned up to power of 2.
|
||||
/// This way, we could guarantee the merged global variable data structure
|
||||
/// doesn't cross page boundary, because usually OS always allocates page at
|
||||
/// 4096-byte aligned boundary.
|
||||
unsigned AArch64TargetLowering::getGlobalMergeAlignment(
|
||||
StructType *MergedTy) const {
|
||||
unsigned Align = getDataLayout()->getTypeAllocSize(MergedTy);
|
||||
if (Align & (Align - 1))
|
||||
Align = llvm::NextPowerOf2(Align);
|
||||
|
||||
return Align;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user