aboutsummaryrefslogtreecommitdiff
path: root/gcc/target.def
diff options
context:
space:
mode:
authorQing Zhao <qing.zhao@oracle.com>2022-04-01 16:09:43 +0000
committerQing Zhao <qing.zhao@oracle.com>2022-04-01 16:09:43 +0000
commit31933f4f788b6cd64cbb7ee42076997f6d0fe212 (patch)
tree5daa89e8f0c580f945687dc4a47f4eb9d1e7032e /gcc/target.def
parent413187b0b3c873333253838e4afbf8463b288b59 (diff)
downloadgcc-31933f4f788b6cd64cbb7ee42076997f6d0fe212.zip
gcc-31933f4f788b6cd64cbb7ee42076997f6d0fe212.tar.gz
gcc-31933f4f788b6cd64cbb7ee42076997f6d0fe212.tar.bz2
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.
Diffstat (limited to 'gcc/target.def')
-rw-r--r--gcc/target.def7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/target.def b/gcc/target.def
index 72c2e1e..d85adf3 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5122,6 +5122,13 @@ DEFHOOK
that could conceivably contain values that are useful to an attacker.\n\
Return the set of registers that were actually cleared.\n\
\n\
+For most targets, the returned set of registers is a subset of\n\
+@var{selected_regs}, however, for some of the targets (for example MIPS),\n\
+clearing some registers that are in the @var{selected_regs} requires\n\
+clearing other call used registers that are not in the @var{selected_regs},\n\
+under such situation, the returned set of registers must be a subset of all\n\
+call used registers.\n\
+\n\
The default implementation uses normal move instructions to zero\n\
all the registers in @var{selected_regs}. Define this hook if the\n\
target has more efficient ways of zeroing certain registers,\n\