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]

Re: -fuse-caller-save - Collect register usage information


> 2013-04-29  Radovan Obradovic  <robradovic@mips.com>
>             Tom de Vries  <tom@codesourcery.com>
> 
> 	* cgraph.h (struct cgraph_node): Add function_used_regs,
> 	function_used_regs_initialized and function_used_regs_valid fields.
> 	* final.c: Move include of hard-reg-set.h to before rtl.h to declare
> 	find_all_hard_reg_sets.
> 	(collect_fn_hard_reg_usage, get_call_fndecl, get_call_cgraph_node)
> 	(get_call_reg_set_usage): New function.
> 	(rest_of_handle_final): Use collect_fn_hard_reg_usage.
> ---
>  gcc/cgraph.h |   7 ++++
>  gcc/final.c  | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  gcc/regs.h   |   4 ++
>  3 files changed, 127 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 84fc1d9..bbbbd1f 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -408,6 +408,13 @@ public:
>    /* Time profiler: first run of function.  */
>    int tp_first_run;
>  
> +  /* Call unsaved hard registers really used by the corresponding
> +     function (including ones used by functions called by the
> +     function).  */
> +  HARD_REG_SET function_used_regs;
> +  /* Set if function_used_regs is valid.  */
> +  unsigned function_used_regs_valid: 1;
> +

This approach seems resonable, but please move the data into cgraph_rtl_info
substructure and access it via cgraph_rtl_info.  (I have plan to move it off
cgraph_node, so it doesn't consume memory at WPA stage)

The cgraph bits are OK with this change.

I am sorry for late reply,
Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]