struct function cleanup part I
Richard Guenther
richard.guenther@gmail.com
Mon Mar 31 13:54:00 GMT 2008
On Mon, Mar 31, 2008 at 1:49 PM, Jan Hubicka <jh@suse.cz> wrote:
> Hi,
> for the PM and cgraph datastructure changes I would like to push out, I need to
> reorganize data we save in struct function, cgraph_node and other
> datastructures. Those datastructures have different lifetimes and usually a
> lot longer one than data stored in them.
>
> This patch takes the "easy" part of splitting out RTL data into its own
> global object. This save memory by making struct function smaller and
> makes it possible to access the fields directly instead of double
> indirection.
>
> Those was originally part of struct function because we maintained in
> memory multiple functions in RTL form for RTL inlining. We don't do
> that anymore and even if we decided to do that again (perhaps for
> interprocedural regalloc or threaded compiler), we would want to have
> all the data move off the basic struct function as they consume
> considerable amount of memory. I've introduced global "rtl" field that
> is storing all the associated RTL datastructures instead of having many
> global variables that looks uglier too.
>
> This is intended to be first patch followed by more stuff. I took only fields
> that are clearly living only for RTL and that do have accestor macros so the patch
> is not terribly noisy. Doing so enabled some cleanups and removal of cfun arguments
> we pass over various old API.
>
> There is one problem with regno_reg_rtx. For some reason, gcov_type is not
> able to handle "length" attributes that are part of global structure fields. I spent
> quite some time trying to get it working right, but it is challenging. It seems
> better to move this datastructure to vector API in one of followup patches.
> In meantime, I've simply placed it as global array.
>
> Bootstrapped/regtested i686-linux with more related changes, I am re-testing on
> clean tree. OK if it passes?
This is ok.
Thanks,
Richard.
> * builtins.c (expand_builtin_setjmp_receiver): Update call of
> get_arg_pointer_save_area.
> * expr.c (init_expr): Just clear out rtl.expr.
> * function.c (free_after_compilation): Clear out whole RTL structure.
> (get_func_frame_size): Merge into ...
> (get_frame_size): ... this one.
> (assign_stack_local_1): Merge into ...
> (assign_stack_local): ... this one.
> (expand_function_end): Update call of get_arg_pointer_save_area.
> (get_art_pointer_save_area): Remove cfun argument.
> * function.h (emit_status): regno_pointer_align does not need length
> attribute. Move x_regno_reg_rtx to ...
> (regno_reg_rtx): ... new global array.
> (reg_rtx_no, seq_stack, REGNO_POINTER_ALIGN): Update accestors.
> (pending_stack_adjust, inhibit_defer_pop, saveregs_value,
> apply_args_value, forced_labels, stack_pointer_delta): Update accestors.
> (struct varasm_status): Move here from varasm.c
> (struct rtl_data): New. Move here some fields from struct function.
> (return_label, naked_return_label, stack_slot_list, parm_birth_insn,
> frame_offset, stack_check_probe_note, arg_pointer_save_area,
> used_temp_slots avail_temp_slots, temp_slot_level,
> nonlocal_goto_handler_labels): Update accesstors.
> (rtl): New global variable.
> (struct function): Move some fileds to rtl_data.
> (get_arg_pointer_save_area): Update prototype.
> * emit-rtl.c (rtl): Declare.
> (regno_reg_rtx): Declare.
> (first_insn, last_insn, cur_insn_uid, last_location, first_label_num): Update.
> (gen_reg_rtx): Update.
> (init_virtual_regs): Do not tate emit_status argument.
> (init_emit): Do not allocate emit.
> * varasm.c (varasm_statuc): Move to function.h.
> (n_deferred_constatns): Update accestor.
> (init_varasm_status): Do not allocate varasm_status.
> (force_const_mem, get_pool_size, output_constant_pool): Update.
> * stmt.c (force_label_rtx): Do not use x_ prefixes.
> (expand_nl_goto_receiver): Update get_arg_pointer_save_area.
More information about the Gcc-patches
mailing list