small cgraph cleanup

Jan Hubicka hubicka@ucw.cz
Sat Sep 6 23:29:00 GMT 2003


> Makes cgraph_finalize_function a bit more readable, fixes a buglet
> therein wrt debug info.  Makes usage of cgraph_mark_needed_node a
> bit clearer, I think.
> 
> + 
> +   /* If the user told us it is used, then it must be so.  */
> +   if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
> +     return true;

Did you had any particular reason for adding this?  It should be
possible to add used flag even after function is defined so I would
preffer to have attribute hander to call mark_used
> + 
> +   /* ??? If the assembler name is set by hand, it is possible to assemble
> +      the name later after finalizing the function and the fact is noticed
> +      in assemble_name then.  This is arguably a bug.  */
> +   if (DECL_ASSEMBLER_NAME_SET_P (decl)
> +       && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
> +     return true;

Hmm, I don't quite understand here.  Do you have testcase?
We definitly do have problems with changing assembler names and I am not
quite sure what to do.  I made a patch for updating cgraph hastables but
that didn't seem to be the best way to go...
Currently we ends up with inconsistent hashtable in some cases.
> + 
> +   if (flag_unit_at_a_time)
> +     return false;
> + 
> +   /* If not doing unit at a time, then we'll only defer this function
> +      if its marked for inlining.  Otherwise we want to emit it now.  */
> + 
> +   /* "extern inline" functions are never output locally.  */
> +   if (DECL_EXTERNAL (decl))
> +     return false;
> +   /* ??? */
> +   if (node->origin)
> +     return false;
We need not to assemble the nested functions before we finish parsing
top level function.  I will add a comment.
> +   if (!DECL_INLINE (decl)
> +       || (!node->local.disregard_inline_limits
> + 	  /* When declared inline, defer even the uninlinable functions.
> + 	     This allows them to be elliminated when unused.  */
> + 	  && !DECL_DECLARED_INLINE_P (decl) 
> + 	  && (node->local.inlinable || !cgraph_default_inline_p (node))))
> +     return true;
Thanks for the cleanup!

Honza



More information about the Gcc-patches mailing list