]> granicus.if.org Git - llvm/commit
[AArch64][GlobalISel] Support lowering variadic musttail calls
authorJessica Paquette <jpaquette@apple.com>
Mon, 30 Sep 2019 16:49:13 +0000 (16:49 +0000)
committerJessica Paquette <jpaquette@apple.com>
Mon, 30 Sep 2019 16:49:13 +0000 (16:49 +0000)
commitb40beba15eaa241a1df61be14d00e8636c6ef502
tree09ca7119fa0d0f452c477e337fa6b25fdc478fa9
parent56a15930fae68c55bd5813a0dc1ec3a7d23f2246
[AArch64][GlobalISel] Support lowering variadic musttail calls

This adds support for lowering variadic musttail calls. To do this, we have
to...

- Detect a musttail call in a variadic function before attempting to lower the
  call's formal arguments. This is done in the IRTranslator.
- Compute forwarded registers in `lowerFormalArguments`, and add copies for
  those registers.
- Restore the forwarded registers in `lowerTailCall`.

Because there doesn't seem to be any nice way to wrap these up into the outgoing
argument handler, the restore code in `lowerTailCall` is done separately.

Also, irritatingly, you have to make sure that the registers don't overlap with
any passed parameters. Otherwise, the scheduler doesn't know what to do with the
extra copies and asserts.

Add call-translator-variadic-musttail.ll to test this. This is pretty much the
same as the X86 musttail-varargs.ll test. We didn't have as nice of a test to
base this off of, but the idea is the same.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373226 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/GlobalISel/IRTranslator.cpp
lib/Target/AArch64/AArch64CallLowering.cpp
test/CodeGen/AArch64/GlobalISel/call-translator-variadic-musttail.ll [new file with mode: 0644]