Remove global call sets: early-remat.c
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 30 Sep 2019 16:20:37 +0000 (16:20 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 30 Sep 2019 16:20:37 +0000 (16:20 +0000)
commit1849569621d13c9c070c555f9463ad289afb8416
tree5d1f7bacf357435319a43803e2c16d274ce6ac77
parent559c1ae100489da76a0283750361ace146fdeb77
Remove global call sets: early-remat.c

This pass previously excluded rematerialisation candidates if they
clobbered a call-preserved register, on the basis that it then
wouldn't be safe to add new instances of the candidate instruction
after a call.  This patch instead makes the decision on a call-by-call
basis.

The second emit_remat_insns_for_block hunk probably isn't needed,
but it seems safer and more consistent to have it, so that every call
to emit_remat_insns is preceded by a check for invalid clobbers.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* early-remat.c: Include regs.h and function-abi.h.
(early_remat::maybe_add_candidate): Don't check for call-clobbered
registers here.
(early_remat::restrict_remat_for_unavail_regs): New function.
(early_remat::restrict_remat_for_call): Likewise.
(early_remat::process_block): Before calling emit_remat_insns
for a previous call in the block, invalidate any candidates
that would clobber call-preserved registers.
(early_remat::emit_remat_insns_for_block): Likewise for the
final call in a block.  Do the same thing for live-in registers
when calling emit_remat_insns at the head of a block.

From-SVN: r276321
gcc/ChangeLog
gcc/early-remat.c