r185345 - in /branches/pph/gcc: c-family/Change...

dnovillo@gcc.gnu.org dnovillo@gcc.gnu.org
Tue Mar 13 16:56:00 GMT 2012


Author: dnovillo
Date: Tue Mar 13 16:56:42 2012
New Revision: 185345

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185345
Log:
Remove callgraph nodes from PPH images.

This patch fixes several failures by refusing to generat code while
writing PPH images.  Instead, the writer saves state information for
the reader to expand and declare symbols via rest_of_decl_compilation
and expand_or_defer_fn/expand_or_defer_fn_1.

In the process, I had to deal with some global state that is used
during expansion.  The idea is that during generation, calls to any of
the above functions are cut short.  The symbol being expanded is added
to the PPH symbol table, together with all the state needed to re-play
the action during reading.

This slims down the data we save on PPH images and makes the writer
slightly faster by not doing any code generation actions (similarly to
how LTO operates in WPA mode).

I still need to cleanup the flags used to recognize if PPH is enabled.
PPH is a C++-only feature, but we are accessing its flags from
toplev.c.  In a subsequent pass, I'll move those flags to common code
and mark it as a C++-exclusive feature.

This change also required merging the DECL_NOT_REALLY_EXTERN.  It was
being clobbered during merging, and it's used by the expansion code.
Not merging it properly was causing several failures because
FUNCTION_DECLs were being dropped out of the cgraph.

We were also mis-merging DECL_RESULT and DECL_ARGUMENTS.  When a
function decl F already had a body, we do not want to take the result
and arguments from the decl that we are merging in.  This causes
trouble later during RTL expansion because the pointers used in the
body are different than those stored in DECL_RESULT and
DECL_ARGUMENTS.

2012-03-13   Diego Novillo  <dnovillo@google.com>

c-family/ChangeLog.pph
	* c-common.h (pph_writer_enabled_p): Declare.
	(pph_enabled_p): Declare.
	* c-opts.c (pph_writer_enabled_p): New.
	(pph_enabled_p): New.
	* c.opt (fpph-gen): Add Var(flag_pph_gen).

cp/ChangeLog.pph
	* decl.c (cp_rest_of_decl_compilation): When generating a PPH
	file, call pph_add_decl_to_symtab and return.
	* pph-core.c (tag_strings): Remove "PPH_cgraph_node".
	* pph-in.c (pph_in_merge_ld_base): Merge
	ldb->not_really_extern with |=.
	(pph_in_merge_lang_indep_tree_body): Preserve existing
	DECL_ARGUMENTS for a FUNCTION_DECL only if the decl already
	has a DECL_SAVED_TREE.
	(pph_reset_external): Remove.  Update all users.
	(pph_in_nonnull_tree): Overwrite *FIELD only if it is
	currently NULL.
	(pph_in_cgraph_node): Remove.  Update all users.
	(pph_node_already_emitted): Remove.  Update all users.
	(pph_fn_already_expanded): New.
	(pph_in_symtab): Call it.
	Read all new fields in pph_symtab_entry.
	Handle PPH_SYMTAB_EXPAND and PPH_SYMTAB_EXPAND_1 actions.
	* pph-out.c (pph_out_struct_function_for_decl): Remove.
	(pph_out_symtab_action): Assert that the action is in the set
	of known action.
	(pph_out_cgraph_node): Remove.  Update all users.
	(pph_out_cgraph_node_for_decl): Remove.  Update all users.
	(pph_add_decl_to_symtab): Capture global state required to
	re-play symtab actions in the reader.
	(pph_out_symtab): Write all new fields from pph_symtab_entry.
	* pph-streamer.h (struct pph_symtab_entry): Add fields AT_EOF,
	X_PROCESSING_TEMPLATE_DECL and FUNCTION_DEPTH.
	* pph.h (enum pph_symtab_action): Add value PPH_SYMTAB_EXPAND_1.
	(enum pph_tag): Remove value PPH_cgraph_node.  Update all
	users.
	(pph_writer_enabled_p): Move to c-family/c-opts.c.
	(pph_enabled_p): Likewise.
	* cp/semantics.c (expand_or_defer_fn_1): If we are generating
	a PPH file, add it to the symbol table and return.
	(expand_or_defer_fn): Likewise.
	* toplev.c (compile_file): If -fpph-gen is used, do not
	generate code.

testsuite/ChangeLog.pph
	* g++.dg/pph/x2incomplete4.cc: Mark fixed.
	* g++.dg/pph/x4incomplete4123.cc: Likewise.
	* g++.dg/pph/x4incomplete4321.cc: Likewise.
	* g++.dg/pph/x4keyed.cc: Likewise.
	* g++.dg/pph/x4keyex.cc: Likewise.
	* g++.dg/pph/x4keyno.cc: Likewise.
	* g++.dg/pph/x6dynarray5.h: Update expected failure patterns.
	* g++.dg/pph/x7dynarray6.cc: Likewise.
	* g++.dg/pph/x7rtti.cc: Likewise.

Modified:
    branches/pph/gcc/c-family/ChangeLog.pph
    branches/pph/gcc/c-family/c-common.h
    branches/pph/gcc/c-family/c-opts.c
    branches/pph/gcc/c-family/c.opt
    branches/pph/gcc/cp/ChangeLog.pph
    branches/pph/gcc/cp/decl.c
    branches/pph/gcc/cp/pph-core.c
    branches/pph/gcc/cp/pph-in.c
    branches/pph/gcc/cp/pph-out.c
    branches/pph/gcc/cp/pph-streamer.h
    branches/pph/gcc/cp/pph.h
    branches/pph/gcc/cp/semantics.c
    branches/pph/gcc/testsuite/ChangeLog.pph
    branches/pph/gcc/testsuite/g++.dg/pph/x2incomplete4.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x4incomplete4123.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x4incomplete4321.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x4keyed.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x4keyex.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x4keyno.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x6dynarray5.h
    branches/pph/gcc/testsuite/g++.dg/pph/x7dynarray6.cc
    branches/pph/gcc/testsuite/g++.dg/pph/x7rtti.cc
    branches/pph/gcc/toplev.c



More information about the Gcc-cvs mailing list