This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Use the correct calling conv for calls
ClosedPublic

Authored by rovka on Mar 16 2017, 10:16 AM.

Details

Summary

This commit adds a parameter that lets us pass in the calling convention
of the call to CallLowering::lowerCall. This allows us to handle
situations where the calling convention of the callee is different from
that of the caller.

Diff Detail

Repository
rL LLVM

Event Timeline

rovka created this revision.Mar 16 2017, 10:16 AM
javed.absar edited edge metadata.Mar 16 2017, 12:41 PM

Hi Diana:
nitpick - typo in commit message 'convetion'.
I see a test for arm but not for aarch64 case. Would it make sense to add one for it as well?
Thanks, Javed

dsanders accepted this revision.Mar 16 2017, 1:36 PM

LGTM with the typo fixed and an AArch64 test case (if it's possible).

For the AArch64 test case, I'm not familiar with ARM/AArch64 calling conventions but I'm told that fastcall vs. non-fastcall might be the only way to test it there.

This revision is now accepted and ready to land.Mar 16 2017, 1:36 PM
rovka updated this revision to Diff 92114.Mar 17 2017, 3:06 AM
rovka edited the summary of this revision. (Show Details)

Thanks for reviewing!

I don't think it's possible to add a test using fastcc, because AArch64TargetLowering::CCAssignFnForCall returns the same calling conv for fastcc as for C, PreserveMost etc. The only ones that are different are the calling convs for WebKit_JS (but I think they're moving away from LLVM anyway) and GHC.

I've added a test using ghccc since it's probably better to have an artificial test than no test. I'll commit on Monday if nobody comes up with a better idea.

This revision was automatically updated to reflect the committed changes.

Thanks for reviewing!

I don't think it's possible to add a test using fastcc, because AArch64TargetLowering::CCAssignFnForCall returns the same calling conv for fastcc as for C, PreserveMost etc. The only ones that are different are the calling convs for WebKit_JS (but I think they're moving away from LLVM anyway) and GHC.

Ok

I've added a test using ghccc since it's probably better to have an artificial test than no test. I'll commit on Monday if nobody comes up with a better idea.

That sounds good to me, Thanks.