> 
> On 08/21/2014 04:31 PM, Jan Hubicka wrote:
> >> Hello,
> >>    following patch introduces a new symbol_table class, encapsulating 
> >> functions related to symbol table management. Apart from that, cgraph_edge 
> >> related functions become members of the class. Finally, a portion of 
> >> clean-up has been applied to cgraph.h.
> >>
> >> Bootstrapped on x86_64-pc-linux-gnu and majority of BEs have been tested 
> >> for C and C++, no regression observed.
> >>
> >> Thank you,
> >> Martin
> >>
> >> -  if (!used_as_abstract_origin && cgraph_state != CGRAPH_STATE_PARSING)
> >> +  if (!used_as_abstract_origin && symtab->state != CGRAPH_STATE_PARSING)
> > I would probably rename this CGRAPH_ enum into SYMTAB.  Given it is a 
> > symtab state now ;)
> Good observation, what about renaming enum values to: PARSING, 
> CONSTRUCTION,...
> I think CGRAPH_ prefix is superfluous.

Yep, I just wanted to use cgraph_ consistently for callgarph to avoid namespace 
polution back in 2002 ;)
I suppose we can make it symtab::PARSING....
> +  /* Determine if symbol declaration is needed.  That is, visible to 
> something
> +     either outside this translation unit, something magic in the system
> +     configury */
> +  bool needed_p (void);

Add comment that this is used only during symtab construction.
>  
>    /* Create edge from a given function to CALLEE in the cgraph.  */
> -  struct cgraph_edge *create_edge (cgraph_node *callee,
> -                                gimple call_stmt, gcov_type count,
> -                                int freq);
> +  cgraph_edge *create_edge (cgraph_node *callee,
> +                         gimple call_stmt, gcov_type count,
> +                         int freq);
> +
>    /* Create an indirect edge with a yet-undetermined callee where the call
>       statement destination is a formal parameter of the caller with index
>       PARAM_INDEX. */
> -  struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags,
> -                                         gcov_type count, int freq,
> -                                         bool compute_indirect_info = true);
> +  cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags,
> +                                  gcov_type count, int freq,
> +                                  bool compute_indirect_info = true);

We have add_reference and others are create_*.  I guess we ought rename 
add_reference
to create_reference by followup patch?

An alternative would be to consistently use constructors here...
> +
> +  /* Register a top-level asm statement ASM_STR.  */
> +  inline asm_node *finalize_toplevel_asm (tree asm_str);
> +
> +  /* Analyze the whole compilation unit once it is parsed completely.  */
> +  void finalize_compilation_unit (void);

process_same_body_aliases followed by compile should be here.
> +
> +  /* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these
> +     functions into callgraph in a way so they look like ordinary reachable
> +     functions inserted into callgraph already at construction time.  */
> +  void process_new_functions (void);
> +
> +  /* C++ frontend produce same body aliases all over the place, even before 
> PCH
> +     gets streamed out. It relies on us linking the aliases with their 
> function
> +     in order to do the fixups, but ipa-ref is not PCH safe.  Consequentely 
> we
> +     first produce aliases without links, but once C++ FE is sure he won't 
> sream
> +     PCH we build the links via this function.  */
> +  void process_same_body_aliases (void);
> +
> +  /* Once all functions from compilation unit are in memory, produce all 
> clones
> +     and update all calls.  We might also do this on demand if we don't want 
> to
> +     bring all functions to memory prior compilation, but current WHOPR
> +     implementation does that and it is is bit easier to keep everything 
> right
> +     in this order.  */
> +  void materialize_all_clones (void);
> +
> +  /* Perform simple optimizations based on callgraph.  */
> +  void compile (void);
> +
> +  /* Register a symbol NODE.  */
> +  inline void register_symbol (symtab_node *node);
> +
> +  inline void
> +  clear_asm_symbols (void)

OK with these changes.

Honza

Reply via email to