Commit 63a7a62b by Richard Sandiford Committed by Richard Sandiford

reload1.c (alter_reg): Require the alignment of the stack slot to be at least…

reload1.c (alter_reg): Require the alignment of the stack slot to be at least reg_max_ref_width bytes.

gcc/
	* reload1.c (alter_reg): Require the alignment of the stack slot to
	be at least reg_max_ref_width bytes.
	(scan_paradoxical_subregs): Record the largest width in
	reg_max_ref_width.

From-SVN: r117252
parent 0d118786
2006-09-27 Richard Sandiford <richard@codesourcery.com>
* reload1.c (alter_reg): Require the alignment of the stack slot to
be at least reg_max_ref_width bytes.
(scan_paradoxical_subregs): Record the largest width in
reg_max_ref_width.
2006-09-26 Jakub Jelinek <jakub@redhat.com> 2006-09-26 Jakub Jelinek <jakub@redhat.com>
PR middle-end/25261 PR middle-end/25261
......
...@@ -1996,8 +1996,11 @@ alter_reg (int i, int from_reg) ...@@ -1996,8 +1996,11 @@ alter_reg (int i, int from_reg)
&& reg_equiv_memory_loc[i] == 0) && reg_equiv_memory_loc[i] == 0)
{ {
rtx x; rtx x;
enum machine_mode mode = GET_MODE (regno_reg_rtx[i]);
unsigned int inherent_size = PSEUDO_REGNO_BYTES (i); unsigned int inherent_size = PSEUDO_REGNO_BYTES (i);
unsigned int inherent_align = GET_MODE_ALIGNMENT (mode);
unsigned int total_size = MAX (inherent_size, reg_max_ref_width[i]); unsigned int total_size = MAX (inherent_size, reg_max_ref_width[i]);
unsigned int min_align = reg_max_ref_width[i] * BITS_PER_UNIT;
int adjust = 0; int adjust = 0;
/* Each pseudo reg has an inherent size which comes from its own mode, /* Each pseudo reg has an inherent size which comes from its own mode,
...@@ -2011,8 +2014,9 @@ alter_reg (int i, int from_reg) ...@@ -2011,8 +2014,9 @@ alter_reg (int i, int from_reg)
if (from_reg == -1) if (from_reg == -1)
{ {
/* No known place to spill from => no slot to reuse. */ /* No known place to spill from => no slot to reuse. */
x = assign_stack_local (GET_MODE (regno_reg_rtx[i]), total_size, x = assign_stack_local (mode, total_size,
inherent_size == total_size ? 0 : -1); min_align > inherent_align
|| total_size > inherent_size ? -1 : 0);
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
/* Cancel the big-endian correction done in assign_stack_local. /* Cancel the big-endian correction done in assign_stack_local.
Get the address of the beginning of the slot. Get the address of the beginning of the slot.
...@@ -2028,7 +2032,8 @@ alter_reg (int i, int from_reg) ...@@ -2028,7 +2032,8 @@ alter_reg (int i, int from_reg)
else if (spill_stack_slot[from_reg] != 0 else if (spill_stack_slot[from_reg] != 0
&& spill_stack_slot_width[from_reg] >= total_size && spill_stack_slot_width[from_reg] >= total_size
&& (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg])) && (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg]))
>= inherent_size)) >= inherent_size)
&& MEM_ALIGN (spill_stack_slot[from_reg]) >= min_align)
x = spill_stack_slot[from_reg]; x = spill_stack_slot[from_reg];
/* Allocate a bigger slot. */ /* Allocate a bigger slot. */
...@@ -2036,7 +2041,6 @@ alter_reg (int i, int from_reg) ...@@ -2036,7 +2041,6 @@ alter_reg (int i, int from_reg)
{ {
/* Compute maximum size needed, both for inherent size /* Compute maximum size needed, both for inherent size
and for total size. */ and for total size. */
enum machine_mode mode = GET_MODE (regno_reg_rtx[i]);
rtx stack_slot; rtx stack_slot;
if (spill_stack_slot[from_reg]) if (spill_stack_slot[from_reg])
...@@ -2046,11 +2050,14 @@ alter_reg (int i, int from_reg) ...@@ -2046,11 +2050,14 @@ alter_reg (int i, int from_reg)
mode = GET_MODE (spill_stack_slot[from_reg]); mode = GET_MODE (spill_stack_slot[from_reg]);
if (spill_stack_slot_width[from_reg] > total_size) if (spill_stack_slot_width[from_reg] > total_size)
total_size = spill_stack_slot_width[from_reg]; total_size = spill_stack_slot_width[from_reg];
if (MEM_ALIGN (spill_stack_slot[from_reg]) > min_align)
min_align = MEM_ALIGN (spill_stack_slot[from_reg]);
} }
/* Make a slot with that size. */ /* Make a slot with that size. */
x = assign_stack_local (mode, total_size, x = assign_stack_local (mode, total_size,
inherent_size == total_size ? 0 : -1); min_align > inherent_align
|| total_size > inherent_size ? -1 : 0);
stack_slot = x; stack_slot = x;
/* All pseudos mapped to this slot can alias each other. */ /* All pseudos mapped to this slot can alias each other. */
...@@ -3828,7 +3835,8 @@ scan_paradoxical_subregs (rtx x) ...@@ -3828,7 +3835,8 @@ scan_paradoxical_subregs (rtx x)
case SUBREG: case SUBREG:
if (REG_P (SUBREG_REG (x)) if (REG_P (SUBREG_REG (x))
&& GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) && (GET_MODE_SIZE (GET_MODE (x))
> reg_max_ref_width[REGNO (SUBREG_REG (x))]))
reg_max_ref_width[REGNO (SUBREG_REG (x))] reg_max_ref_width[REGNO (SUBREG_REG (x))]
= GET_MODE_SIZE (GET_MODE (x)); = GET_MODE_SIZE (GET_MODE (x));
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment