[ARM] Factor out CMSE register clearing code
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 22 Nov 2017 15:58:22 +0000 (15:58 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Wed, 22 Nov 2017 15:58:22 +0000 (15:58 +0000)
commitfc7160b2c718d7974aee97ca9b8448ec760bbfb7
tree518896eb9721f8ef7c85871655e1ed784b2ae673
parent9388732aa53da50828a37884c88adae7fd313839
[ARM] Factor out CMSE register clearing code

Functions cmse_nonsecure_call_clear_caller_saved and
cmse_nonsecure_entry_clear_before_return both contain very similar code
to clear registers. What's worse, they differ slightly at times so if a
bug is found in one careful thoughts is needed to decide whether the
other function needs fixing too.

This commit addresses the situation by factoring the two pieces of code
into a new function. In doing so the code generated to clear VFP
registers in cmse_nonsecure_call now uses the same sequence as
cmse_nonsecure_entry functions. Tests expectation are thus updated
accordingly.

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

    gcc/
    * config/arm/arm.c (cmse_clear_registers): New function.
    (cmse_nonsecure_call_clear_caller_saved): Replace register clearing
    code by call to cmse_clear_registers.
    (cmse_nonsecure_entry_clear_before_return): Likewise.

    gcc/testsuite/
    * gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c: Adapt expectations
    to vmov instructions now generated.
    * gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c: Likewise.
    * gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c: Likewise.
    * gcc.target/arm/cmse/mainline/hard/cmse-13.c: Likewise.
    * gcc.target/arm/cmse/mainline/hard/cmse-7.c: Likewise.
    * gcc.target/arm/cmse/mainline/hard/cmse-8.c: Likewise.

From-SVN: r255065
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c
gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c
gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-13.c
gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-8.c