This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Jan, > Index: tree-inline.c > ... > I think it is mistake to maintain info about stack alignment during > gimple transformations. At expansion time we walk the list and we can > figure out the alignment once possibly some of the variables are > optimized out. Removed from tree-inline.c > The info can also go into RTL datastructures I am trying to introduce > instead of cfun then. Newly introduced fields are all moved to RTL data structures (function, rtl_data) now. Overall, these up-to-date patches remove a redundant pass introduced in previous one, also clean up changes in tree passes and work fine with new RTL data structure. 2008-04-11 Uros Bizjak <ubizjak@gmail.com> H.J. Lu <hongjiu.lu@intel.com> PR target/12329 * config/i386/i386.c (ix86_function_regparm): Limit the number of register passing arguments to 2 for nested functions. 2008-04-11 Joey Ye <joey.ye@intel.com> H.J. Lu <hongjiu.lu@intel.com> Xuepeng Guo <xuepeng.guo@intel.com> * builtins.c (expand_builtin_setjmp_receiver): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. (expand_builtin_apply_args_1): Likewise. (expand_builtin_longjmp): DRAP will be needed if some builtins are called. (expand_builtin_apply): Likewise. * calls.c (expand_call): Don't calculate preferred stack boundary according to incoming stack boundary. Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. (emit_call_1): DRAP will be needed if return pops. * emit-rtl.c (gen_reg_rtx): Estimate stack alignment when generating virtual registers. * cfgexpand.c (get_decl_align_unit): Estimate stack variable alignment and store to stack_alignment_estimated and stack_alignment_used. (expand_one_var): Likewise. (gate_handle_drap): Gate new pass pass_handle_drap. (handle_drap): Execute new pass pass_handle_drap. (pass_handle_drap): Define new pass. * defaults.h (MAX_VECTORIZE_STACK_ALIGNMENT): New. * flags.h (frame_pointer_needed): Removed. * final.c (frame_pointer_needed): Likewise. * function.c (assign_stack_local_1): Estimate stack variable alignment and store to stack_alignment_estimated. (instantiate_new_reg): Instantiate virtual incoming args rtx to vDRAP if stack realignment and DRAP is needed. (assign_parms): Collect parameter/return type alignment and contribute to stack_alignment_estimated. (locate_and_pad_parm): Likewise. (allocate_struct_function): Init stack_alignment_estimated and stack_alignment_used. (get_arg_pointer_save_area): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. * function.h (function): Add new field stack_alignment_estimated, need_frame_pointer, need_frame_pointer_set, stack_realign_needed, stack_realign_really, need_drap, save_param_ptr_reg, stack_realign_processed, stack_realign_finalized and stack_realign_used. (rtl_data): Add new field drap_reg. (frame_pointer_needed): New. (stack_realign_fp): Likewise. (stack_realign_drap): Likewise. * global.c (compute_regsets): Set frame_pointer_needed cannot_elim wrt stack_realign_needed. * stmt.c (expand_nl_goto_receiver): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. * passes.c (pass_handle_drap): Insert this new pass immediately after expand. * tree-inline.c (expand_call_inline): Estimate stack variable alignment and store to stack_alignment_estimated. * tree-pass.h (pass_handle_drap): New. * tree-vectorizer.c (vect_can_force_dr_alignment_p): Return true if alignment of variable on stack is less than or equal to MAX_VECTORIZE_STACK_ALIGNMENT. * reload1.c (set_label_offsets): Assert that frame pointer must be elimiated to stack pointer in case stack realignment is estimated to happen without DRAP. (elimination_effects): Likewise. (eliminate_regs_in_insn): Likewise. (mark_not_eliminable): Likewise. (update_eliminables): Frame pointer is needed in case of stack realignment needed. (init_elim_table): Don't set frame_pointer_needed here. * dwarf2out.c (CUR_FDE): New. (reg_save_with_expression): Likewise. (dw_fde_struct): Add drap_regnum, stack_realignment, is_stack_realign, is_drap and is_drap_reg_saved. (add_cfi): If stack is realigned, call reg_save_with_expression to represent the location of stored vars. (dwarf2out_frame_debug_expr): Add rules 16-19 to handle stack realign. (output_cfa_loc): Handle DW_CFA_expression. (based_loc_descr): Update assert for stack realign. * config/i386/i386.c (ix86_force_align_arg_pointer_string): Break long line. (ix86_user_incoming_stack_boundary): New. (ix86_default_incoming_stack_boundary): Likewise. (ix86_incoming_stack_boundary): Likewise. (find_drap_reg): Likewise. (override_options): Overide option value for new options. (ix86_function_ok_for_sibcall): Sibcall is OK even stack need realigning. (ix86_handle_cconv_attribute): Stack realign no longer impacts number of regparm. (ix86_function_regparm): Likewise. (setup_incoming_varargs_64): Remove the logic to set stack_alignment_needed here. (ix86_va_start): Replace virtual_incoming_args_rtx with crtl->args.internal_arg_pointer. (ix86_save_reg): Replace force_align_arg_pointer with drap_reg. (ix86_compute_frame_layout): Compute frame layout wrt stack realignment. (ix86_internal_arg_pointer): Estimate if stack realignment is needed and returns appropriate arg pointer rtx accordingly. (ix86_expand_prologue): Finally decide if stack realignment is needed and generate prologue code accordingly. (ix86_expand_epilogue): Generate epilogue code wrt stack realignment is really needed or not. * config/i386/i386.c (ix86_select_alt_pic_regnum): Check DRAP register. * config/i386/i386.h (MAIN_STACK_BOUNDARY): New. (ABI_STACK_BOUNDARY): Likewise. PREFERRED_STACK_BOUNDARY_DEFAULT): Likewise. (STACK_REALIGN_DEFAULT): Likewise. (INCOMING_STACK_BOUNDARY): Likewise. (MAX_VECTORIZE_STACK_ALIGNMENT): Likewise. (ix86_incoming_stack_boundary): Likewise. (REAL_PIC_OFFSET_TABLE_REGNUM): Updated to use BX_REG. (CAN_ELIMINATE): Redefine the macro to eliminate frame pointer to stack pointer and arg pointer to hard frame pointer in case of stack realignment without DRAP. (machine_function): Remove force_align_arg_pointer. * config/i386/i386.md (BX_REG): New. (R13_REG): Likewise. * config/i386/i386.opt (mforce_drap): New. (mincoming-stack-boundary): Likewise. (mstackrealign): Updated. * doc/extend.texi: Update force_align_arg_pointer. * doc/invoke.texi: Document -mincoming-stack-boundary. Update -mstackrealign. Thanks - Joey -----Original Message----- From: Jan Hubicka [mailto:hubicka@ucw.cz] Sent: Saturday, April 05, 2008 2:39 AM To: Ye, Joey Cc: GCC Patches; Lu, Hongjiu; Guo, Xuepeng; ubizjak@gmail.com Subject: Re: [RFA]: Merge stack alignment branch Hi, I will look in detail to the patch later this weekend. I think it would make sense to break up neccesary changes in generic bits to separate patches (in -x -cp format). This will ease reviewing process since I for instance can't approve non-i386 specific bits of your patch. Index: tree-inline.c =================================================================== --- tree-inline.c (.../trunk/gcc) (revision 133813) +++ tree-inline.c (.../branches/stack/gcc) (revision 133869) @@ -2841,8 +2841,26 @@ cfun->unexpanded_var_list = tree_cons (NULL_TREE, var, cfun->unexpanded_var_list); else - cfun->unexpanded_var_list = tree_cons (NULL_TREE, remap_decl (var, id), - cfun->unexpanded_var_list); + { + /* Update stack alignment requirement if needed. */ + if (MAX_VECTORIZE_STACK_ALIGNMENT) + { + unsigned int align; + + if (TREE_STATIC (var) || DECL_EXTERNAL (var)) + align = TYPE_ALIGN (TREE_TYPE (var)); + else + align = DECL_ALIGN (var); + if (align > cfun->stack_alignment_estimated) + { + gcc_assert(!cfun->stack_realign_processed); + cfun->stack_alignment_estimated = align; + } + } + cfun->unexpanded_var_list + = tree_cons (NULL_TREE, remap_decl (var, id), + cfun->unexpanded_var_list); + } I think it is mistake to maintain info about stack alignment during gimple transformations. At expansion time we walk the list and we can figure out the alignment once possibly some of the variables are optimized out. The info can also go into RTL datastructures I am trying to introduce instead of cfun then. Honza
Attachment:
stack-align-dwarf2-0411.patch
Description: stack-align-dwarf2-0411.patch
Attachment:
stack-align-generic-0411.patch
Description: stack-align-generic-0411.patch
Attachment:
stack-align-x86-0411.patch
Description: stack-align-x86-0411.patch
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |