function.c (PREFERRED_STACK_BOUDNARY): Provide default value.

* function.c (PREFERRED_STACK_BOUDNARY): Provide default value.
	(assign_stack_local_1): Limit alignment to PREFERRED_STACK_BOUNDARY,
	update stack_alignment_needed.
	(prepare_function_start): Initialize stack_alignment_needed
	* function.h (struct function): Add field stack_alignment_needed.

From-SVN: r30958
This commit is contained in:
Jan Hubicka 1999-12-15 16:34:03 +01:00 committed by Jan Hubicka
parent 285f3cf09a
commit a087165623
3 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,11 @@
Wed Dec 15 16:11:55 MET 1999 Jan Hubicka <hubicka@freesoft.cz>
* function.c (PREFERRED_STACK_BOUDNARY): Provide default value.
(assign_stack_local_1): Limit alignment to PREFERRED_STACK_BOUNDARY,
update stack_alignment_needed.
(prepare_function_start): Initialize stack_alignment_needed
* function.h (struct function): Add field stack_alignment_needed.
Wed Dec 15 14:55:24 1999 J"orn Rennecke <amylaar@cygnus.co.uk> Wed Dec 15 14:55:24 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
* caller-save.c (insert_one_insn): Returns struct insn_chain *. * caller-save.c (insert_one_insn): Returns struct insn_chain *.

View File

@ -68,6 +68,10 @@ Boston, MA 02111-1307, USA. */
#define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT #define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT
#endif #endif
#if !defined (PREFERRED_STACK_BOUNDARY) && defined (STACK_BOUNDARY)
#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
#endif
/* Some systems use __main in a way incompatible with its use in gcc, in these /* Some systems use __main in a way incompatible with its use in gcc, in these
cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
give the same symbol without quotes for an alternative entry point. You give the same symbol without quotes for an alternative entry point. You
@ -543,6 +547,13 @@ assign_stack_local_1 (mode, size, align, function)
function->x_frame_offset -= size; function->x_frame_offset -= size;
#endif #endif
/* Ignore alignment we can't do with expected alignment of the boundary. */
if (alignment * BITS_PER_UNIT > PREFERRED_STACK_BOUNDARY)
alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
if (function->stack_alignment_needed < alignment * BITS_PER_UNIT)
function->stack_alignment_needed = alignment * BITS_PER_UNIT;
/* Round frame offset to that alignment. /* Round frame offset to that alignment.
We must be careful here, since FRAME_OFFSET might be negative and We must be careful here, since FRAME_OFFSET might be negative and
division with a negative dividend isn't as well defined as we might division with a negative dividend isn't as well defined as we might
@ -5764,6 +5775,8 @@ prepare_function_start ()
current_function->original_decl_initial = 0; current_function->original_decl_initial = 0;
current_function->original_arg_vector = 0; current_function->original_arg_vector = 0;
current_function->stack_alignment_needed = 0;
/* Set if a call to setjmp is seen. */ /* Set if a call to setjmp is seen. */
current_function_calls_setjmp = 0; current_function_calls_setjmp = 0;

View File

@ -456,6 +456,8 @@ struct function
int uses_pic_offset_table; int uses_pic_offset_table;
/* tm.h can use this to store whatever it likes. */ /* tm.h can use this to store whatever it likes. */
struct machine_function *machine; struct machine_function *machine;
/* The largest alignment of slot allocated on the stack. */
int stack_alignment_needed;
/* Language-specific code can use this to store whatever it likes. */ /* Language-specific code can use this to store whatever it likes. */
struct language_function *language; struct language_function *language;