Commit fc91b0d0 by Richard Kenner

(struct temp_slot): New fields base_offset, full_size.

(assign_stack_temp): For !FRAME_GROWS_DOWNWARD, set p->size to size.
Set new fields base_offset and full_size.
(combine_temp_slots): Use new fields base_offset and full_size instead
of slot and size.

From-SVN: r10136
parent ef0e171b
...@@ -367,6 +367,12 @@ struct temp_slot ...@@ -367,6 +367,12 @@ struct temp_slot
int level; int level;
/* Non-zero if this should survive a call to free_temp_slots. */ /* Non-zero if this should survive a call to free_temp_slots. */
int keep; int keep;
/* The offset of the slot from the frame_pointer, including extra space
for alignment. This info is for combine_temp_slots. */
int base_offset;
/* The size of the slot, including extra space for alignment. This
info is for combine_temp_slots. */
int full_size;
}; };
/* List of all temporaries allocated, both available and in use. */ /* List of all temporaries allocated, both available and in use. */
...@@ -870,12 +876,22 @@ assign_stack_temp (mode, size, keep) ...@@ -870,12 +876,22 @@ assign_stack_temp (mode, size, keep)
/* The following slot size computation is necessary because we don't /* The following slot size computation is necessary because we don't
know the actual size of the temporary slot until assign_stack_local know the actual size of the temporary slot until assign_stack_local
has performed all the frame alignment and size rounding for the has performed all the frame alignment and size rounding for the
requested temporary. Otherwise combine_temp_slots won't think that requested temporary. Note that extra space added for alignment
adjacent slots really are adjacent. */ can be either above or below this stack slot depending on which
way the frame grows. We include the extra space if and only if it
is above this slot. */
#ifdef FRAME_GROWS_DOWNWARD #ifdef FRAME_GROWS_DOWNWARD
p->size = frame_offset_old - frame_offset; p->size = frame_offset_old - frame_offset;
#else #else
p->size = frame_offset - frame_offset_old; p->size = size;
#endif
/* Now define the fields used by combine_temp_slots. */
#ifdef FRAME_GROWS_DOWNWARD
p->base_offset = frame_offset;
p->full_size = frame_offset_old - frame_offset;
#else
p->base_offset = frame_offset_old;
p->full_size = frame_offset - frame_offset_old;
#endif #endif
p->address = 0; p->address = 0;
p->next = temp_slots; p->next = temp_slots;
...@@ -922,15 +938,13 @@ combine_temp_slots () ...@@ -922,15 +938,13 @@ combine_temp_slots ()
int delete_q = 0; int delete_q = 0;
if (! q->in_use && GET_MODE (q->slot) == BLKmode) if (! q->in_use && GET_MODE (q->slot) == BLKmode)
{ {
if (rtx_equal_p (plus_constant (XEXP (p->slot, 0), p->size), if (p->base_offset + p->full_size == q->base_offset)
XEXP (q->slot, 0)))
{ {
/* Q comes after P; combine Q into P. */ /* Q comes after P; combine Q into P. */
p->size += q->size; p->size += q->size;
delete_q = 1; delete_q = 1;
} }
else if (rtx_equal_p (plus_constant (XEXP (q->slot, 0), q->size), else if (q->base_offset + q->full_size == p->base_offset)
XEXP (p->slot, 0)))
{ {
/* P comes after Q; combine P into Q. */ /* P comes after Q; combine P into Q. */
q->size += p->size; q->size += p->size;
......
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