This is an archive of the discontinued LLVM Phabricator instance.

Make RWPI use movw/movt when available
ClosedPublic

Authored by christof on Feb 3 2017, 2:30 AM.

Details

Summary

When constructing global address literals while targeting the RWPI relocation model. LLVM currently only uses literal pools. If MOVW/MOVT instructions are available we can use these instead. Beside being more efficient it allows -arm-execute-only to work with -relocation-model=RWPI as well.

When we generate MOVW/MOVT for global addresses when targeting the RWPI relocation model, we need to use base relative relocations. This patch does the needed plumbing in MC to generate these for MOVW/MOVT.

Diff Detail

Repository
rL LLVM

Event Timeline

christof created this revision.Feb 3 2017, 2:30 AM
christof edited the summary of this revision. (Show Details)Feb 3 2017, 3:18 AM
olista01 edited edge metadata.Feb 3 2017, 3:39 AM

The test change removes the tests of the constant-pool code path, but it looks like this path will still be used when optimising for size and not using execute-only. Could you extend the tests to check both code-paths?

lib/Target/ARM/ARMISelLowering.cpp
3195 ↗(On Diff #86944)

The getCopyFromReg and ISD::ADD are duplicated, could they be pulled below the if?

christof updated this revision to Diff 86967.Feb 3 2017, 8:21 AM

Added tests for ARM and Thumb2 without MOVT support and addressed the inline comments.

christof marked an inline comment as done.Feb 3 2017, 8:21 AM
olista01 accepted this revision.Feb 3 2017, 8:32 AM

Thanks, LGTM.

This revision is now accepted and ready to land.Feb 3 2017, 8:32 AM
This revision was automatically updated to reflect the committed changes.