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: non-local goto optimization


> 200x-xx-xx  Roman Zippel <zippel@linux-m68k.org>
>
> 	* function.h (struct function): Rename calls_unwind_init
> 	to saves_all_register.
> 	(current_function_saves_all_register): Renamed from
> 	current_function_calls_unwind_init.
> 	* reload1.c (reload): Set current_function_saves_all_register.
> 	* except.c (expand_builtin_unwind_init): Likewise.

This is OK *only* if you add the missing 's' to saves_all_register. :-)

> 	* config/i386/i386.c (ix86_save_reg): Use
> 	current_function_saves_all_register to save pic register.
> 	* config/m68k/m68k.c (m68k_save_reg): Likewise.

I cannot approve this.


Architecture maintainers CCed, your back-end tests the flag

  current_function_has_nonlocal_label

This flag used to instruct the middle-end to mark all call-saved registers as 
"ever live" and thus to force them to be saved and restored by the back-end.

Thanks to Nathan's work, the middle-end is now more clever and doesn't always 
mark them if this flag is set; instead, it will think a little more and set 
an additional flag

  current_function_saves_all_registers

if it will eventually mark them.


In order to implement this, current_function_has_nonlocal_label is set in 
exactly 1 less occasion than it used to, in expand_builtin_unwind_init.
Instead current_function_saves_all_registers is set there.

Therefore, the conservatively correct change is very likely to test

  current_function_has_nonlocal_label || current_function_saves_all_registers

in your back-end.  However, your back-end could further benefit from Nathan's 
work by substituting the latter flag for the former in the test(s).

Thanks for your attention. :-)

-- 
Eric Botcazou


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