]> granicus.if.org Git - clang/commit
[RISCV] Implement RISCV ABI lowering
authorAlex Bradbury <asb@lowrisc.org>
Mon, 15 Jan 2018 17:54:52 +0000 (17:54 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Mon, 15 Jan 2018 17:54:52 +0000 (17:54 +0000)
commite0f57df6fa23b61ac3e065244cf190e870e9d158
tree721b0accb36d98a98c247377c4b89d3a786a8986
parenta73a299e6b81e72cb50aa8ec5e8b04de7f4e1f81
[RISCV] Implement RISCV ABI lowering

RISCVABIInfo is implemented in terms of XLen, supporting both RV32 and RV64.
Unfortunately we need to count argument registers in the frontend in order to
determine when to emit signext and zeroext attributes. Integer scalars are
extended according to their type up to 32-bits and then sign-extended to XLen
when passed in registers, but are anyext when passed on the stack. This patch
only implements the base integer (soft float) ABIs.

For more information on the RISC-V ABI, see [the ABI
doc](https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md),
my [golden model](https://github.com/lowRISC/riscv-calling-conv-model), and
the [LLVM RISC-V calling convention
patch](https://reviews.llvm.org/D39898#2d1595b4) (specifically the comment
documenting frontend expectations).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322494 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/TargetInfo.cpp
test/CodeGen/riscv32-abi.c [new file with mode: 0644]
test/CodeGen/riscv64-abi.c [new file with mode: 0644]
test/Driver/riscv32-toolchain.c
test/Driver/riscv64-toolchain.c