gcc.git
19 years agobnw-simple mergeheads/ast-optimizer-branch
jason [Tue, 1 Oct 2002 14:35:51 +0000 (1 14:35 +0000)]
bnw-simple merge

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@57690 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Make-lang.in (cp/cp-simplify.o): New.
aj [Fri, 21 Jun 2002 14:10:47 +0000 (21 14:10 +0000)]
* Make-lang.in (cp/cp-simplify.o): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54882 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago Simplify DECL_STMT, CONSTRUCTOR and COMPOUND_LITERAL_EXPR.
jason [Thu, 20 Jun 2002 21:51:57 +0000 (20 21:51 +0000)]
    Simplify DECL_STMT, CONSTRUCTOR and COMPOUND_LITERAL_EXPR.
        * tree-simple.c (is_simple_decl_stmt): New fn.
        (is_simple_constructor, is_simple_constructor_elt): New fns.
        (is_simple_stmt, is_simple_unary_expr): Use them.
        (is_simple_modify_expr): Accept an INIT_EXPR.
        (is_simple_id): Don't allow a COMPOUND_LITERAL_EXPR.
        (is_simple_unary_expr): Here either.
        * c-simplify.c (simplify_decl_stmt, simplify_constructor): New fns.
        (simplify_compound_literal_expr): New fn.
        (simplify_stmt, simplify_expr): Use them.
        (get_initialized_tmp_var): Use an INIT_EXPR.
        (simplify_modify_expr): Accept an INIT_EXPR.
        (simplify_for_stmt): Call simplify_decl_stmt.
        (get_name): Don't crash if the decl is anonymous.
        (tail_expression): New fn.
        * tree-simple.h: Declare new fns.
        * c-pretty-print.c (dump_c_node) [INIT_EXPR]: Print like MODIFY_EXPR.
        (dump_c_node, op_prio): Handle COMPOUND_LITERAL_EXPR.
        * c-simplify.c (simplify_expr_wfl): Only wrap pre and post stuff
        that came from our subexpression.
        (simplify_stmt): Restore stmts_are_full_exprs_p.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54857 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_expr_wfl): Only wrap pre and post stuff
jason [Thu, 20 Jun 2002 14:04:34 +0000 (20 14:04 +0000)]
    * c-simplify.c (simplify_expr_wfl): Only wrap pre and post stuff
        that came from our subexpression.
        (simplify_stmt): Restore stmts_are_full_exprs_p.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54830 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoadd citeseer urls
jason [Thu, 20 Jun 2002 10:05:21 +0000 (20 10:05 +0000)]
add citeseer urls

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54825 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_expr_wfl): Bracket substatements with
jason [Thu, 20 Jun 2002 02:15:42 +0000 (20 02:15 +0000)]
    * c-simplify.c (simplify_expr_wfl): Bracket substatements with
        FILE_STMTs rather than wrapping them in EXPR_WITH_FILE_LOCATION.
        (simplify_stmt): Update lineno and input_filename from stmts.
        (simplify_expr et al): Don't copy lineno between stmts.  Don't pass
        enclosing stmt down.
        (update_line_number): Remove.

        * c-simplify.c (simplify_expr_stmt): Don't check
        is_last_stmt_of_scope.
        (simplify_stmt_expr): Check it here.  Set *expr_p to void_zero_node
        instead of NULL_TREE.
        (expr_has_effect): No need to deal with NULL exprs now.
        (simplify_expr_wfl): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54813 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agomissed one
jason [Wed, 19 Jun 2002 09:46:32 +0000 (19 09:46 +0000)]
missed one

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54778 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_stmt_expr): New fn.
jason [Wed, 19 Jun 2002 09:25:18 +0000 (19 09:25 +0000)]
    * c-simplify.c (simplify_stmt_expr): New fn.
        (simplify_expr): Call it.
        (stmt_expr_level): Remove.
        (stmt_has_effect, c_simplify_function_tree): Remove refs.
        (expr_has_effect): Deal with null expression.
        (simplify_expr_wfl): If the subexpression is simplified away, drop
        this one, too.  Don't wrap statements.
        * tree-simple.c (is_simple_unary_expr): Don't allow a STMT_EXPR.
        * tree-inline.c (copy_tree_r): Clear the aux field in the copies.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54777 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (strip_off_ending): Rename to remove_suffix.
dnovillo [Wed, 19 Jun 2002 01:38:20 +0000 (19 01:38 +0000)]
* c-simplify.c (strip_off_ending): Rename to remove_suffix.
Update callers.
(is_last_stmt_of_scope): New function.
(simplify_expr_stmt): Call it.
(stmt_has_effect): Ditto.
(c_simplify_function_tree): Update comment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54770 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (maybe_fixup_loop_cond): New fn for C++ conditions.
jason [Tue, 18 Jun 2002 17:17:30 +0000 (18 17:17 +0000)]
    * c-simplify.c (maybe_fixup_loop_cond): New fn for C++ conditions.
        (simplify_for_stmt, simplify_while_stmt): Use it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54755 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * cp-simplify.c: New file.
jason [Tue, 18 Jun 2002 16:40:35 +0000 (18 16:40 +0000)]
    * cp-simplify.c: New file.
        * Make-lang.in: Add it.
        * cp-tree.h: Declare cp_simplify_function_tree.
        * cp-lang.c (LANG_HOOKS_SIMPLIFY_FUNCTION_TREE): Define.
        * optimize.c (optimize_function): Call tree optimizers (but not yet).

        * semantics.c (begin_for_stmt): Push the 'for' scope before
        adding the FOR_STMT.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54752 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (dump_c_node) [COMPONENT_REF]: Print -
jason [Tue, 18 Jun 2002 16:05:21 +0000 (18 16:05 +0000)]
    * c-pretty-print.c (dump_c_node) [COMPONENT_REF]: Print -

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54746 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago* as approved by dnovillo
fche [Tue, 18 Jun 2002 13:20:53 +0000 (18 13:20 +0000)]
* as approved by dnovillo
2002-06-17  Frank Ch. Eigler  <fche@redhat.com>

* c-pretty-print.c (dump_c_node): Print pointer-type
integer constants as raw numbers with a "B" (bytes) suffix.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54739 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_stmt): Take a tree *.
jason [Tue, 18 Jun 2002 02:23:13 +0000 (18 02:23 +0000)]
    * c-simplify.c (simplify_stmt): Take a tree *.
        (various): Adjust.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54730 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-06-16 Daniel Berlin <dberlin@dberlin.org>
dberlin [Mon, 17 Jun 2002 04:01:29 +0000 (17 04:01 +0000)]
2002-06-16  Daniel Berlin  <dberlin@dberlin.org>

* c-simplify.c (get_name): New function.
(get_initialized_tmp_var): Use it to try to get a prefix for
create_tmp_var from the value we are initializing to.
(simplify_cond_expr): Add prefix for create_tmp_var.
(create_tmp_var): Add prefix argument.

* tree-simple.h: Change create_tmp_var prototype to match.

