]> granicus.if.org Git - llvm/commit
[AArch64][GlobalISel] Support sibling calls with mismatched calling conventions
authorJessica Paquette <jpaquette@apple.com>
Tue, 10 Sep 2019 23:25:12 +0000 (23:25 +0000)
committerJessica Paquette <jpaquette@apple.com>
Tue, 10 Sep 2019 23:25:12 +0000 (23:25 +0000)
commit2b4a4312b83817ddea35431a4aac5c6bf1323af0
treeb06bc9634d7900548120959ed27d2f5f4c8a4717
parent52caba8a24717968e09cd4ba0351637ac7af2fe6
[AArch64][GlobalISel] Support sibling calls with mismatched calling conventions

Add support for sibcalling calls whose calling convention differs from the
caller's.

- Port over `CCState::resultsCombatible` from CallingConvLower.cpp into
  CallLowering. This is used to verify that the way the caller and callee CC
  handle incoming arguments matches up.

- Add `CallLowering::analyzeCallResult`. This is basically a port of
  `CCState::AnalyzeCallResult`, but using `ArgInfo` rather than `ISD::InputArg`.

- Add `AArch64CallLowering::doCallerAndCalleePassArgsTheSameWay`. This checks
  that the calling conventions are compatible, and that the caller and callee
  preserve the same registers.

For testing:

- Update call-translator-tail-call.ll to show that we can now handle this.

- Add a GISel line to tailcall-ccmismatch.ll to show that we will not tail call
  when the regmasks don't line up.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371570 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/GlobalISel/CallLowering.h
lib/CodeGen/GlobalISel/CallLowering.cpp
lib/Target/AArch64/AArch64CallLowering.cpp
lib/Target/AArch64/AArch64CallLowering.h
test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll
test/CodeGen/AArch64/tailcall-ccmismatch.ll