[ARM] Do no clobber r4 in Armv8-M nonsecure call
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Mon, 20 Nov 2017 11:06:05 +0000 (11:06 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Mon, 20 Nov 2017 11:06:05 +0000 (11:06 +0000)
commit0a413fbc6c7482c670fcf471dc3ecf2d50250a51
treeb4120e10b104047db7f673a8e8a535190fb4b0e7
parent4acdaf98f9fb9b0ab9e7e5bce5dd18f826703326
[ARM] Do no clobber r4 in Armv8-M nonsecure call

Expanders for Armv8-M nonsecure call unnecessarily clobber r4 despite
the libcall they perform not writing to r4.  Furthermore, the
requirement for the branch target address to be in r4 as expected by
the libcall is modeled in a convoluted way in the define_insn patterns:
the address is a register match_operand constrained by the match_dup
for the clobber which is guaranteed to be r4 due to the expander.

This patch simplifies all this by simply requiring the address to be in
r4 and removing the clobbers. Expanders are left alone because
cmse_nonsecure_call_clear_caller_saved relies on branch target memory
attributes which would be lost if expanding to reg:SI R4_REGNUM.

2017-11-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * config/arm/arm.md (R4_REGNUM): Define constant.
    (nonsecure_call_internal): Remove r4 clobber.
    (nonsecure_call_value_internal): Likewise.
    * config/arm/thumb1.md (nonsecure_call_reg_thumb1_v5): Remove second
    clobber and resequence match_operands.
    (nonsecure_call_value_reg_thumb1_v5): Likewise.
    * config/arm/thumb2.md (nonsecure_call_reg_thumb2): Likewise.
    (nonsecure_call_value_reg_thumb2): Likewise.

From-SVN: r254950
gcc/ChangeLog
gcc/config/arm/arm.md
gcc/config/arm/thumb1.md
gcc/config/arm/thumb2.md