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: Remove gimple_body after cfg build; do not copy cfun structure


Jan Hubicka wrote:

	PR tree-optimization/37315
	* cgraph.c (cgraph_create_edge): Use gimple_has_body_p.
	* cgraphunit.c (verify_cgraph_node): drop gimple_body check.
	(cgraph_analyze_functions): Use node->analyzed
	(cgraph_mark_functions_to_output): Likewise.
	(cgraph_expand_function): All functions can be released after
	expanding.
	(cgraph_optimize): Use gimple_has_body_p.
	* ipa-inline.c (cgraph_clone_inlined_nodes): Use analyzed flag.
	(cgraph_decide_inlining_incrementally): Likewise.
	(inline_transform): Inline transform.
	* tree-inline.c (initialize_cfun): Do now shallow copy structure;
	copy fields needed.
	(inlinable_function_p): Drop gimple_body check.
	(expand_call_inline): Use gimple_has_body_p.
	* gimple.c (gimple_has_body_p): New.
	* gimple.h (gimple_has_body_p): Add prototype.
	* tree-cfg.c (execute_build_cfg): Remove gimple_body.
	(dump_function_to_file): Use gimple_has_body_p check.

Nice cleanup, thanks. This is OK. If you have some free cycles, could you also apply this patch to the lto branch?


    /* ??? Can happen with nested function of extern inline.  */
    gcc_assert (TREE_ASM_WRITTEN (decl));
    current_function_decl = NULL;
!   gcc_assert (!cgraph_preserve_function_body_p (decl));
!   cgraph_release_function_body (node);
!   /* Eliminate all call edges.  This is important so the call_expr no longer
!      points to the dead function body.  */

s/call_expr/GIMPLE_CALL/


+ /* Return true when FNDECL has Gimple body either in unlowered
+    or CFG form.  */
+ bool
+ gimple_has_body_p (tree fndecl)
+ {
+   struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
+   return (gimple_body (fndecl) || (fn && fn->cfg));
+ }

This could be a static inline in gimple.h, but this is OK too.



Diego.



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