* tree-ssa-pre.c: Change create_tmp_var call.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54692 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-06-16.
dnovillo [Mon, 17 Jun 2002 03:48:02 +0000 (17 03:48 +0000)]
Mainline merge as of 2002-06-16.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54690 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Sun, 16 Jun 2002 19:09:30 +0000 (16 19:09 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54671 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (c-decl.o): Add dependency on langhooks.h
dnovillo [Sat, 15 Jun 2002 13:09:06 +0000 (15 13:09 +0000)]
* Makefile.in (c-decl.o): Add dependency on langhooks.h
(c-simplify.o): Add dependency on flags.h, langhooks.h, toplev.h
and rtl.h.
* c-decl.c: Include langhooks.h.
(c_expand_body): Simplify the function.  If it succeeds and
-ftree-ssa is enabled, call optimize_function_tree.
* c-simplify.c: Include flags.h, rtl.h and toplev.h.
(simplify_expr_stmt): New function.
(simplify_stmt): Call it.
* tree-optimize.c: Don't include langhooks.h.
(optimize_function_tree): Don't call lang_hooks.simplify_function_tree.

* c-decl.c (c_expand_body): Do not simplify nor optimize the
function if -fdisable-simple is given.
* c-simplify.c (simplify_expr): Use is_simple_addr_expr_arg when
simplifying ADDR_EXPR nodes.
* flags.h (flag_disable_simple): Declare.
* toplev.c (flag_disable_simple): Define.
(f_options): Document -fdisable-simple.
(process_options): Warn if -fdisable-simple is used with
optimization enabled.
* tree-simple.c (is_simple_addr_expr_arg): New function.
        (is_simple_unary_expr): Call it.
* tree-simple.h (is_simple_addr_expr_arg): Declare.
* doc/invoke.texi: Document -fdisable-simple.

* c-pretty-print.c (dump_c_node): Handle DECL_STMT nodes inside
FOR_INIT_STMT.
* c-simplify.c (c_simplify_function_tree): Don't do anything if the
program had errors.
(simplify_stmt): Skip DECL_STMTs.
(simplify_for_stmt): Handle DECL_STMT nodes inside FOR_INIT_STMT.
(simplify_save_expr): New function.
(simplify_expr): Call it.
(tree_last_decl): Handle cases where DECL_STMTs are found before
the body of the function.
* tree-simple.c (is_simple_stmt): Handle DECL_STMT nodes inside
FOR_INIT_STMT.
(is_simple_compound_lval): Handle nodes wrapped in NON_LVALUE_EXPR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54645 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago* cut&paste typo cleanup
fche [Fri, 14 Jun 2002 18:47:46 +0000 (14 18:47 +0000)]
* cut&paste typo cleanup

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54621 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-06-14 Frank Ch. Eigler <fche@redhat.com>
fche [Fri, 14 Jun 2002 18:41:53 +0000 (14 18:41 +0000)]
2002-06-14  Frank Ch. Eigler  <fche@redhat.com>

* c-pretty-print.c (dump_c_node): Print more type qualifiers,
especially for pointers.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54619 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-06-12 Frank Ch. Eigler <fche@redhat.com>
fche [Thu, 13 Jun 2002 01:42:19 +0000 (13 01:42 +0000)]
2002-06-12  Frank Ch. Eigler  <fche@redhat.com>

* c-pretty-print.c (dump_c_node): Correct scaling of pointer-type
integer constants by type precision.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54571 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (fallback_t): New enum.
jason [Wed, 12 Jun 2002 23:53:28 +0000 (12 23:53 +0000)]
    * c-simplify.c (fallback_t): New enum.
        (simplify_expr): Rename from simplify_expr_common.  FALLBACK parm
        is now of fallback_t type.
        (simplify_lvalue_expr, simplify_expr, simplify_expr_either): Lose.
        (most everything): Adjust.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54570 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-simple.c (is_simple_compound_lval): New fn.
jason [Wed, 12 Jun 2002 16:07:10 +0000 (12 16:07 +0000)]
    * tree-simple.c (is_simple_compound_lval): New fn.
        (is_simple_varname): Call it instead of is_simple_arrayref and
        is_simple_compref.
        (is_simple_arrayref, is_simple_compref): Comment out.
        * tree-simple.h: Declare it.
        * c-simplify.c (simplify_expr_either): Comment out.
        (simplify_compound_lval): New fn.
        (simplify_array_ref, simplify_component_ref): Just call it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54555 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c: Remove folding markers.
dnovillo [Tue, 11 Jun 2002 17:10:46 +0000 (11 17:10 +0000)]
* c-simplify.c: Remove folding markers.
(insert_before_first): Remove unused function.
* tree-cfg.c: Remove folding markers.
* tree-dfa.c: Ditto.
* tree-flow.h: Ditto.
* tree-optimize.c: Ditto.
* tree-optimize.h: Ditto.
* tree-simple.c: Ditto.
* tree-ssa.c: Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54515 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-06-09.
dnovillo [Tue, 11 Jun 2002 13:41:58 +0000 (11 13:41 +0000)]
Mainline merge as of 2002-06-09.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54499 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Tue, 11 Jun 2002 13:41:58 +0000 (11 13:41 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54498 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (add_tree): Don't deep-copy expressions.
jason [Tue, 11 Jun 2002 12:11:35 +0000 (11 12:11 +0000)]
    * c-simplify.c (add_tree): Don't deep-copy expressions.
        (simplify_for_stmt): Only deep-copy pre_cond_s the first time.
        Don't deep copy expr_chain.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54496 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_switch_stmt): Let simplify_expr handle
jason [Mon, 10 Jun 2002 14:26:04 +0000 (10 14:26 +0000)]
    * c-simplify.c (simplify_switch_stmt): Let simplify_expr handle
        post-effects.  Reorder.
        (simplify_if_stmt): Likewise.  Don't build redundant comparison.
        (simplify_do_stmt, simplify_while_stmt): Likewise.
        (simplify_for_stmt): Likewise.  Remove POST_P parm.
        (simplify_stmt): Adjust.
        (insert_before_first): #if 0, no longer used.

        * c-pretty-print.c (dump_c_node): Print FIX_TRUNC_EXPR, FLOAT_EXPR
        et al as casts.  Add parens as needed.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54441 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-simple.c (is_union_based_ref): New fn.
jason [Mon, 10 Jun 2002 07:22:02 +0000 (10 07:22 +0000)]
    * tree-simple.c (is_union_based_ref): New fn.
        (is_simple_min_lval): Use it.  Rename from is_simple_arraybase.
        (is_simple_arrayref): Adjust.  Use loop instead of recursion.
        (is_simple_compref): Likewise.
        (is_simple_compref_lhs): Remove.
        * tree-simple.h: Adjust.
        * c-simplify.c (simplify_array_ref): Adjust.
        (simplify_component_ref): Adjust.

        * c-simplify.c (simplify_expr_common): Tweak ordering.
        (get_initialized_tmp_var): Let simplify_expr handle post-effects.
        * tree-simple.c (is_simple_stmt): Accept an rhs for a return expr.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54436 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_boolean_expr): Avoid redundant tests.
jason [Mon, 10 Jun 2002 05:32:41 +0000 (10 05:32 +0000)]
    * c-simplify.c (simplify_boolean_expr): Avoid redundant tests.
        Give the temp the appropriate type for a boolean value, and
        reconvert at the end.

        * c-simplify.c (simplify_self_mod_expr): Don't duplicate side-effects.

        * c-simplify.c (simplify_return_stmt): Accept a SIMPLE rhs.
        Just hand off to simplify_expr.

        * c-simplify.c (get_initialized_tmp_var): New fn.
        (simplify_expr_common): Use it.  Handle post-effects internally if
        POST_P is NULL.
        (is_simple_tmp_var): Rename from simple_tmp_var_p.
        * tree-simple.h: Adjust.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54431 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_return_stmt): Update folding markers.
dnovillo [Sun, 9 Jun 2002 22:39:40 +0000 (9 22:39 +0000)]
* c-simplify.c (simplify_return_stmt): Update folding markers.
(build_addr_expr): Ditto.
* langhooks.h (struct langhooks): Document simplify_function_tree
hook.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54414 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_expr_common): Handle creating both lvalue
jason [Sun, 9 Jun 2002 19:22:05 +0000 (9 19:22 +0000)]
    * c-simplify.c (simplify_expr_common): Handle creating both lvalue
        and rvalue temps.  Add new parameter to specify which.
        (simplify_expr): Now just a wrapper.
        (simplify_lvalue_expr): Likewise.
        (simplify_expr_either): New wrapper.
        (simplify_component_ref): Use it instead of simplify_lvalue_expr.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54411 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (debug_c_tree): Add a trailing newline.
jason [Sun, 9 Jun 2002 16:54:12 +0000 (9 16:54 +0000)]
    * c-pretty-print.c (debug_c_tree): Add a trailing newline.
        (debug_c_node): Likewise.
        * gdbinit.in (pct): New macro, calls debug_c_tree.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54407 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agooops
jason [Sat, 8 Jun 2002 15:53:46 +0000 (8 15:53 +0000)]
oops

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54380 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (dump_c_node) [COMPONENT_REF]: Wrap array in parens
jason [Sat, 8 Jun 2002 15:50:34 +0000 (8 15:50 +0000)]
    * c-pretty-print.c (dump_c_node) [COMPONENT_REF]: Wrap array in parens
        as needed.
        [POINTER_TYPE]: Fix pointer-to-function handling.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54379 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-simple.c (is_simple_unary_expr): Only allow the address of
jason [Sat, 8 Jun 2002 15:46:22 +0000 (8 15:46 +0000)]
    * tree-simple.c (is_simple_unary_expr): Only allow the address of
        a varname.
        (is_simple_id): Allow STRING_CST.
        * c-simplify.c (simplify_expr_common): Split out from simplify_expr.
        Do simplify ADDR_EXPR.
        (simplify_lvalue_expr): Use it and build_addr_expr.  Take
        simple_test_f.
        (simplify_modify_expr): Adjust.
        (build_addr_expr): New fn.
        (simplify_array_ref): Use simplify_lvalue_expr.
        (simplify_component_ref): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54378 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-simple.c (is_simple_rhs): Remove condexpr rule.
