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]

[RFA] Merge tree SSA into GCC 3.1 [patch]


I would like to propose including the tree SSA framework in GCC
3.1.  The implementation is starting to stabilize a bit and
merging it into the trunk will probably accelerate development of
new analyses and transformations based on it.

This patch merges the tree SSA code in ast-optimizer-branch and
adds some new fixes for the -Wuninitialized flag that we
discussed last week (http://gcc.gnu.org/ml/gcc/2001-10/msg00496.html)

Most of the features have been documented on the
ast-optimizer-branch.  These are the highlights:

Before RTL expansion, build_tree_ssa() is called to build a
flow graph for the tree representation, find variable references
in the code and build the SSA form for the function.

After building the SSA form, we compute reaching definitions for
every variable used in the function.  This analysis emits
warnings when -Wuninitialized is given and a variable is used
with no prior definition.

The analysis can detect between a potential uninitialized use and
a definite uninitialized use.  I've been bootstrapping GCC with
-Wuninitialized to catch false positives.  I still haven't found
them all.
  
OTOH, since the analysis is done before any other optimization,
it is possible that it will still trigger warnings.  For
instance:

    main()
    {
      int a, b;

      a = 5;
      if (a > 0)
	b = 3;
      foo (b);
    }

The code above will always trigger a warning for 'b'.

One of the major things missing is hooking this up to the C++
front end.  I have only used the C front end to develop this.
The C++ front end has many other types of trees that we're
currently not handling.

I'm also working on design documentation to be added to the trees
chapter in the manual.  But I haven't done much in that area yet.

The patch has been bootstrapped and regression tested on x86.
Both bootstrapping and c-torture have used -ftree-ssa.

Would this be OK for 3.1?


Thanks.  Diego.


2001-10-13  Diego Novillo  <dnovillo@redhat.com>

	* Makefile.in (C_AND_OBJC_OBJS): Add tree-cfg.o, tree-dfa.o,
	tree-ssa.o and tree-optimize.o.
	(c-decl.o): Add dependency on tree-optimize.h
	(tree-ssa.o): New rule.
	(tree-cfg.o): New rule.
	(tree-dfa.o): New rule.
	(tree-opt.o): New rule.
	* basic-block.h (BB_CONTROL_EXPR): Define.
	(BB_CONTROL_ENTRY): Define.
	* c-common.h (enum tree_dump_index): Add entries TDI_cfg,
	TDI_dot and TDI_ssa.
	(TDF_REFS): Define.
	(TDF_RDEFS): Define.
	* c-decl.c: Include tree-optimize.h.
	(c_expand_body): Call build_tree_ssa() when the -ftree-ssa flag is
	given.
	* c-dump.c (dump_files): Add entries for -fdump-tree-cfg,
	-fdump-tree-graphviz and -fdump-tree-ssa.
	(dump_option_value_in): Add entries for TDF_REFS and
	TDF_RDEFS.
	* c-lang.c (c_post_options): Enable tree SSA analysis if
	-Wuninitialized is given.
	* flags.h (flag_tree_ssa): Declare.
	* toplev.c (flag_tree_ssa): Define.
	(f_options): Add entry for -ftree-ssa.
	(toplev_main): Do not warn about -Wuninitialized without
	-O if -ftree-ssa is used.
	* tree-cfg.c: New file.
	* tree-dfa.c: New file.
	* tree-flow.h: New file.
	* tree-optimize.c: New file.
	* tree-optimize.h: New file.
	* tree-ssa.c: New file.
	* cp/Make-lang.in (CXX_C_OBJS): Add tree-cfg.o, tree-dfa.o,
	tree-optimize.o and tree-ssa.o.
	* doc/invoke.texi: Add documentation for -ftree-ssa,
	-fdump-tree-ssa, -fdump-tree-ssa-refs, -fdump-tree-ssa-rdefs,
	-fdump-tree-cfg and -fdump-tree-graphviz.

20011013-tree-ssa.diff.gz


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