mirror of git://gcc.gnu.org/git/gcc.git
function.h (frame_offset_overflow): Declare.
* function.h (frame_offset_overflow): Declare. * function.c (frame_offset_overflow): New function. (assign_stack_local_1): Call it to detect that the offset overflows. * cfgexpand.c (alloc_stack_frame_space): Likewise. From-SVN: r111964
This commit is contained in:
parent
6dd3c0a599
commit
9fb798d76c
|
|
@ -1,3 +1,10 @@
|
||||||
|
2006-03-11 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
|
* function.h (frame_offset_overflow): Declare.
|
||||||
|
* function.c (frame_offset_overflow): New function.
|
||||||
|
(assign_stack_local_1): Call it to detect that the offset overflows.
|
||||||
|
* cfgexpand.c (alloc_stack_frame_space): Likewise.
|
||||||
|
|
||||||
2006-03-11 Steven Bosscher <stevenb.gcc@gmail.com>
|
2006-03-11 Steven Bosscher <stevenb.gcc@gmail.com>
|
||||||
|
|
||||||
* config/sh/sh.c: Include alloc-pool.h.
|
* config/sh/sh.c: Include alloc-pool.h.
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,9 @@ alloc_stack_frame_space (HOST_WIDE_INT size, HOST_WIDE_INT align)
|
||||||
}
|
}
|
||||||
frame_offset = new_frame_offset;
|
frame_offset = new_frame_offset;
|
||||||
|
|
||||||
|
if (frame_offset_overflow (frame_offset, cfun->decl))
|
||||||
|
frame_offset = offset = 0;
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,12 +358,33 @@ get_func_frame_size (struct function *f)
|
||||||
/* Return size needed for stack frame based on slots so far allocated.
|
/* Return size needed for stack frame based on slots so far allocated.
|
||||||
This size counts from zero. It is not rounded to PREFERRED_STACK_BOUNDARY;
|
This size counts from zero. It is not rounded to PREFERRED_STACK_BOUNDARY;
|
||||||
the caller may have to do that. */
|
the caller may have to do that. */
|
||||||
|
|
||||||
HOST_WIDE_INT
|
HOST_WIDE_INT
|
||||||
get_frame_size (void)
|
get_frame_size (void)
|
||||||
{
|
{
|
||||||
return get_func_frame_size (cfun);
|
return get_func_frame_size (cfun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Issue an error message and return TRUE if frame OFFSET overflows in
|
||||||
|
the signed target pointer arithmetics for function FUNC. Otherwise
|
||||||
|
return FALSE. */
|
||||||
|
|
||||||
|
bool
|
||||||
|
frame_offset_overflow (HOST_WIDE_INT offset, tree func)
|
||||||
|
{
|
||||||
|
unsigned HOST_WIDE_INT size = FRAME_GROWS_DOWNWARD ? -offset : offset;
|
||||||
|
|
||||||
|
if (size > ((unsigned HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (Pmode) - 1))
|
||||||
|
/* Leave room for the fixed part of the frame. */
|
||||||
|
- 64 * UNITS_PER_WORD)
|
||||||
|
{
|
||||||
|
error ("%Jtotal size of local objects too large", func);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate a stack slot of SIZE bytes and return a MEM rtx for it
|
/* Allocate a stack slot of SIZE bytes and return a MEM rtx for it
|
||||||
with machine mode MODE.
|
with machine mode MODE.
|
||||||
|
|
||||||
|
|
@ -479,20 +500,8 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align,
|
||||||
function->x_stack_slot_list
|
function->x_stack_slot_list
|
||||||
= gen_rtx_EXPR_LIST (VOIDmode, x, function->x_stack_slot_list);
|
= gen_rtx_EXPR_LIST (VOIDmode, x, function->x_stack_slot_list);
|
||||||
|
|
||||||
/* Try to detect frame size overflows on native platforms. */
|
if (frame_offset_overflow (function->x_frame_offset, function->decl))
|
||||||
#if BITS_PER_WORD >= 32
|
function->x_frame_offset = 0;
|
||||||
if ((FRAME_GROWS_DOWNWARD
|
|
||||||
? (unsigned HOST_WIDE_INT) -function->x_frame_offset
|
|
||||||
: (unsigned HOST_WIDE_INT) function->x_frame_offset)
|
|
||||||
> ((unsigned HOST_WIDE_INT) 1 << (BITS_PER_WORD - 1))
|
|
||||||
/* Leave room for the fixed part of the frame. */
|
|
||||||
- 64 * UNITS_PER_WORD)
|
|
||||||
{
|
|
||||||
error ("%Jtotal size of local objects too large", function->decl);
|
|
||||||
/* Avoid duplicate error messages as much as possible. */
|
|
||||||
function->x_frame_offset = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -534,6 +534,11 @@ extern void free_block_changes (void);
|
||||||
the caller may have to do that. */
|
the caller may have to do that. */
|
||||||
extern HOST_WIDE_INT get_frame_size (void);
|
extern HOST_WIDE_INT get_frame_size (void);
|
||||||
|
|
||||||
|
/* Issue an error message and return TRUE if frame OFFSET overflows in
|
||||||
|
the signed target pointer arithmetics for function FUNC. Otherwise
|
||||||
|
return FALSE. */
|
||||||
|
extern bool frame_offset_overflow (HOST_WIDE_INT, tree);
|
||||||
|
|
||||||
/* A pointer to a function to create target specific, per-function
|
/* A pointer to a function to create target specific, per-function
|
||||||
data structures. */
|
data structures. */
|
||||||
extern struct machine_function * (*init_machine_status) (void);
|
extern struct machine_function * (*init_machine_status) (void);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue