[all-commits] [llvm/llvm-project] 8d2e9f: [PowerPC] Add function pointer alignment to DataLa...

David Tenty via All-commits all-commits at lists.llvm.org
Tue Apr 18 10:02:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d2e9fc8553c91b1f22e82ffc2c00020f40bb0a2
      https://github.com/llvm/llvm-project/commit/8d2e9fc8553c91b1f22e82ffc2c00020f40bb0a2
  Author: David Tenty <daltenty at ibm.com>
  Date:   2023-04-18 (Tue, 18 Apr 2023)

  Changed paths:
    M clang/lib/Basic/Targets/OSTargets.h
    M clang/lib/Basic/Targets/PPC.h
    M clang/test/CodeGen/target-data.c
    M llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
    M llvm/test/CodeGen/PowerPC/pr45301.ll
    M llvm/test/ThinLTO/X86/builtin-nostrip-aix.ll

  Log Message:
  -----------
  [PowerPC] Add function pointer alignment to DataLayout

The alignment of function pointers was added to the Datalayout by
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).

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D147016




More information about the All-commits mailing list