Commit 44affdae by Jan Hubicka Committed by Jan Hubicka

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
parent 715bdd81
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.
......
...@@ -1769,44 +1769,43 @@ ix86_compute_frame_size (size, nregs_on_stack, rpadding1, rpadding2) ...@@ -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
{
int offset;
int preferred_alignment = cfun->preferred_stack_boundary / BITS_PER_UNIT;
offset = frame_pointer_needed ? 8 : 4; offset = frame_pointer_needed ? 8 : 4;
/* When frame is not empty we ought to have recorded the alignment. */ /* Do some sanity checking of stack_alignment_needed and preferred_alignment,
since i386 port is the only using those features that may break easilly. */
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)
abort ();
offset += nregs * UNITS_PER_WORD; offset += nregs * UNITS_PER_WORD;
total_size += offset; total_size += offset;
/* Align start of frame for local function. */ /* Align start of frame for local function. */
if (size > 0)
{
padding1 = ((offset + stack_alignment_needed - 1) padding1 = ((offset + stack_alignment_needed - 1)
& -stack_alignment_needed) - offset; & -stack_alignment_needed) - offset;
total_size += padding1; total_size += padding1;
}
/* Align stack boundary. */ /* Align stack boundary. */
padding2 = ((total_size + preferred_alignment - 1) padding2 = ((total_size + preferred_alignment - 1)
& -preferred_alignment) - total_size; & -preferred_alignment) - total_size;
}
#endif
if (nregs_on_stack) if (nregs_on_stack)
*nregs_on_stack = nregs; *nregs_on_stack = nregs;
......
...@@ -837,6 +837,11 @@ assign_temp (type, keep, memory_required, dont_promote) ...@@ -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
......
...@@ -605,9 +605,6 @@ expand_inline_function (fndecl, parms, target, ignore, type, ...@@ -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. */
......
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