This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC, PATCH 2/n] IPA C++ refactoring
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Martin Liška <mliska at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Jul 2014 17:43:05 +0200
- Subject: Re: [RFC, PATCH 2/n] IPA C++ refactoring
- Authentication-results: sourceware.org; auth=none
- References: <53C69058 dot 70306 at suse dot cz> <53C7E024 dot 50309 at suse dot cz>
>
> Bootstrapped/regtested x86_64-linux
>
> Ready for trunk?
>
> gcc/ChangeLog:
> 2014-07-17 Martin Liska <mliska@suse.cz>
>
> * cgraph.h (varpool_node):
> (availability get_availability (void)):
> created from cgraph_variable_initializer_availability
> (inline varpool_node *ultimate_alias_target (availability *availability = NULL)
> creted from: cgraph_variable_initializer_availability
> (inline varpool_node *get_alias_target (void)): created from varpool_alias_target
> (void finalize_named_section_flags (void)):
> created from varpool_finalize_named_section_flags
> (bool assemble_decl (void)): created from varpool_assemble_decl
> (void analyze (void)): created from varpool_analyze_node
> (bool call_for_node_and_aliases (bool (*callback) (varpool_node *, void *),
> void *data, bool include_overwritable)): created fromvarpool_for_node_and_aliases
> (void remove_initializer (void)): created from varpool_remove_initializer
> (tree get_constructor (void)): created from varpool_get_constructor
> (bool externally_visible_p (void)): created from varpool_externally_visible_p
> (bool ctor_useable_for_folding_p (void)): created from varpool_ctor_useable_for_folding_p
> (inline bool all_refs_explicit_p ()): created from varpool_all_refs_explicit_p
> (inline bool can_remove_if_no_refs_p (void)): created from varpool_can_remove_if_no_refs
> (static inline varpool_node *get (const_tree decl)): created from varpool_get_node
> (static void finalize_decl (tree decl)): created from varpool_finalize_decl
> (static bool output_variables (void)): created from varpool_output_variables
> (static varpool_node * extra_name_alias (tree alias, tree decl)):
> created from varpool_extra_name_alias
> (static varpool_node * create_alias (tree, tree)): created from varpool_create_variable_alias
> (static void dump_varpool (FILE *f)): created from dump_varpool
> (static void DEBUG_FUNCTION debug_varpool (void)): created from debug_varpool
> (static varpool_node *create_empty (void)): created from varpool_create_empty_node
> (static varpool_node *symbol_for_decl (tree decl)): created from varpool_node_for_decl
> (static varpool_node *symbol_for_asmname (tree asmname)): created from varpool_node_for_asm
> (void assemble_aliases (void)): created from assemble_aliases
>
> + /* Dump given varpool node to F. */
> + void dump (FILE *f);
> +
> + /* Dump given varpool node to stderr. */
> + void DEBUG_FUNCTION debug (void);
> +
> + /* Remove variable from symbol table. */
> + void remove (void);
> +
> + /* Return variable availability. */
> + availability get_availability (void);
> +
> + /* For given variable pool node, walk the alias chain to return the function
> + the variable is alias of. Do not walk through thunks.
> + When AVAILABILITY is non-NULL, get minimal availability in the chain. */
> + inline varpool_node *ultimate_alias_target
> + (availability *availability = NULL);
> +
> + /* Return node that alias is aliasing. */
> + inline varpool_node *get_alias_target (void);
> +
> + /* For variables in named sections make sure get_variable_section
> + is called before we switch to those sections. Then section
> + conflicts between read-only and read-only requiring relocations
> + sections can be resolved. */
> + void finalize_named_section_flags (void);
Quite special, so it should go bellow the other declarations.
> +
> + /* Output one variable, if necessary. Return whether we output it. */
> + bool assemble_decl (void);
> +
> + void analyze (void);
> +
> + /* Call calback on varpool symbol and aliases associated to varpool symbol.
> + When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
> + skipped. */
> + bool call_for_node_and_aliases (bool (*callback) (varpool_node *, void *),
> + void *data,
> + bool include_overwritable);
> +
> + /* Remove node initializer when it is no longer needed. */
> + void remove_initializer (void);
> +
> + /* When doing LTO, read variable's constructor from disk if
> + it is not already present. */
> + tree get_constructor (void);
> +
> + /* Return true when variable should be considered externally visible. */
> + bool externally_visible_p (void);
We have flag and this helper function to set it. Probably the comment should
mention that this is not to be used except for varpool maintenance code.
> +
> + /* Return true if variable has constructor that can be used for folding. */
> + bool ctor_useable_for_folding_p (void);
Group it with get_constructor and move earlier in the list (probably basic manipulation
first, constructor next, aliases and random predicates last)
> +
> + /* Return true when all references to variable must be visible
> + in ipa_ref_list.
> + i.e. if the variable is not externally visible or not used in some magic
> + way (asm statement or such).
> + The magic uses are all summarized in force_output flag. */
> + inline bool all_refs_explicit_p ();
> +
> + /* Return true when variable can be removed from variable pool
> + if all direct calls are eliminated. */
> + inline bool can_remove_if_no_refs_p (void);
> +
> + /* Return varpool node for given symbol and check it is a function. */
> + static inline varpool_node *get (const_tree decl);
> +
> + /* Mark DECL as finalized. By finalizing the declaration, frontend instruct
> + the middle end to output the variable to asm file, if needed or externally
> + visible. */
> + static void finalize_decl (tree decl);
> +
> + /* Output all variables enqueued to be assembled. */
> + static bool output_variables (void);
> +
> + /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
> + Extra name aliases are output whenever DECL is output. */
> + static varpool_node * extra_name_alias (tree alias, tree decl);
create_extra_name_alias
> +
> + /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
> + Extra name aliases are output whenever DECL is output. */
> + static varpool_node * create_alias (tree, tree);
> +
> + /* Dump the variable pool to F. */
> + static void dump_varpool (FILE *f);
> +
> + /* Dump the variable pool to stderr. */
> + static void DEBUG_FUNCTION debug_varpool (void);
> +
> + /* Allocate new callgraph node and insert it into basic data structures. */
> + static varpool_node *create_empty (void);
> +
> + /* Return varpool node assigned to DECL. Create new one when needed. */
> + static varpool_node *symbol_for_decl (tree decl);
This is equivalent of get_create in cgraph, so lets call it the same way.
> +
> + /* Given an assembler name, lookup node. */
> + static varpool_node *symbol_for_asmname (tree asmname);
Also please double heck it match the cgraph equivalent.
OK with those changes.
Honza