[PowerPC] ABI support for aligned by-value aggregates
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 10 Jul 2014 17:20:07 +0000 (17:20 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 10 Jul 2014 17:20:07 +0000 (17:20 +0000)
commit581badce4be5243cd9af31277a99e80f9f0180e6
tree0ec18b2a8a3977c9f6ddcc01f5080ba19a4cfd30
parent04934b0feca39e7d7818aa8d9b312c53e78f9785
[PowerPC] ABI support for aligned by-value aggregates

This patch adds support for respecting the ABI and type alignment
of aggregates passed by value.  Currently, all aggregates are aligned
at 8 bytes in the parameter save area.  This is incorrect for two
reasons:

- Aggregates that need alignment of 16 bytes or more should be aligned
  at 16 bytes in the parameter save area.  This is implemented by
  using an appropriate "byval align" attribute in the IR.

- Aggregates that need alignment beyond 16 bytes need to be dynamically
  realigned by the caller.  This is implemented by setting the Realign
  flag of the ABIArgInfo::getIndirect call.

In addition, when expanding a va_arg call accessing a type that is
aligned at 16 bytes in the argument save area (either one of the
aggregate types as above, or a vector type which is already aligned
at 16 bytes), code needs to align the va_list pointer accordingly.

Reviewed by Hal Finkel.

llvm-svn: 212743
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/ppc64-align-struct.c [new file with mode: 0644]
clang/test/CodeGen/ppc64-vector.c