This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Fix PCS for functions taking/returning scalable types.
ClosedPublic

Authored by sdesmalen on Jul 17 2020, 9:35 AM.

Details

Summary

The default calling convention needs to save/restore the SVE callee
saves according to the SVE PCS when the function takes or returns
scalable types, even when the aarch64_sve_vector_pcs CC is not
specified for the function.

Diff Detail

Event Timeline

sdesmalen created this revision.Jul 17 2020, 9:35 AM
Herald added a project: Restricted Project. · View Herald Transcript
llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
51–56

Could just do return any_of(...

73

Since the SVE calling convention is really an extension of the "normal" calling convention I think it makes sense for this logic to be at the bottom just before the return. So the flow is:

if (function_specifies_calling_convention_x)
  return calling_convention_x_save_list
if (function_specifies_calling_convention_y)
  return calling_convention_y_save_list
....
if (function_has_sve_args_or_return)
 return sve_save_list

return default_save_list

I guess you could leave the CallingConv::AArch64_SVE_VectorCall code as is given it fits this mould, but since this isn't supposed to be a user visible attribute I wonder if we can remove it at a later date?

sdesmalen updated this revision to Diff 279218.Jul 20 2020, 6:18 AM
sdesmalen marked 2 inline comments as done.
  • s/needsSVECallingConvention/hasSVEArgsorReturn/
  • Moved case to bottom of if/else chain.
paulwalker-arm accepted this revision.Jul 20 2020, 6:29 AM
paulwalker-arm added inline comments.
llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
43

s/hasSVEArgsorReturn/hasSVEArgsOrReturn/ ?

This revision is now accepted and ready to land.Jul 20 2020, 6:29 AM
This revision was automatically updated to reflect the committed changes.