This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Support sibling calls with mismatched calling conventions
ClosedPublic

Authored by paquette on Sep 9 2019, 10:30 AM.

Details

Summary

Add support for sib/tail calling 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 mismatched calling conventions.
  • Add a GISel line to tailcall-ccmismatch.ll to show that we will not tail call when the regmasks don't line up.

Diff Detail

Event Timeline

paquette created this revision.Sep 9 2019, 10:30 AM
aemerson accepted this revision.Sep 10 2019, 3:46 PM

LGTM.

This revision is now accepted and ready to land.Sep 10 2019, 3:46 PM
This revision was automatically updated to reflect the committed changes.