]> granicus.if.org Git - clang/commit
[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)
commit3e86dfcf1398b8c7f9f8a595c500f4b12a574d26
tree2e3b88fea62ea3eb5416ceacf6bd8dccbc790abf
parentc323166942f4de75e027cffb269d3d7e5e707156
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213494 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/TargetInfo.cpp
test/CodeGen/ppc64le-aggregates.c [new file with mode: 0644]