This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add support for long-call/short-call attribute
Needs ReviewPublic

Authored by weimingz on Apr 27 2016, 11:49 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

GNU has long_call/short_call attribute support for ARM: https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/ARM-Function-Attributes.html#ARM-Function-Attributes.

LLVM/clang only supports the global switch/option (-mlong-call -mno-long-call). In some scenarios, we need to turn it on/off for individual functions.

Clang patch: http://reviews.llvm.org/D19610

Diff Detail

Event Timeline

weimingz updated this revision to Diff 55272.Apr 27 2016, 11:49 AM
weimingz retitled this revision from to [ARM] Add support for long-call/short-call attribute.
weimingz updated this object.
weimingz set the repository for this revision to rL LLVM.
weimingz updated this object.Apr 27 2016, 11:51 AM
weimingz added a subscriber: llvm-commits.

Hi Weiming,

I've got two issues with the current implementation:

First, I think this should be an attribute on the call-site rather than the callee. You could easily imagine (particularly in LTO situations targeting weird embedded memory layouts) mutually short-callable clusters of functions that need long-calls between those groups. If the attribute is fixed on the callee that's not going to work.

Second, I don't really think "target-features" is the place for this attribute. They're meant to affect the CodeGen of the function definition, not really what callees do with it as far as I can see.

Cheers.

Tim.

Hmm, on the other hand annotating the call-site isn't going to work for indirect calls that become apparent after optimization. Annotating the callee's declaration looks like it happens to work in that case.

Hi Weiming,

I've got two issues with the current implementation:

First, I think this should be an attribute on the call-site rather than the callee. You could easily imagine (particularly in LTO situations targeting weird embedded memory layouts) mutually short-callable clusters of functions that need long-calls between those groups. If the attribute is fixed on the callee that's not going to work.

Second, I don't really think "target-features" is the place for this attribute. They're meant to affect the CodeGen of the function definition, not really what callees do with it as far as I can see.

Cheers.

Tim.

Hi Tim,

Yes, we should let clang to carry the info on call site. (via metadata?)
If we do so, we don't need to worry about placing it into target-features.

Hmm, on the other hand annotating the call-site isn't going to work for indirect calls that become apparent after optimization. Annotating the callee's declaration looks like it happens to work in that case.

Should we still use taget-features to hold the flag?

For LTO scenario, if we annotate callee declaration, when they are merged from different modules, we can merge them conservatively.