[PATCH] D147016: [PowerPC] Add function pointer alignment to DataLayout
David Tenty via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 18:05:02 PDT 2023
daltenty created this revision.
Herald added subscribers: ormris, shchenz, steven_wu, kbarton, hiraditya, nemanjai.
Herald added a project: All.
daltenty requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The alignment of function pointers was added to the Datalayout by
D57335 <https://reviews.llvm.org/D57335> but currently is unset for the Power target. This will cause us
to compute a conservative minimum alignment of one if places like
Value::getPointerAlignment.
This patch implements the function pointer alignment in the Datalayout
for the Power backend and Power targets in clang, so we can query the
value for a particular Power target.
We come up with the correct value one of two ways:
- If the target uses function descriptor objects (i.e. ELFv1 & AIX ABIs), then a function pointer points to the descriptor, so use the alignment we would emit the descriptor with.
- If the target doesn't use function descriptor objects (i.e. ELFv2), a function pointer points to the global entry point, so use the minimum alignment for code on Power (i.e. 4-bytes).
https://reviews.llvm.org/D147016
Files:
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/PPC.h
clang/test/CodeGen/target-data.c
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
llvm/test/CodeGen/PowerPC/pr45301.ll
llvm/test/ThinLTO/X86/builtin-nostrip-aix.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147016.508863.patch
Type: text/x-patch
Size: 8450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230328/26297f5f/attachment-0001.bin>
More information about the llvm-commits
mailing list