[ARM] Fix -mpure-code for v6m
authorChristophe Lyon <christophe.lyon@linaro.org>
Tue, 25 Feb 2020 15:54:14 +0000 (15:54 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Tue, 25 Feb 2020 15:54:14 +0000 (15:54 +0000)
commita71f2193d0df71a86c4743aab22891bb0003112e
treea639ee88ae4d7bbd52678e5b69c83e01995303b0
parent73dc4ae47418aef2eb470b8f71cef57dce37349e
[ARM] Fix -mpure-code for v6m

When running the testsuite with -fdisable-rtl-fwprop2 and -mpure-code
for cortex-m0, I noticed that some testcases were failing because we
still generate "ldr rX, .LCY", which is what we want to avoid with
-mpure-code. This is latent since a recent improvement in fwprop
(PR88833).

In this patch I change the thumb1_movsi_insn pattern so that it emits
the desired instruction sequence when arm_disable_literal_pool is set.

To achieve that, I introduce a new required_for_purecode attribute to
enable the corresponding alternative in thumb1_movsi_insn and take the
actual instruction sequence length into account.

gcc/ChangeLog:

2020-02-13  Christophe Lyon  <christophe.lyon@linaro.org>

* config/arm/arm.md (required_for_purecode): New attribute.
(enabled): Handle required_for_purecode.
* config/arm/thumb1.md (thumb1_movsi_insn): Add alternative to
work with -mpure-code.
gcc/ChangeLog
gcc/config/arm/arm.md
gcc/config/arm/thumb1.md