This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: -fuse-caller-save - Collect register usage information
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, rdsandiford at googlemail dot com
- Date: Sun, 25 May 2014 02:33:58 +0200
- Subject: Re: -fuse-caller-save - Collect register usage information
- Authentication-results: sourceware.org; auth=none
- References: <534ED7BC dot 50300 at mentor dot com> <534FF0F9 dot 60404 at redhat dot com> <87lhv4ug7f dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <53500628 dot 2090802 at redhat dot com> <5356853D dot 8050905 at mentor dot com> <535798F0 dot 7070809 at mentor dot com> <878uqwgjoe dot fsf at talisman dot default> <535BABD1 dot 8050208 at mentor dot com>
> 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