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: Group static constructors and destructors in specific subsections, take 2


On 11/24/2010 08:09 AM, Jan Hubicka wrote:
> Hi,
> as Jakub, Tromey and Jason patiently explained to me, the cold_text_section
> code in dwarf2out is just optimizations.  Functions in separate sections are
> handled elsewhere. So I take back my claims about dwarf2out being broken in
> partitioning and attaching the updated patch.  The only difference is in
> dwarf2out_begin_function that waits for first function in text section (that
> consequently have standard cold sectoin) and initialize vars correspondingly.
> 
> Bootstrapped/regtested x86_64-linux, OK?
> 
> Honza
> 
> 	* dwarf2out.c (dwarf2out_begin_function): Initialize cold_text_section
> 	and emit cold_text_section_label.
> 	(dwarf2out_init): Don't do that there.
> 	(dwarf2out_finish): Emit end label only when cold_text_section is
> 	initialized.
> Index: dwarf2out.c
> ===================================================================
> *** dwarf2out.c	(revision 167086)
> --- dwarf2out.c	(working copy)
> *************** dwarf2out_begin_function (tree fun)
> *** 21676,21681 ****
> --- 21676,21689 ----
>   {
>     if (function_section (fun) != text_section)
>       have_multiple_function_sections = true;
> +   else if (flag_reorder_blocks_and_partition && !cold_text_section)
> +     {
> +       gcc_assert (current_function_decl == fun);
> +       cold_text_section = unlikely_text_section ();
> +       switch_to_section (cold_text_section);
> +       ASM_OUTPUT_LABEL (asm_out_file, cold_text_section_label);
> +       switch_to_section (current_function_section ());
> +     }

Is there a quick way to determine if the function will ever go into the
cold_text_section?  It would be nice if a given translation unit is
entirely non-cold that we never switch into the cold_text_section to
create that label.

If there is no way for that atm, then the patch is ok as-is.  It's
clearly an improvement over the current state of affairs.


r~


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