Add an assertion: the zeroed_hardregs set is a subset of all call used regs.
authorQing Zhao <qing.zhao@oracle.com>
Fri, 1 Apr 2022 16:09:43 +0000 (16:09 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Fri, 1 Apr 2022 16:09:43 +0000 (16:09 +0000)
commit31933f4f788b6cd64cbb7ee42076997f6d0fe212
tree5daa89e8f0c580f945687dc4a47f4eb9d1e7032e
parent413187b0b3c873333253838e4afbf8463b288b59
Add an assertion: the zeroed_hardregs set is a subset of all call used regs.

We should make sure that the hard register set that is actually cleared by
the target hook zero_call_used_regs should be a subset of all call used
registers.

At the same time, update documentation for the target hook
TARGET_ZERO_CALL_USED_REGS.

This new assertion identified a bug in the i386 implemenation, which
incorrectly set the zeroed_hardregs for stack registers. Fixed this bug
in i386 implementation.

gcc/ChangeLog:

2022-04-01  Qing Zhao  <qing.zhao@oracle.com>

* config/i386/i386.cc (zero_all_st_registers): Return the value of
num_of_st.
(ix86_zero_call_used_regs): Update zeroed_hardregs set according to
the return value of zero_all_st_registers.
* doc/tm.texi: Update the documentation of TARGET_ZERO_CALL_USED_REGS.
* function.cc (gen_call_used_regs_seq): Add an assertion.
* target.def: Update the documentation of TARGET_ZERO_CALL_USED_REGS.
gcc/config/i386/i386.cc
gcc/doc/tm.texi
gcc/function.cc
gcc/target.def