summaryrefslogtreecommitdiff
path: root/lib/Target/AArch64/AArch64ISelLowering.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/AArch64/AArch64ISelLowering.cpp')
-rw-r--r--lib/Target/AArch64/AArch64ISelLowering.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Target/AArch64/AArch64ISelLowering.cpp b/lib/Target/AArch64/AArch64ISelLowering.cpp
index 852d324476..a676600e5d 100644
--- a/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -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;
+}
+