]> granicus.if.org Git - clang/commit
[RISCV] Hard float ABI support
authorAlex Bradbury <asb@lowrisc.org>
Thu, 18 Jul 2019 15:33:41 +0000 (15:33 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Thu, 18 Jul 2019 15:33:41 +0000 (15:33 +0000)
commit7ceef36a33006bd7cabdf50030f55a9940016aff
tree598b617596ee7345563961a26b7646b73292f7cf
parent449753109dfd0a96900ef409618fee4333dd81c1
[RISCV] Hard float ABI support

The RISC-V hard float calling convention requires the frontend to:

* Detect cases where, once "flattened", a struct can be passed using
int+fp or fp+fp registers under the hard float ABI and coerce to the
appropriate type(s) * Track usage of GPRs and FPRs in order to gate the
above, and to
determine when signext/zeroext attributes must be added to integer
scalars

This patch attempts to do this in compliance with the documented ABI,
and uses ABIArgInfo::CoerceAndExpand in order to do this. @rjmccall, as
author of that code I've tagged you as reviewer for initial feedback on
my usage.

Note that a previous version of the ABI indicated that when passing an
int+fp struct using a GPR+FPR, the int would need to be sign or
zero-extended appropriately. GCC never did this and the ABI was changed,
which makes life easier as ABIArgInfo::CoerceAndExpand can't currently
handle sign/zero-extension attributes.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366450 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
lib/Basic/Targets/RISCV.cpp
lib/Basic/Targets/RISCV.h
lib/CodeGen/TargetInfo.cpp
test/CodeGen/riscv32-ilp32-ilp32f-abi.c
test/CodeGen/riscv32-ilp32-ilp32f-ilp32d-abi.c
test/CodeGen/riscv32-ilp32d-abi.c [new file with mode: 0644]
test/CodeGen/riscv32-ilp32f-abi.c [new file with mode: 0644]
test/CodeGen/riscv32-ilp32f-ilp32d-abi.c [new file with mode: 0644]
test/CodeGen/riscv64-lp64-lp64f-abi.c
test/CodeGen/riscv64-lp64-lp64f-lp64d-abi.c
test/CodeGen/riscv64-lp64d-abi.c [new file with mode: 0644]
test/CodeGen/riscv64-lp64f-lp64d-abi.c [new file with mode: 0644]
test/Preprocessor/riscv-target-features.c