]> granicus.if.org Git - llvm/commit
[AArch64] Implement initial SVE calling convention support
authorCullen Rhodes <cullen.rhodes@arm.com>
Mon, 5 Aug 2019 13:44:10 +0000 (13:44 +0000)
committerCullen Rhodes <cullen.rhodes@arm.com>
Mon, 5 Aug 2019 13:44:10 +0000 (13:44 +0000)
commit1f983cdc402ece773279295e00c5bddd02eece9e
tree33b7b1db63fa8c1ab67da84e7f64d5417811758b
parentca995d3d136659b7d129563b3813f12ec54a30f1
[AArch64] Implement initial SVE calling convention support

Summary:

This patch adds initial support for the SVE calling convention such that
SVE types can be passed as arguments and return values to/from a
subroutine.

The SVE AAPCS states [1]:

    z0-z7 are used to pass scalable vector arguments to a subroutine,
    and to return scalable vector results from a function. If a
    subroutine takes arguments in scalable vector or predicate
    registers, or if it is a function that returns results in such
    registers, it must ensure that the entire contents of z8-z23 are
    preserved across the call. In other cases it need only preserve the
    low 64 bits of z8-z15, as described in ยง5.1.2.

    p0-p3 are used to pass scalable predicate arguments to a subroutine
    and to return scalable predicate results from a function. If a
    subroutine takes arguments in scalable vector or predicate
    registers, or if it is a function that returns results in these
    registers, it must ensure that p4-p15 are preserved across the call.
    In other cases it need not preserve any scalable predicate register
    contents.

SVE predicate and data registers are passed indirectly (i.e. spilled to the
stack and pass the address) if they exceed the registers used for argument
passing defined by the PCS referenced above.  Until SVE stack support is merged
we can't spill SVE registers to the stack, so currently an llvm_unreachable is
used where we will eventually handle this.

[1] https://static.docs.arm.com/100986/0000/100986_0000.pdf

Reviewed By: ostannard

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367859 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/CallingConv.h
lib/Target/AArch64/AArch64CallingConvention.td
lib/Target/AArch64/AArch64ISelLowering.cpp
lib/Target/AArch64/AArch64RegisterInfo.cpp
test/CodeGen/AArch64/sve-calling-convention.ll [new file with mode: 0644]