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: RFA: PATCH to allow DECL_COMDAT_GROUP to be a DECL


> I was playing around with this a few months ago but set it aside
> because we weren't in stage 1 at the time.  The way we currently set
> up comdat groups early means that we need to mangle decls early,
> significantly negating the earlier work to lazily set
> DECL_ASSEMBLER_NAME.  This patch improves this situation by allowing
> a DECL to be used as DECL_COMDAT_GROUP in cases where the group name
> is the same as the mangled name of the declaration.
> 
> Tested x86_64-pc-linux-gnu.  OK for trunk?

> commit 6f9182ed91a88bb993fe137f6decc15b25f466fd
> Author: Jason Merrill <jason@redhat.com>
> Date:   Mon May 19 15:41:24 2014 -0400
> 
>     	PR c++/47202
>     gcc/cp/
>     	* decl.c (cxx_comdat_group): Return a decl.
>     	* optimize.c (cdtor_comdat_group): Get its DECL_ASSEMBLER_NAME.
>     gcc/
>     	* cgraphunit.c (analyze_functions): Convert all DECL_COMDAT_GROUPs
>     	to IDENTIFIER_NODEs.
>     	* tree.h (DECL_COMDAT_GROUP_ID): New.
>     	* lto-streamer-out.c (write_symbol): Use it.
>     	* symtab.c (dump_symtab_node): Likewise.
>     	* trans-mem.c (ipa_tm_create_version_alias): Likewise.
> 
> diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
> index f5d9594..044af45 100644
> --- a/gcc/cgraphunit.c
> +++ b/gcc/cgraphunit.c
> @@ -943,6 +943,14 @@ analyze_functions (void)
>    cgraph_state = CGRAPH_STATE_CONSTRUCTION;
>    input_location = UNKNOWN_LOCATION;
>  
> +  /* Convert all COMDAT group designators to IDENTIFIER_NODEs while we still
> +     have front end information.  */
> +  FOR_EACH_SYMBOL (node)
> +    if (DECL_COMDAT_GROUP (node->decl)
> +	&& DECL_P (DECL_COMDAT_GROUP (node->decl)))
> +      DECL_COMDAT_GROUP (node->decl)
> +	= DECL_ASSEMBLER_NAME (DECL_COMDAT_GROUP (node->decl));A

Instead of adding extra loop over whole symtab, what about converting them at a time
the symbols are inserted into the symbol table or in function_and_variable_visibility
that already does quite few changes into various flags?

Honza


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