jason [Sat, 8 Jun 2002 07:43:08 +0000 (8 07:43 +0000)]
    * tree-simple.c (is_simple_rhs): Remove condexpr rule.
        (is_simple_compref_lhs): Remove &ID.idlist rule.
        (is_simple_relop): New fn.
        (is_simple_binary_expr, is_simple_condexpr): Use it.
        * tree-simple.h: Declare it.

        * c-simplify.c (create_tmp_var): Refuse to create an array temp.
        (simple_tmp_var_p): New fn.
        (simplify_lvalue_expr): Use it; make sure we don't return a temp.
        * tree-simple.h: Declare it.

        * c-pretty-print.c (dump_c_node) [ARRAY_REF]: Wrap array in parens
        as needed.
        (dump_c_node) [ARRAY_TYPE]: Don't try to print an unknown
        dimension.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54369 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-simple.c (is_simple_arraybase): New function.
jason [Sat, 8 Jun 2002 06:05:22 +0000 (8 06:05 +0000)]
    * tree-simple.c (is_simple_arraybase): New function.
        (is_simple_arrayref): Use it to check the array base again.
        * tree-simple.h: Add declaration.
        * c-simplify.c (simplify_array_ref): Do simplify the base.
        * expr.c (expand_expr): First make sure the type has a size.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54359 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * cppexp.c (num_equality_op): Use a temporary variable to work
jason [Fri, 7 Jun 2002 13:26:53 +0000 (7 13:26 +0000)]
    * cppexp.c (num_equality_op): Use a temporary variable to work
        around gcc 3.0.4 bug.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54338 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (BOOT_CFLAGS): Remove -ftree-ssa.
dnovillo [Thu, 6 Jun 2002 03:52:20 +0000 (6 03:52 +0000)]
* Makefile.in (BOOT_CFLAGS): Remove -ftree-ssa.
* c-decl.c (c_expand_body): Call optimize_function_tree if tree SSA
is enabled.
* c-lang.c (LANG_HOOKS_SIMPLIFY_FUNCTION_TREE): Define.
* c-simplify.c (simplify_tree): Rename to c_simplify_function_tree.
Update all callers.
Dump function body before and after simplification if
-fdump-tree-simple is used.
(simplify_expr): Document FIXME for simplification of BIT_FIELD_REF
nodes.
* c-tree.h (simplify_tree): Rename to c_simplify_function_tree.
* langhooks-def.h (LANG_HOOKS_SIMPLIFY_FUNCTION_TREE): Define
(LANGHOOKS_INITIALIZER): Add LANG_HOOKS_SIMPLIFY_FUNCTION_TREE.
(lhd_simplify_function_tree): Declare.
* langhooks.c (lhd_simplify_function_tree): New function.
* langhooks.h (lang_hooks): Add simplify_function_tree function
pointer.
* toplev.c (parse_options_and_default_flags): Set flag_tree_ssa to
1 at optimization levels >= 1.
Revert to default warning when -Wuninitialized is used without -O.
* tree-cfg.c (tree_find_basic_blocks): Rename argument 't' to
'fnbody'.
* tree-optimize.c: Include langhooks.h.
(optimize_tree): Rename to optimize_function_tree.  Update all
users.
Rename argument 't' to 'fndecl'.
Call simplify langhook before building SSA.
(build_tree_ssa): Rename argument 't' to 'fndecl'.
Adjust call to tree_find_basic_blocks to pass body of the function.
* tree-optimize.h (optimize_tree): Rename to
optimize_function_tree.
* tree-simple.c (is_simple_unary_expr): Document FIXME on
BIT_FIELD_REF nodes.
* tree-ssa.c: Add whitespace.
* testsuite/lib/c-torture.exp: Remove -ftree-ssa flag.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54301 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-06-03 Daniel Berlin <dberlin@dberlin.org>
dberlin [Wed, 5 Jun 2002 13:51:14 +0000 (5 13:51 +0000)]
2002-06-03  Daniel Berlin  <dberlin@dberlin.org>

* tree-cfg.c (insert_before_*):  For insertion into FOR_INIT's, if
we have an expression statement, transform into a compound
expression.
Pick the right place to insert a statement by iterating until we
have a first_exec_stmt (first_non_decl_stmt) that is really the
first executable non decl statement.
(insert_after_*): Ditto.

2002-06-03  Daniel Berlin  <dberlin@dberlin.org>

