> 
> They're added to the cgraph by this call:
> 
>   /* Add to cgraph.  */
>   cgraph_node::finalize_function (fndecl, false);
> 
> within function_reader::create_function (in r244110, though that code
> isn't called yet; it's called by the stuff in patch 9).
> 
> If I hack out that call, so that __RTL functions aren't in the cgraph,
> then I see lots of failures in the kit, for example here in predict.c:
> 
> maybe_hot_frequency_p (struct function *fun, int freq)
> {
>   struct cgraph_node *node = cgraph_node::get (fun->decl);
> 
>   [...read though node, so it must be non-NULL]
> 
> Similarly, this line in varasm.c's assemble_start_function assumes that
> the fndecl has a symtab node:
> 
>   align = symtab_node::get (decl)->definition_alignment ();
> 
> etc.
> 
> I don't know how many other places make the assumption that cfun's
> fndecl has a node in the callgraph.
> 
> Given that I want to have __RTL functions called by non-__RTL functions
> (and the patch kit handles this), it seemed saner to go down the route
> of adding the decl to the callgraph.

You need to have symbol in the symbol table, but you don't necessarily need to
finalize it.  You can do cgraph_node::get_cteate instead of finalize_function.
finalize_function is meant as an api for frontend saying "I am done working on
this definition and I want to pass it to middle-end", while the RTL front-end
at the moment does everything by itself (I must say I am bit worried about
consequences of this because it gets us back from unit-at-a-time to
sort-of-unit-at-a-time which used to be quite some pain, but we can work them
out incrementally).

RTL backend may at some point assert that callgraph node of function being
compiled is an analyzed definition.

I guess the patchset is fine as it is and I will clean it up next stage1.
It definitly adds less clutter than chkp.
Honza

Reply via email to