This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Remove gimple_body after cfg build; do not copy cfun structure
- From: Diego Novillo <dnovillo at google dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 03 Sep 2008 13:54:47 -0400
- Subject: Re: Remove gimple_body after cfg build; do not copy cfun structure
- References: <20080903172542.GF3195@kam.mff.cuni.cz>
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.