This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA]: Merge stack alignment branch
On Fri, Apr 11, 2008 at 3:03 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Index: function.h
> ===================================================================
> --- function.h (.../trunk/gcc) (revision 134098)
> +++ function.h (.../branches/stack/gcc) (revision 134141)
> @@ -352,9 +355,16 @@ struct function GTY(())
> /* tm.h can use this to store whatever it likes. */
> struct machine_function * GTY ((maybe_undef)) machine;
>
> - /* The largest alignment of slot allocated on the stack. */
> + /* The largest alignment needed on the stack, including requirement
> + for outgoing stack alignment. */
> unsigned int stack_alignment_needed;
>
> + /* The largest alignment of slot allocated on the stack. */
> + unsigned int stack_alignment_used;
> +
> + /* The estimated stack alignment. */
> + unsigned int stack_alignment_estimated;
> +
> /* Preferred alignment of the end of stack frame. */
> unsigned int preferred_stack_boundary;
>
> @@ -509,6 +519,38 @@ struct function GTY(())
>
> /* Nonzero if pass_tree_profile was run on this function. */
> unsigned int after_tree_profile : 1;
> +
> +/* Nonzero if current function must be given a frame pointer.
> + Set in global.c if anything is allocated on the stack there. */
> + unsigned int need_frame_pointer : 1;
> +
> + /* Nonzero if need_frame_pointer has been set. */
> + unsigned int need_frame_pointer_set : 1;
> +
> + /* Nonzero if, by estimation, current function stack needs realignment. */
> + unsigned int stack_realign_needed : 1;
> +
> + /* Nonzero if function stack realignment is really needed. This flag
> + will be set after reload if by then criteria of stack realignment
> + is still true. Its value may be contridition to stack_realign_needed
> + since the latter was set before reload. This flag is more accurate
> + than stack_realign_needed so prologue/epilogue should be generated
> + according to both flags */
> + unsigned int stack_realign_really : 1;
> +
> + /* Nonzero if function being compiled needs dynamic realigned
> + argument pointer (drap) if stack needs realigning. */
> + unsigned int need_drap : 1;
> +
> + /* Nonzero if current function needs to save/restore parameter
> + pointer register in prolog, because it is a callee save reg. */
> + unsigned int save_param_ptr_reg : 1;
> +
> + /* Nonzero if function stack realignment estimatoin is done. */
> + unsigned int stack_realign_processed : 1;
> +
> + /* Nonzero if function stack realignment has been finalized. */
> + unsigned int stack_realign_finalized : 1;
>
>
> As I've mentioned originally, it would be nice to place all the
> variables and flags computed only at expansion time or later to
> rtl_data. I guess it covers majority of the above variables.
>
> +#define frame_pointer_needed (cfun->need_frame_pointer)
>
> It might be better to stick with the x_frame_pointer_needed accestor
> scheme or simply replace it in sources with crtl->frame_pointer_needed
> (I would definitly preffer the second)
>
They should stay with stack_alignment_needed and preferred_stack_boundary,
which are in "struct function". We can move those new stack alignment
fields to rtl_data when they are moved to rtl_data.
Thanks.
H.J.