* tree-ssa-pre.c: Update BB stuff to new basic block structure.
Add some comments throughout (more coming, particularly describing
the algorithm, rather than the implementation).
(free_expr_info): Free refs as well.
(defs_y_dom_x): Handle unary expressions as well.
(insert_euse_in_preorder_dt_order_1): Use block of ref, not block
of statement.
Don't insert exit blocks if we hit them before hitting an
occurrence (it's pointless).
(rename_2): Return set of phi operands we touched, don't forget to
free VARRAY's we allocated.
(rename_1): Correct downsafety computation. Now get exact same
results as Open64.
Correct setting of has_real_use.
(finalize_1): Fix up insertion.
(code_motion): Fix up insertion.

* tree-dfa.c (dump_varref):  Improve dumping of expression
references.
2002-06-03  Diego Novillo  <dnovillo@redhat.com>

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54283 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-06-02.
dnovillo [Mon, 3 Jun 2002 22:02:10 +0000 (3 22:02 +0000)]
Mainline merge as of 2002-06-02.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54220 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Mon, 3 Jun 2002 22:02:10 +0000 (3 22:02 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@54219 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-05-26.
dnovillo [Wed, 29 May 2002 15:16:41 +0000 (29 15:16 +0000)]
Mainline merge as of 2002-05-26.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53997 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-05-26.
dnovillo [Wed, 29 May 2002 15:10:41 +0000 (29 15:10 +0000)]
Mainline merge as of 2002-05-26.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53996 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Wed, 29 May 2002 15:10:41 +0000 (29 15:10 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53995 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in: Add -ftree-ssa to BOOT_CFLAGS.
dnovillo [Tue, 28 May 2002 13:42:59 +0000 (28 13:42 +0000)]
* Makefile.in: Add -ftree-ssa to BOOT_CFLAGS.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53958 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-decl.c (c_expand_body): Close dump file before simplifying the
dnovillo [Tue, 28 May 2002 01:30:09 +0000 (28 01:30 +0000)]
* c-decl.c (c_expand_body): Close dump file before simplifying the
function.
* c-pretty-print.c (dump_c_node): Handle COMPLEX_CST,
BIT_FIELD_REF, COMPLEX_EXPR, CONJ_EXPR, REALPART_EXPR,
IMAGPART_EXPR and VA_ARG_EXPR nodes.
Display all type casts, not just pointer casts.
(op_prio): Handle LROTATE_EXPR, RROTATE_EXPR, REALPART_EXPR and
IMAGPART_EXPR.
* c-simplify.c: Include "tree-inline.h"
(dump_file): New local variable.
(dump_flags): New local variable.
(stmt_expr_level): New local variable.
(simplify_tree): Open and close dump file if
-fdump-tree-simple-details is given.
Initialize stmt_expr_level.
(simplify_stmt): Dump statement before and after simplification if
-fdump-tree-simple-detail is given.
Unshare the expression of an EXPR_STMT before simplifying it.
Call simplify_return_stmt to handle RETURN_STMT nodes.
Do not simplify DECL_STMT nodes.
Call stmt_has_effect before re-chaining side effects.
(simplify_for_stmt): Do not return the simplified statement.
Update all callers.
Simplify FOR_BODY after the headers.
Unshare loop header expressions before simplification.
(simplify_while_stmt): Do not return the simplified statement.
Update all callers.
Simplify WHILE_BODY after the headers.
Unshare the loop header expression before simplification.
(simplify_do_stmt): Do not return the simplified statement.  Update
all callers.
Unshare the loop header expression before simplification.
(simplify_if_stmt): Do not return the simplified statement.  Update
all callers.
Simplify the condition expression before the clauses.
Unshare the condition expression before simplification.
(simplify_switch_stmt): Do not return the simplified statement.
Update all callers.
Simplify the switch expression before the body.
Unshare the switch expression before simplification.
(simplify_decl_stmt): Remove.
(simplify_expr): Remove argument 'needs_lvalue'.
Add argument 'stmt'.
Replace first argument 'expr' with a pointer to the
expression 'expr_p'.
Do not return the simplified expression.
Update all callers and uses.
Handle TRUTH_NOT_EXPR nodes.  Simplify SAVE_EXPR nodes into a
SIMPLE id and remove the SAVE_EXPR node.
Do not simplify BIT_FIELD_REF nodes.
Remove code that tried to create new lvalues.
(simplify_array_ref): Replace first argument 'expr' with a pointer
to the expression 'expr_p'.
Do not return the simplified expression.
Add argument 'stmt'.
Update all callers and uses.
(simplify_self_mod_expr): Replace first argument 'expr' with a
pointer to the expression 'expr_p'.
Do not return the simplified expression.
Add argument 'stmt'.
Update all callers and uses.
Call simplify_lvalue_expr to simplify a copy of the LHS into an
lvalue for the new assignment.
Simplify the new binary expression.
(simplify_component_ref): Replace first argument 'expr' with a
pointer to the expression 'expr_p'.
Do not return the simplified expression.
Add argument 'stmt'.
Update all callers and uses.
(simplify_call_expr): Ditto.
(simplify_tree_list): Ditto.
(simplify_cond_expr): Ditto.
Build a replacement IF_STMT and call simplify_if_stmt() to process
it.  Set the line number of the new statement from the statement
containing the original expression.
(simplify_modify_expr): Replace first argument 'expr' with a
pointer to the expression 'expr_p'.
Do not return the simplified expression.
Add argument 'stmt'.
Update all callers.
Call simplify_lvalue_expr to simplify the LHS of the assignment.
(simplify_boolean_expr): Replace first argument 'expr' with a
pointer to the expression 'expr_p'.
Do not return the simplified expression.
Add argument 'stmt'.
Update all callers.
Build a new IF_STMT and simplify it all at once by calling
simplify_if_stmt.
(simplify_compound_expr): Replace first argument 'expr' with a
pointer to the expression 'expr_p'.
Do not return the simplified expression.
Add argument 'stmt'.
Update all callers.
(simplify_expr_wfl): Ditto.
(simplify_lvalue_expr): New function.
(add_tree): Create a copy of each expression before adding it to
the list.
(deep_copy_node): Call copy_tree_r to copy expression nodes.
(stmt_has_effect): Return nonzero if the statement may be the last
statement of a statement expression body.
(mostly_copy_tree_r): New function.
* tree-dump.c (dump_options): Add 'details'.
* tree-simple.c: Update documentation about ADDRESSOF expressions.
(is_simple_stmt): Test for SIMPLE values when checking return
statements.
Accept all DECL_STMT nodes.
(is_simple_compstmt): Return nonzero if T is NULL.  Do not test
DECL_STMT nodes
(is_simple_expr): Return nonzero if T is NULL.
(is_simple_rhs): Ditto.
(is_simple_modify_expr): Ditto.
(is_simple_modify_expr_lhs): Ditto.
(is_simple_binary_expr): Ditto.
(is_simple_cond_expr): Ditto.
(is_simple_unary_expr): Call STRIP_NOPS before testing T.
Always accept ADDR_EXPR nodes.
Always accept BIT_FIELD_REF nodes.
(is_simple_call_expr): Return nonzero if T is NULL.
(is_simple_const): Ditto.
(is_simple_val): Ditto.
(is_simple_compref): Ditto.
(is_simple_compref_lhs): Ditto.
(is_simple_cast): Ditto.
(is_simple_cast_op): Ditto.
(is_simple_id): Return nonzero if T is NULL.  Allow identifiers
wrapped inside NON_LVALUE_EXPR and EXPR_WITH_FILE_LOCATION nodes.
Allow real and imaginary parts of a complex variable.
Allow compound literals.
(is_simple_arrayref): Allow arrays of complex types.
* tree.h (TDF_DETAILS): Define.
* cp/pt.c (tsubst_template_parms): Check that 'parms' is non-NULL
before calling TMPL_PARMS_DEPTH.
* doc/invoke.texi: Document -fdump-tree-simple-details.

In testsuite/ChangeLog:

* lib/c-torture.exp: Add -ftree-ssa to compiler flags.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53941 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge mainline into branch as of 2002-05-19.
dnovillo [Mon, 20 May 2002 04:41:18 +0000 (20 04:41 +0000)]
Merge mainline into branch as of 2002-05-19.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53647 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Mon, 20 May 2002 04:41:18 +0000 (20 04:41 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53646 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge mainline into branch as of 2002-05-15.
dnovillo [Wed, 15 May 2002 13:28:54 +0000 (15 13:28 +0000)]
Merge mainline into branch as of 2002-05-15.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53488 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Wed, 15 May 2002 13:28:54 +0000 (15 13:28 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53487 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-05-12.
dnovillo [Sun, 12 May 2002 22:31:29 +0000 (12 22:31 +0000)]
Mainline merge as of 2002-05-12.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53406 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Sun, 12 May 2002 22:31:29 +0000 (12 22:31 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53405 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-05-10 Daniel Berlin <dberlin@dberlin.org>
dberlin [Fri, 10 May 2002 22:04:45 +0000 (10 22:04 +0000)]
2002-05-10  Daniel Berlin  <dberlin@dberlin.org>

* c-pretty-print.c (dump_c_node): Print "<unnamed whatever>" for
types, variables, etc that have no name, rather than printing
nothing.
Handle PMF's properly.
Print out structure initializers in a somewhat sensible way.
Print SAVE_EXPR () around SAVE_EXPRs.
(print_call_name): Handle EXPR_WITH_FILE_LOCATION.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53372 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-05-09 Daniel Berlin <dberlin@dberlin.org>
dberlin [Thu, 9 May 2002 20:27:42 +0000 (9 20:27 +0000)]
2002-05-09  Daniel Berlin  <dberlin@dberlin.org>

* tree-dfa.c (dump_varref): Tree inlining generates variables with
no name. Don't crash on dumping varref's of them.

* tree-inline.c (expand_call_inline): Generate a proper STMT_EXPR
(it was missing COMPOUND_STMT).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53343 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-05-08 Daniel Berlin <dberlin@dberlin.org>
dberlin [Wed, 8 May 2002 21:14:35 +0000 (8 21:14 +0000)]
2002-05-08  Daniel Berlin  <dberlin@dberlin.org>

s/varref_type/treeref_type/g
s/create_varref/create_ref/g

* tree-flow.h: Add EXPRPHI, EXPRUSE, EXPRKILL, EXPRINJ.
Add structures and macros for each.
Add tree_perform_ssapre prototype.

* Makefile.in (C_AND_OBJC_OBJS): Add tree-ssa-pre.o
(tree-ssa-pre.o): Add dependencies for tree-ssa-pre.o

* cp/Make-lang.in: Add tree-ssa-pre.o

* flags.h: Add flag_tree_ssa_pre.

* tree-ssa-pre.c: New file, SSA-PRE.

* toplev.c: Add flag_tree_ssa_pre.
(lang_independent_options): Add tree-ssa-pre.

* tree-dump.c (dump_files): Add ssapre dump.

* tree-optimize.c (optimize_tree): Do SSAPRE if requested.

* tree.h (dump_index): Add TDI_ssa_pre.

* tree-dfa.c (create_ref): Add support for creating the EXPR*'s refs.
(dump_varref): Add support for dumping EXPR* refs.

* tree-ssa.c (search_fud_chains): Add BB to VARDEF_PHI_CHAIN_BB.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53303 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (op_prio): Handle ABS_EXPR.
dnovillo [Tue, 7 May 2002 15:46:02 +0000 (7 15:46 +0000)]
* c-pretty-print.c (op_prio): Handle ABS_EXPR.
Don't abort when the operand is not recognized.
(op_symbol): Don't abort when the operand is not recognized.
* c-simplify.c (simplify_expr): Remove 'const' qualifier from first
argument.
Do not copy incoming expression.
Exclude handling of MODIFY_EXPR, INIT_EXPR, SAVE_EXPR and binary
expression nodes.
(simplify_array_ref): Remove 'const' qualifier from first argument.
Do not copy the incoming expression.
(simplify_self_mod_expr): Ditto.
Do not simplify the first operand twice.
(simplify_component_ref): Remove 'const' qualifier from first
argument.  Do not copy the incoming expression.
(simplify_call_expr): Ditto.
(simplify_tree_list): Ditto.
(simplify_cond_expr): Ditto.
(simplify_modify_expr): Ditto.
(simplify_boolean_expr): Ditto.
(simplify_compound_expr): Ditto.
(simplify_save_expr): Ditto.
(simplify_expr_wfl): Ditto.
(tree_build_scope): Re-write.  Do nothing if block already contains
a scope.  Use chainon to chain the body with the scope closing
node.
(deep_copy_node): Do not check for NULL nodes.  Do not deep copy
declarations, types and constants.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53258 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-05-06 Daniel Berlin <dberlin@dberlin.org>
dberlin [Mon, 6 May 2002 18:19:49 +0000 (6 18:19 +0000)]
2002-05-06  Daniel Berlin  <dberlin@dberlin.org>

* c-simplify.c (deep_copy_node): Don't copy DECL_STMT_DECL's.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53231 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-05-06 Daniel Berlin <dberlin@dberlin.org>
dberlin [Mon, 6 May 2002 18:13:31 +0000 (6 18:13 +0000)]
2002-05-06  Daniel Berlin  <dberlin@dberlin.org>

* tree-simple.c (is_simple_compstmt): Don't post-initialize
statics or aggregate initializers.

* c-simplify.c (simplify_decl_stmt): Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53229 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (simple-break-elim.o, simple-goto-elim.o, tree-dchain.o):
dnovillo [Mon, 6 May 2002 15:53:46 +0000 (6 15:53 +0000)]
* Makefile.in (simple-break-elim.o, simple-goto-elim.o, tree-dchain.o):
Added.
* c-decl.c: Include tree-dchain.h
(c_expand_body): Add entry point to the goto, break elimination
after the simplification pass.
* simple-break-elim.c: New file.
* simple-goto-elim.c: New file.
* tree-dchain.h: New file.
* tree-dchain.c: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53223 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMainline merge as of 2002-05-05.
dnovillo [Mon, 6 May 2002 12:28:56 +0000 (6 12:28 +0000)]
Mainline merge as of 2002-05-05.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53214 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Mon, 6 May 2002 12:28:56 +0000 (6 12:28 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53213 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_expr): Constify first argument.
dnovillo [Thu, 2 May 2002 19:42:02 +0000 (2 19:42 +0000)]
* c-simplify.c (simplify_expr): Constify first argument.
Always work on a copy of the input expression.
Do not simplify COMPOUND_LITERAL_EXPR nor CONSTRUCTOR nodes.
(simplify_array_ref): Constify first argument.  Always work on a
copy of the input expression.
(simplify_self_mod_expr): Ditto.
(simplify_component_ref): Ditto.
(simplify_call_expr): Ditto.
(simplify_tree_list): Ditto.
(simplify_cond_expr): Ditto.
When building the THEN_CLAUSE and ELSE_CLAUSE for the new IF_STMT,
create a scope for them and simplify the scope, not the expression.
(simplify_modify_expr): Constify first argument.  Always work on a
copy of the input expression.
(simplify_boolean_expr): Ditto.
(simplify_compound_expr): Ditto.
(simplify_save_expr): Ditto.
(simplify_expr_wfl): Ditto.
* tree-cfg.c (tree_find_basic_blocks): Update comments for
-fdump-tree-dot.
(tree_dump_cfg): Ditto.
* tree-dump.c (dump_files): Rename -fdump-tree-graphviz to
-fdump-tree-dot.
* tree-simple.c (is_simple_unary_expr): Do not handle &CONST
expressions.
Handle COMPOUND_LITERAL_EXPR and CONSTRUCTOR nodes.
(is_simple_const): Strip NOPS and handle &CONST expressions.
* tree.h (enum tree_dump_index): Remove references to GraphViz.
* doc/invoke.texi: Update documentation for -fdump-tree-dot.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53059 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (dump_c_node): Don't print declarations
dnovillo [Thu, 2 May 2002 16:05:49 +0000 (2 16:05 +0000)]
* c-pretty-print.c (dump_c_node): Don't print declarations
from the SCOPE_STMT_BLOCK, use the DECL_STMT instead.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@53048 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (NIY): Display an error string instead of aborting.
dnovillo [Wed, 1 May 2002 00:30:40 +0000 (1 00:30 +0000)]
* c-pretty-print.c (NIY): Display an error string instead of aborting.
(op_prio): Add support for COMPOUND_EXPR, TRUTH_XOR_EXPR, MIN_EXPR,
MAX_EXPR and NON_LVALUE_EXPR.
For EXPR_WITH_FILE_LOCATION nodes, return the priority of
the internal node.
(op_symbol): Add support for TRUTH_XOR_EXPR.
* c-simplify.c (simplify_stmt): Only remove null statements that
have been nullified by simplification.
Call debug_tree() dump unhandled tree nodes.
(simplify_for_stmt): Always deep-copy PRE_COND_S before adding it
to PRE_P.
(simplify_expr): When simplifying a MODIFY_EXPR node into an
rvalue, return operand 0.
Handle VA_ARG_EXPR, BIT_FIELD_REF and NON_LVALUE_EXPR nodes.
Treat TRUTH_AND_EXPR, TRUTH_OR_EXPR and TRUTH_XOR_EXPR nodes as
regular binary expressions.
Call debug_tree() to dump an unhandled expression.
(simplify_array_ref): Do not simplify the base of an array.
(simplify_call_expr): Do not simplify calls to builtins.
(simplify_cond_expr): Handle conditional expressions of type void.
(simplify_boolean_expr): Return 'T != 0' instead of 'T'.
(simplify_save_expr): Do not wrap statement trees inside SAVE_EXPR
nodes.
(tree_last_decl): Ignore FILE_STMT nodes preceding a SCOPE_STMT.
* tree-simple.c: Update grammar to accept any valid C array as the
array base.
(is_simple_compstmt): Accept DECL_INITIAL expressions for read-only
variables.
(is_simple_expr): Do not abort if the incoming tree is NULL.
(is_simple_modify_expr): Allow SAVE_EXPR, EXPR_WITH_FILE_LOCATION
and NON_LVALUE_EXPR wrappers.
(is_simple_binary_expr): Ditto.
(is_simple_condexpr): Ditto.
Accept TRUTH_AND_EXPR, TRUTH_OR_EXPR and TRUTH_XOR_EXPR.
(is_simple_unary_expr): Do not abort it the incoming tree is NULL.
Allow SAVE_EXPR, EXPR_WITH_FILE_LOCATION and NON_LVALUE_EXPR
wrappers.
Handle BIT_FIELD_REF and VA_ARG_EXPR nodes.
(is_simple_call_expr): Always return 1 for builtin calls.
(is_simple_arrayref): Do not check the array base.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52983 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-04-30 Daniel Berlin <dberlin@dberlin.org>
dberlin [Tue, 30 Apr 2002 04:47:48 +0000 (30 04:47 +0000)]
2002-04-30  Daniel Berlin  <dberlin@dberlin.org>

* c-simplify.c (simplify_call_expr): Don't try to simplify
call_expr arglist if it's not there.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52927 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge with mainline as of 2002-04-27
dnovillo [Sun, 28 Apr 2002 18:53:50 +0000 (28 18:53 +0000)]
Merge with mainline as of 2002-04-27

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52850 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Sun, 28 Apr 2002 18:53:50 +0000 (28 18:53 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52849 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-decl.c (c_expand_body): Call simplify_tree to simplify a
dnovillo [Sat, 27 Apr 2002 22:54:22 +0000 (27 22:54 +0000)]
* c-decl.c (c_expand_body): Call simplify_tree to simplify a
FUNCTION_DECL node.
* c-simplify.c (simplify_tree): New function.
(simplify_stmt): Remove variable 'new_vars'.  Update all called
functions.
Remove argument 'scope'.  Update all callers.
Do not keep track of new scope statements as they are entered.
Do not call declare_tmp_vars().
(simplify_for_stmt): Remove argument new_vars_p.  Update all callers.
(simplify_while_stmt): Ditto.
(simplify_do_stmt): Ditto.
(simplify_if_stmt): Ditto.
(simplify_switch_stmt): Ditto.
(simplify_decl_stmt): Reformat comments.
(simplify_expr): Remove argument new_vars_p.  Update all callers.
Call simplify_save_expr() to simplify SAVE_EXPR nodes.
Call simplify_expr_wfl() to simplify EXPR_WITH_FILE_LOCATION nodes.
Do not call is_unop() and is_binop() when checking for unary and
binary operators.
Do not return early after simplify statement-expressions.
Do not call add_modify_stmt() to create assignment expressions.
(simplify_array_ref): Remove argument new_vars_p.  Update all callers.
(simplify_self_mod_expr): Ditto.
(simplify_component_ref): Ditto.
(simplify_call_expr): Ditto.
(simplify_tree_list): Ditto.
(simplify_cond_expr): Ditto.
(simplify_modify_expr): Ditto.
(simplify_boolean_expr): Ditto.
(simplify_compound_expr): Ditto.
(simplify_save_expr): New function.
(simplify_expr_wfl): New function.
(tree_build_scope): Reformat.
(add_tree): Call stmt_has_effect() and expr_has_effect() to decide
whether or not to add a new tree to the list.
(add_modify_stmt): Remove.
(create_tmp_var): Remove 'new_vars_p' argument.
Call pushdecl() to insert the newly created variable in the current
binding scope.
(declare_tmp_vars): Do not create a BLOCK_VARS for the scope.
(is_binop): Remove.
(is_unop): Remove.
(expr_has_effect): New function.
* c-tree.h (simplify_tree): Remove second argument.
* stmt.c (warn_if_unused_value): Check operand 0 of SAVE_EXPR
nodes.
* tree-dfa.c (find_refs_in_expr): Call find_refs_in_expr() to look
inside an EXPR_WITH_FILE_LOCATION node.
* tree-simple.c (is_simple_stmt): Add a case for SCOPE_STMT nodes.
(is_simple_compstmt): Assume that T is the first tree in the
compound statement's body.
Stop when a scope ending SCOPE_STMT node is found.
(is_simple_binary_expr): Don't call is_simple_binop().
(is_simple_condexpr): Don't call is_simple_relop().
(is_simple_binop): Remove.
(is_simple_relop): Remove.
(is_simple_unary_expr): Accept any operator with tree code class
'1' followed by a simple value.
Accept simple unary expressions wrapped inside SAVE_EXPR,
EXPR_WITH_FILE_LOCATION and NON_LVALUE_EXPR nodes.
(is_simple_id): Accept simple identifiers wrapped inside SAVE_EXPR,
EXPR_WITH_FILE_LOCATION and NON_LVALUE_EXPR nodes.
* tree-simple.h (create_tmp_var): Remove second argument.
(is_simple_binop): Remove.
(is_simple_relop): Remove.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52837 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (stmt_has_effect): New function.
dnovillo [Mon, 22 Apr 2002 21:41:59 +0000 (22 21:41 +0000)]
* c-simplify.c (stmt_has_effect): New function.
(simplify_stmt): Fix example code in comment.
Use EXPR_STMT_EXPR to access the expression in an expression
statement.
Call debug_c_node to display unhandled statements.
Call stmt_has_effect to determine whether the statement has been
nullified by the simplification process.
(simplify_for_stmt): Do not simplify the initialization expression
if it's NULL.
Do not convert post_cond_s into a statement chain.
Do not simplify the expression if it's NULL.
(simplify_switch_stmt): initialize post_cond_s to NULL before
simplifying the expression.
(simplify_expr): Rename argument IS_LHS to NEEDS_LVALUE.  Update
all uses.
When simplifying assignments, return the LHS of the assignment if
the caller wants to use the assignment as an rvalue.
Do not simplify ADDR_EXPR nodes.
Handle NOP_EXPR, CONVERT_EXPR, FIX_TRUNC_EXPR, FIX_CEIL_EXPR,
FIX_ROUND_EXPR, INDIRECT_REF, NEGATE_EXPR, INTEGER_CST, STRING_CST,
COMPLEX_CST.
Abort if the expression has not been simplified and cannot be used
as an rvalue to assign it to a temporary.
When creating a new temporary to hold an lvalue, if the expression
is an indirect reference, use the address of the referenced object.
When creating an indirect reference, use the pointed-to type as the
type of the reference.
(simplify_self_mod_expr): If the LHS operand needs to be
simplified, simplify twice.  Once to produce an lvalue and another
to produce a simple value.
(simplify_modify_expr): Break assignment chains (a = b = c = ...)
into individual assignments.
(simplify_compound_expr):
(create_tmp_var): If the type is an array, use TYPE_POINTER_TO as
the pointer type.
(update_line_number): Fix typo in comment.
(is_unop): Ditto.
(convert_to_stmt_chain): Only add statements that comply with
stmt_has_effect().
* tree-dfa.c (find_declaration): Fix typo in comment.
(debug_varref): Ditto.
* tree-flow.h: Ditto.
* tree-simple.c (is_simple_stmt): New function.
(is_simple_compstmt): New function.
(is_simple_expr): Fix typo in comment.
(is_simple_rhs): Allow conditional expressions.
(is_simple_modify_expr): Fix typo in comment.
(is_simple_modify_expr_lhs): Ditto.
(is_simple_binary_expr): Ditto.
(is_simple_condexpr): Ditto.
(is_simple_relop): Ditto.
(is_simple_unary_expr): Ditto.
Allow taking the address of a constant (for strings).
(is_simple_call_expr): Fix typo in comment.
Call is_simple_id to determine if the first operand is a SIMPLE
function identifier.
(is_simple_arglist): Fix typo in comment.
(is_simple_varname): Ditto.
(is_simple_const): Don't accept casts of SIMPLE constants.
(is_simple_id): Don't accept casts of SIMPLE identifiers.
(is_simple_val): Fix typo in comment.
(is_simple_arrayref): Ditto.
(is_simple_compref): Ditto.
(is_simple_compref_lhs): Ditto.
(is_simple_cast_op): Ditto.
(is_simple_exprseq): Allow NULL expression sequences.
* tree-simple.h (is_simple_stmt): Declare
(is_simple_compstmt): Declare.
* tree-ssa.c (follow_chain): Fix typo in comment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52638 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (dump_c_node): Don't print function
dnovillo [Mon, 22 Apr 2002 14:42:08 +0000 (22 14:42 +0000)]
* c-pretty-print.c (dump_c_node): Don't print function
bodies of FUNCTION_DECL nodes.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52613 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (c-call-graph.o): New.
aj [Fri, 19 Apr 2002 19:15:56 +0000 (19 19:15 +0000)]
* Makefile.in (c-call-graph.o): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52536 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-04-18 Sebastian Pop <s.pop@laposte.net>
dnovillo [Thu, 18 Apr 2002 18:39:51 +0000 (18 18:39 +0000)]
2002-04-18  Sebastian Pop  <s.pop@laposte.net>

* c-pretty-print.c (PRINT_FUNCTION_NAME): Define.
(dump_c_node): Call pretty_print_string to print string.
Call print_call_name to print function names.
(pretty_print_string): New function.
(print_call_name): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52483 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_do_stmt): Call is_simple_condexpr to test
dnovillo [Wed, 17 Apr 2002 18:16:58 +0000 (17 18:16 +0000)]
* c-simplify.c (simplify_do_stmt): Call is_simple_condexpr to test
if the conditional is in SIMPLE form.
(simplify_if_stmt): Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52437 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-pretty-print.c (dump_c_node): Handle escape sequences in strings.
dnovillo [Wed, 17 Apr 2002 16:44:56 +0000 (17 16:44 +0000)]
* c-pretty-print.c (dump_c_node): Handle escape sequences in strings.
(op_symbol): Handle TRUTH_NOT_EXPR.
* c-simplify.c: Rename 'after' with 'post' and 'before' with 'pre'
everywhere.
Re-group some functions and add comments.
(simplify_stmt): Update calls to simplify_for_stmt,
simplify_while_stmt, simplify_do_stmt and simplify_switch_stmt.
Call simplify_if_stmt.
Do not test if expression is in SIMPLE form before calling
simplify_expr.
Call convert_to_stmt_chain to emit statement trees for side effects
found while simplifying.
(simplify_for_stmt): Re-implement.  Do not change structure of the
statement.  Simplify each header expression and emit side effects
at sequence points.
(simplify_while_stmt): Ditto.
(simplify_do_stmt): Ditto.
(simplify_switch_stmt): Ditto.
(new_simplified_if): Rename to simplify_if_stmt.
Call simplify_expr to simplify the conditional.
(simplify_if_stmt): New name for new_simplified_if.
(simplify_expr): Do not default simple_test_f to is_simple_expr.
If simple_test_f is not set, abort.
Handle COMPOUND_EXPR, MODIFY_EXPR, TRUTH_ANDIF_EXPR,
TRUTH_ORIF_EXPR, SAVE_EXPR and EXPR_WITH_FILE_LOCATION.
(simplify_arglist): Rename to simplify_tree_list.
(simplify_tree_list): New name for simplify_arglist.
(simplify_boolean_expr): New function.
(simplify_compound_expr): New function.
(tree_build_scope): Use SCOPE_BEGIN_P instead of TREE_LANG_FLAG_0
to access scope operands.  Use COMPOUND_BODY instead of
TREE_OPERAND to access the body of the compound statement.
(add_tree): Use a TREE_LIST container instead of directly chaining the
trees.
(add_assignment_tree): Rename to add_modify_stmt.  Update all
callers.
(add_modify_stmt): New name for add_assignment_tree.
(insert_before_continue_end): Do nothing it the tree to insert is
NULL.
(copy_stmt_chain): Rename to deep_copy_list.  Update all callers.
(deep_copy_list): New name for copy_stmt_chain.
(copy_stmt): Rename to deep_copy_node.  Update all callers.
(deep_copy_node): New name for copy_stmt.  Handle TREE_LIST
trees.
(insert_before_first): New function.
(is_binop): Add COMPOUND_EXPR.
(convert_to_stmt_chain): New function.
* tree-cfg.c (make_for_stmt_blocks): Fix comment.
* tree-simple.c (is_simple_condexpr): New function.
(is_simple_const): Allow casts of SIMPLE constants.
(is_simple_id): Allow casts of SIMPLE identifiers.
(is_simple_cast): Call is_simple_cast_op.
(is_simple_cast_op): New function.
(is_simple_exprseq): New function.
* tree-simple.h (deep_copy_list): Declare.
(deep_copy_node): Declare.
(is_simple_cast_op): Declare.
(is_simple_exprseq): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@52432 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_expr): Add arguments simple_tree_f and
dnovillo [Wed, 3 Apr 2002 20:53:41 +0000 (3 20:53 +0000)]
* c-simplify.c (simplify_expr): Add arguments simple_tree_f and
is_lhs.  Update all callers.
Call simplify_call_expr, simplify_cond_expr, simplify_arglist and
simplify_modify_expr.
Call is_unop and is_binop to check for unary and binary operators.
(simplify_binary_expr): Remove.
(simplify_call_expr): New function.
(simplify_arglist): New function.
(simplify_cond_expr): New function.
(simplify_modify_expr): New function.
(keep_stmt_p): Remove.
(is_binop): New function.
(is_unop): New function.
(simplify_stmt): Don't call keep_stmt_p.
(simplify_decl_stmt): Call add_assignment_tree.
* tree-simple.c: Include c-tree.h
Add expression-statements to the SIMPLE grammar.
(is_simple_modify_expr_lhs): New function.
(is_simple_modify_expr): Call it.
(is_simple_relop): Update comment.
(is_simple_unary_expr): Allow expression-statements.
(is_simple_arglist): New function.
(is_simple_call_expr): Call it.
(is_simple_id): Accept expressions taking the address of a
function.
* tree-simple.h (is_simple_modify_expr_lhs): Declare.
(is_simple_arglist): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@51809 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge with mainline as of 2002-04-01.
dnovillo [Tue, 2 Apr 2002 15:37:04 +0000 (2 15:37 +0000)]
Merge with mainline as of 2002-04-01.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@51756 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Tue, 2 Apr 2002 15:37:04 +0000 (2 15:37 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@51755 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (c-simplify.o): Add dependency on varray.h.
dnovillo [Thu, 21 Mar 2002 05:28:28 +0000 (21 05:28 +0000)]
* Makefile.in (c-simplify.o): Add dependency on varray.h.
* c-simplify.c: Include varray.h.
Remove comments with SIMPLE grammar.
(simplify_array_ref): New.
(simplify_self_mod_expr): New.
(simplify_component_ref): New.
(add_assignment_tree): New.
(simplify_expr): Call simplify_array_ref to simplify array
references.
Call simplify_self_mod_expr to simplify ++, --, += and -=
expressions.
Call simplify_component_ref to simplify references to structures.
(simplify_binary_expr): Do not check whether the expression is
already in SIMPLE form.
* tree-simple.c: Document changes from original SIMPLE grammar.
(is_simple_unary_expr): Add check for *ID.
(is_simple_call_expr): Update comments.
(is_simple_const): Ditto.
(is_simple_id): Do not accept *ID expressions.
(is_simple_val): Update comments.
(is_simple_arrayref): Accept any variable name as the base address.
(is_simple_compref_lhs): New.
(is_simple_compref): Call it.
* tree-simple.h (is_simple_compref_lhs): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@51112 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (C_AND_OBJC_OBJS): Add tree-simple.o
dnovillo [Mon, 18 Mar 2002 23:52:21 +0000 (18 23:52 +0000)]
* Makefile.in (C_AND_OBJC_OBJS): Add tree-simple.o
(tree-simple.o): New rule.
* c-simplify.c (simplified_p): Remove.
(simplified_rec_p): Remove.
(simplified_condition_p): Remove.
(simplify_for_stmt): Call is_simple_expr instead of
simplified_condition_p.
(simplify_while_stmt): Ditto.
(simplify_do_stmt): Call is_simple_expr instead of simplified_p.
(new_simplified_if): Call is_simple_expr instead of
simplified_rec_p.
(simplify_decl_stmt): Update comment.
(simplify_expr): Return the original expression if it's already
in SIMPLE form.
Do not special case most binary and unary expressions.
When simplifying array references, create temporary variables to
hold the base address for the array.
Simplify COMPONENT_REF expressions separately.
Call simplify_binary_expr to handle most binary expressions.
(simplify_binary_expr): New function.
(keep_stmt_p): Call is_simple_unary_expr to determine whether the
statement should be kept or not.
* tree-simple.c: New file.
* tree-simple.h (is_simple_expr): Declare.
(is_simple_rhs): Declare.
(is_simple_modify_expr): Declare.
(is_simple_binary_expr): Declare.
(is_simple_binop): Declare.
(is_simple_relop): Declare.
(is_simple_unary_expr): Declare.
(is_simple_call_expr): Declare.
(is_simple_const): Declare.
(is_simple_id): Declare.
(is_simple_varname): Declare.
(is_simple_val): Declare.
(is_simple_arrayref): Declare.
(is_simple_compref): Declare.
(is_simple_cast): Declare.
* cp/Make-lang.in (CXX_C_OBJS): Add tree-simple.o

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@51014 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-03-18 Diego Novillo <dnovillo@redhat.com>
dnovillo [Mon, 18 Mar 2002 19:55:06 +0000 (18 19:55 +0000)]
2002-03-18  Diego Novillo  <dnovillo@redhat.com>

* tree-simple.h: New file.
* Makefile.in (c-simplify.o): Add dependency on tree-simple.h
* c-simplify.c: Reformat some comments.
(tree_last_decl): Declare.

2002-03-18  Sebastian Pop  <s.pop@laposte.net>

        * c-simplify.c (insert_stmt_chain): Delete.
        (simplified_condition_p, insert_after_case_labels): New.
(simplify_stmt, simplify_for_stmt, simplify_while_stmt,
simplify_do_stmt, new_simplified_if, simplify_switch_stmt):
Returns a single node, generate a chain of statements to be executed
before the if, and a list of new variables.
        (new_simplified_if): Simplify clauses.
        (simplify_expr): Remove unused parameter scope.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50996 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_switch_stmt, simplify_expr): Add scope
dnovillo [Thu, 14 Mar 2002 21:48:43 +0000 (14 21:48 +0000)]
* c-simplify.c (simplify_switch_stmt, simplify_expr): Add scope
parameter.
(simplify_while_stmt, simplify_do_stmt, simplify_for_stmt): Avoid
negating loop condition during simplification.
(new_simplified_if): Don't simplify the IF_BODY.
(copy_stmt_chain): Use copy_stmt.
(copy_stmt): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50785 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge with mainline as of 2002-03-04.
dnovillo [Tue, 5 Mar 2002 05:46:39 +0000 (5 05:46 +0000)]
Merge with mainline as of 2002-03-04.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50306 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Tue, 5 Mar 2002 05:46:39 +0000 (5 05:46 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50305 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-dfa.c (find_refs_in_stmt): Changed if/else statements in
dnovillo [Sat, 2 Mar 2002 00:02:58 +0000 (2 00:02 +0000)]
* tree-dfa.c (find_refs_in_stmt): Changed if/else statements in
a switch.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50216 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * c-simplify.c (simplify_if_stmt): Deleted.
dnovillo [Sat, 2 Mar 2002 00:00:11 +0000 (2 00:00 +0000)]
* c-simplify.c (simplify_if_stmt): Deleted.
(new_simplified_if): New function.
(make_type_writable): New function.
(insert_before_continue_end): New function.
(insert_before_continue): New function.
(copy_stmt_chain): New function.
(insert_stmt_chain): New function.
(update_line_number): New function.
(simplified_p): New function.
(simplified_rec_p) New function.
(simplify_stmt): Modify the way to call simplification
of COMPOUND_STMT, FOR_STMT, WHILE_STMT, DO_STMT, IF_STMT,
and SCOPE_STMT in order to avoid to execute the code after
the switch.  Add FILE_STMT, LABEL_STMT, GOTO_STMT, ASM_STMT cases.
Simplified a little the code after the switch.
(simplify_for_stmt): Change functions parameters.
Add code to simplify the FOR_INIT_STMT, FOR_COND, FOR_EXPR.
(simplify_while_stmt): Change functions parameters.
Add code to simplify the WHILE_COND.
(simplify_do_stmt): Change functions parameters.
Add code to simplify the DO_COND.
(simplify_switch_stmt): Change functions parameters.
(simplify_expr): Remove scope parameter.
Avoid to introduce a new temporary variable for an expression
that is already simplified.
([ARRAY|COMPONENT]_REF, COND_EXPR): Handle them apart.
(TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR): Avoid to evaluate the second
operand if the value can be deduced from the first one.
(keep_stmt_p): Add some other cases in which we don't need to keep
a statement after its simplification.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50215 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoForgot to commit c-call-graph.c in previous check-in.
dnovillo [Fri, 1 Mar 2002 23:56:41 +0000 (1 23:56 +0000)]
Forgot to commit c-call-graph.c in previous check-in.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50214 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in: Add c-call-graph.o dependence.
dnovillo [Fri, 1 Mar 2002 23:56:04 +0000 (1 23:56 +0000)]
* Makefile.in: Add c-call-graph.o dependence.
* c-call-graph.c: New file.
* c-decl.c (c_expand_body): Add an entry point for call-graph.
* tree-dump.c (dump_files): Add the flag dump-call-graph.
* tree.h (tree_dump_index): Add TDI_xml.

* c-pretty-print.c (dump_c_tree): Declare it extern.
(dump_c_node): Declare it extern.
(dump_c_scope_vars): Deleted, some code moved in print_declaration ().
(print_declaration): New function.
(print_function_decl): New function.
(print_struct_decl): New function.
(INDENT_PRINT_C_NODE): Deleted.
(INDENT): New macro.
(NIY): Define the macro body in a block.
(dump_c_node): Add dumping for TREE_PURPOSE operand in TREE_LIST.
[VOID|INTEGER|REAL|COMPLEX|VECTOR|ENUMERAL|BOOLEAN|CHAR]_TYPE nodes:
insert some code from print-tree.c:print_node_brief () in order to
stabilise the type printing.
[RECORD|UNION]_TYPE nodes: Don't print their contents by default,
move the existing code in print_struct_decl ().
[POSTDECREMENT|POSTINCREMENT]_EXPR: Print the operand in post postion.
[MIN|MAX|ABS]_EXPR: New code for printing these nodes.
FOR_STMT: Don't print the FOR_BODY if it is not present.
RETURN_STMT: Don't print the return expression for a void function.
ASM_STMT: New code for printing this node.
SCOPE_STMT: Use print_declaration instead of dump_c_scope_vars.
COMPOUND_LITERAL_EXPR: Add the node as not implemented yet.
(op_prio): Fix switch indent.
Add node EXPR_WITH_FILE_LOCATION with priority 16.
(op_symbol): Fix switch indent.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@50211 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerged workaround from mainline.
dnovillo [Mon, 28 Jan 2002 19:45:59 +0000 (28 19:45 +0000)]
Merged workaround from mainline.

2002-01-25  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

* java/awt/image/MemoryImageSource.java (newPixels(byte[], ColorModel,
int, int):  Remove empty "if" statement to work around compiler bug.
(newPixels(int[], ColorModel, int, int): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49294 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge with mainline as of 2002-01-25.
dnovillo [Sat, 26 Jan 2002 22:06:10 +0000 (26 22:06 +0000)]
Merge with mainline as of 2002-01-25.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49255 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Sat, 26 Jan 2002 22:06:10 +0000 (26 22:06 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49254 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-01-25 Diego Novillo <dnovillo@redhat.com>
dnovillo [Fri, 25 Jan 2002 22:13:51 +0000 (25 22:13 +0000)]
2002-01-25  Diego Novillo  <dnovillo@redhat.com>

* Makefile.in (c-pretty-print.o): Add dependency on errors.h.
* c-decl.c (c_expand_body): React to -ftree-dump-simple.
* c-pretty-print.c: Fix typo in header comment.
(NYI): Flush output buffer, dump the tree and abort.
(dump_c_node): Add unparsing code for ERROR_MARK, IDENTIFIER_NODE,
ARRAY_TYPE, UNION_TYPE, STRING_CST, CEIL_DIV_EXPR, FLOOR_DIV_EXPR,
ROUND_DIV_EXPR, TRUNC_MOD_EXPR, FLOOR_MOD_EXPR, ROUND_MOD_EXPR,
RDIV_EXPR, EXACT_DIV_EXPR, LROTATE_EXPR, RROTATE_EXPR,
BIT_ANDTC_EXPR, BIT_NOT_EXPR, UNORDERED_EXPR, SAVE_EXPR and
EXPR_WITH_FILE_LOCATION.
Unify unparsing code for common binary and unary expressions.
Handle indirect references like any other unary expression.
(dump_c_scope_vars): Remove unused variable 'context'.
Call dump_c_node to print the type.
(dump_c_indirect_ref): Remove.
(op_prio): New function.
(op_symbol): New function.
* c-simplify.c (simplify_stmt): Do not simplify a return
expression, only its second operand.
Fix capitalization in error message.
(simplify_expr): Add documentation.
Fix capitalization in error message.
* tree-dump.c (dump_files): Add entry for -fdump-tree-simple.
(dump_options): Add entry for -unparse.
* tree.h (TDI_simple): Define.
(TDF_UNPARSE): Define.
* doc/invoke.texi: Document -fdump-tree-simple.

2002-01-23  Sebastian Pop  <s.pop@laposte.net>

        * c-pretty-print.c : Clean C++ comments.
(debug_output_buffer): Remove declaration and definition.
        * diagnostic.h (debug_output_buffer): Add declaration.
* diagnostic.c (debug_output_buffer): Add definition.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49225 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * tree-dfa.c (find_refs_in_stmt): Fix capitalization in error
dnovillo [Mon, 21 Jan 2002 20:12:45 +0000 (21 20:12 +0000)]
* tree-dfa.c (find_refs_in_stmt): Fix capitalization in error
message.
(find_refs_in_expr): Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49053 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago*** empty log message ***
dnovillo [Mon, 21 Jan 2002 19:40:54 +0000 (21 19:40 +0000)]
*** empty log message ***

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49052 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago2002-01-20 Diego Novillo <dnovillo@redhat.com>
dnovillo [Mon, 21 Jan 2002 01:33:02 +0000 (21 01:33 +0000)]
2002-01-20  Diego Novillo  <dnovillo@redhat.com>
            Sebastian Pop  <s.pop@laposte.net>

* Makefile.in: Add c-simplify.o.
* cp/Make-lang.in: Ditto.
* c-decl.c (c_expand_body): Call simplify_stmt() before
calling optimize_tree().
* c-simplify.c: New file.
* c-tree.h (simplify_stmt): Declare.
(print_c_tree)
* tree-dfa.c (find_refs_in_stmt): Fix error message for unhandled
statement codes.

2002-01-20  Sebastian Pop  <s.pop@laposte.net>

* Makefile.in: Add c-pretty-print.o.
* cp/Make-lang.in: Ditto.
* c-pretty-print.c: New file.
* c-tree.h (print_c_tree): Declare.
(print_c_node): Declare.
(debug_c_tree): Declare.
(debug_c_node): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@49029 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Merge with mainline as of 2001-12-29.
dnovillo [Sun, 30 Dec 2001 03:27:59 +0000 (30 03:27 +0000)]
* Merge with mainline as of 2001-12-29.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@48395 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoThis commit was manufactured by cvs2svn to create branch
(no author) [Sun, 30 Dec 2001 03:27:59 +0000 (30 03:27 +0000)]
This commit was manufactured by cvs2svn to create branch
'ast-optimizer-branch'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@48394 138bc75d-0d04-0410-961f-82ee72b054a4

20 years ago * Makefile.in (tree-optimize.o): Don't depend on c-common.h
dnovillo [Sat, 29 Dec 2001 17:41:18 +0000 (29 17:41 +0000)]
* Makefile.in (tree-optimize.o): Don't depend on c-common.h
* tree-cfg.c: Don't include c-tree.h.  Explain why we need to
include c-common.h.
* tree-dfa.c: Explain why we need to include c-common.h.
* tree-ssa.c: Ditto.
* tree-optimize.c: Don't include c-common.h

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@48376 138bc75d-0d04-0410-961f-82ee72b054a4

20 years agoMerge with trunk as of 2001-12-17.
dnovillo [Sat, 22 Dec 2001 20:01:30 +0000 (22 20:01 +0000)]
Merge with trunk as of 2001-12-17.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ast-optimizer-branch@48275 138bc75d-0d04-0410-961f-82ee72b054a4