]> git.ipfire.org Git - thirdparty/gcc.git/commit
[ARM] Do no clobber r4 in Armv8-M nonsecure call
authorthopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Nov 2017 11:06:05 +0000 (11:06 +0000)
committerthopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Nov 2017 11:06:05 +0000 (11:06 +0000)
commite27c5a70fd2ddaf68a0d2e0659dac3fef273d77b
treeb4120e10b104047db7f673a8e8a535190fb4b0e7
parent68215123a6e34cac15863be8353adf4a6478e7a7
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254950 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/arm/arm.md
gcc/config/arm/thumb1.md
gcc/config/arm/thumb2.md