Tweak LRA handling of shared spill slots
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 25 Nov 2016 08:23:08 +0000 (08:23 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 25 Nov 2016 08:23:08 +0000 (08:23 +0000)
commit83d0488b79a97fa38a46b00fbce2c72c4af91ed9
treea6a2d07e1d1291391656c78cb3726365e7c7a9a1
parent664e69688d7681be99aaa900ef193d3196e4b7d1
Tweak LRA handling of shared spill slots

The previous code processed the users of a stack slot in order of
decreasing size and allocated the slot based on the first user.
This seems a bit dangerous, since the ordering is based on the
mode of the biggest reference while the allocation is based also
on the size of the register itself (which I think could be larger).

That scheme doesn't scale well to polynomial sizes, since there's
no guarantee that the order of the sizes is known at compile time.
This patch instead records an upper bound on the size required
by all users of a slot.  It also records the maximum alignment
requirement.

gcc/
2016-11-15  Richard Sandiford  <richard.sandiford@arm.com>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

* function.h (spill_slot_alignment): Declare.
* function.c (spill_slot_alignment): New function.
* lra-spills.c (slot): Add align and size fields.
(assign_mem_slot): Use them in the call to assign_stack_local.
(add_pseudo_to_slot): Update the fields.
(assign_stack_slot_num_and_sort_pseudos): Initialise the fields.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r242863
gcc/ChangeLog
gcc/function.c
gcc/function.h
gcc/lra-spills.c