[PowerPC] Support the ELFv2 ABI
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 21 Jul 2014 00:48:09 +0000 (00:48 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 21 Jul 2014 00:48:09 +0000 (00:48 +0000)
commitb712237da6acd42a9221787acea7880f8db3fa0c
treeb02784d5b8040b5ce8b8aad82a637135d23ae337
parent85d5df25de8eb6e11d558f22ac12fe320ee8ac82
[PowerPC] Support the ELFv2 ABI

This patch implements clang support for the PowerPC ELFv2 ABI.
Together with a series of companion patches in LLVM, this makes
clang/LLVM fully usable on powerpc64le-linux.

Most of the ELFv2 ABI changes are fully implemented on the LLVM side.
On the clang side, we only need to implement some changes in how
aggregate types are passed by value.   Specifically, we need to:
- pass (and return) "homogeneous" floating-point or vector aggregates in
  FPRs and VRs (this is similar to the ARM homogeneous aggregate ABI)
- return aggregates of up to 16 bytes in one or two GPRs

The second piece is trivial to implement in any case.  To implement
the first piece, this patch makes use of infrastructure recently
enabled in the LLVM PowerPC back-end to support passing array types
directly, where the array element type encodes properties needed to
handle homogeneous aggregates correctly.

Specifically, the array element type encodes:
- whether the parameter should be passed in FPRs, VRs, or just
  GPRs/stack slots  (for float / vector / integer element types,
  respectively)
- what the alignment requirements of the parameter are when passed in
  GPRs/stack slots  (8 for float / 16 for vector / the element type
  size for integer element types) -- this corresponds to the
  "byval align" field

With this support in place, the clang part simply needs to *detect*
whether an aggregate type implements a float / vector homogeneous
aggregate as defined by the ELFv2 ABI, and if so, pass/return it
as array type using the appropriate float / vector element type.

llvm-svn: 213494
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/ppc64le-aggregates.c [new file with mode: 0644]