function.c (assign_temp): Change zero-sized arrays to size 1.

* function.c (assign_temp): Change zero-sized arrays to size 1.
	* integrate.c (expand_inline_function): Do not update
	stack_alignment_needed
	* i386.c (compute_frame_size): Remove #ifdef PREFERRED_FRAME_BOUNDARY,
	add some sanity checking, remove optimization for function with
	zero frame size.

From-SVN: r31898
This commit is contained in:
Jan Hubicka 2000-02-10 18:43:55 +01:00 committed by Jan Hubicka
parent 715bdd8117
commit 44affdae26
4 changed files with 40 additions and 30 deletions

View File

@ -1,3 +1,12 @@
Thu Feb 10 18:28:59 MET 2000 Jan Hubicka <jh@suse.cz>
* function.c (assign_temp): Change zero-sized arrays to size 1.
* integrate.c (expand_inline_function): Do not update
stack_alignment_needed
* i386.c (compute_frame_size): Remove #ifdef PREFERRED_FRAME_BOUNDARY,
add some sanity checking, remove optimization for function with
zero frame size.
2000-02-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-02-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* flow.c (mark_regs_live_at_end): Delete unused variables. * flow.c (mark_regs_live_at_end): Delete unused variables.

View File

@ -1769,44 +1769,43 @@ ix86_compute_frame_size (size, nregs_on_stack, rpadding1, rpadding2)
int padding2 = 0; int padding2 = 0;
HOST_WIDE_INT total_size; HOST_WIDE_INT total_size;
int stack_alignment_needed = cfun->stack_alignment_needed / BITS_PER_UNIT; int stack_alignment_needed = cfun->stack_alignment_needed / BITS_PER_UNIT;
int offset;
int preferred_alignment = cfun->preferred_stack_boundary / BITS_PER_UNIT;
nregs = ix86_nsaved_regs (); nregs = ix86_nsaved_regs ();
total_size = size; total_size = size;
#ifdef PREFERRED_STACK_BOUNDARY offset = frame_pointer_needed ? 8 : 4;
{
int offset;
int preferred_alignment = cfun->preferred_stack_boundary / BITS_PER_UNIT;
offset = frame_pointer_needed ? 8 : 4; /* Do some sanity checking of stack_alignment_needed and preferred_alignment,
since i386 port is the only using those features that may break easilly. */
/* When frame is not empty we ought to have recorded the alignment. */ if (size && !stack_alignment_needed)
if (size && !stack_alignment_needed) abort ();
abort (); if (!size && stack_alignment_needed)
abort ();
if (preferred_alignment < STACK_BOUNDARY / BITS_PER_UNIT)
abort ();
if (preferred_alignment > PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
abort ();
if (stack_alignment_needed > PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
abort ();
if (stack_alignment_needed < 4) if (stack_alignment_needed < 4)
stack_alignment_needed = 4; stack_alignment_needed = 4;
if (stack_alignment_needed > PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) offset += nregs * UNITS_PER_WORD;
abort ();
offset += nregs * UNITS_PER_WORD; total_size += offset;
total_size += offset; /* Align start of frame for local function. */
padding1 = ((offset + stack_alignment_needed - 1)
& -stack_alignment_needed) - offset;
total_size += padding1;
/* Align start of frame for local function. */ /* Align stack boundary. */
if (size > 0) padding2 = ((total_size + preferred_alignment - 1)
{ & -preferred_alignment) - total_size;
padding1 = ((offset + stack_alignment_needed - 1)
& -stack_alignment_needed) - offset;
total_size += padding1;
}
/* Align stack boundary. */
padding2 = ((total_size + preferred_alignment - 1)
& -preferred_alignment) - total_size;
}
#endif
if (nregs_on_stack) if (nregs_on_stack)
*nregs_on_stack = nregs; *nregs_on_stack = nregs;

View File

@ -837,6 +837,11 @@ assign_temp (type, keep, memory_required, dont_promote)
HOST_WIDE_INT size = int_size_in_bytes (type); HOST_WIDE_INT size = int_size_in_bytes (type);
rtx tmp; rtx tmp;
/* Zero sized arrays are GNU C extension. Set size to 1 to avoid
problems with allocating the stack space. */
if (size == 0)
size = 1;
/* Unfortunately, we don't yet know how to allocate variable-sized /* Unfortunately, we don't yet know how to allocate variable-sized
temporaries. However, sometimes we have a fixed upper limit on temporaries. However, sometimes we have a fixed upper limit on
the size (which is stored in TYPE_ARRAY_MAX_SIZE) and can use that the size (which is stored in TYPE_ARRAY_MAX_SIZE) and can use that

View File

@ -605,9 +605,6 @@ expand_inline_function (fndecl, parms, target, ignore, type,
if (cfun->preferred_stack_boundary < inl_f->preferred_stack_boundary) if (cfun->preferred_stack_boundary < inl_f->preferred_stack_boundary)
cfun->preferred_stack_boundary = inl_f->preferred_stack_boundary; cfun->preferred_stack_boundary = inl_f->preferred_stack_boundary;
if (cfun->stack_alignment_needed < inl_f->stack_alignment_needed)
cfun->stack_alignment_needed = inl_f->stack_alignment_needed;
/* Check that the parms type match and that sufficient arguments were /* Check that the parms type match and that sufficient arguments were
passed. Since the appropriate conversions or default promotions have passed. Since the appropriate conversions or default promotions have
already been applied, the machine modes should match exactly. */ already been applied, the machine modes should match exactly. */