From: Richard Biener Date: Mon, 28 Jul 2008 14:33:56 +0000 (+0000) Subject: backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=726a989a8b74bf238a96029860bcf7ba14eff317;p=gcc.git backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 545f7112090..d950a3ae29e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,204 @@ +2008-07-28 Richard Guenther + + Merge from gimple-tuples-branch. + + * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. + * gimple.def: New file. + * gsstruct.def: Likewise. + * gimple-iterator.c: Likewise. + * gimple-pretty-print.c: Likewise. + * tree-gimple.c: Removed. Merged into ... + * gimple.c: ... here. New file. + * tree-gimple.h: Removed. Merged into ... + * gimple.h: ... here. New file. + + * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. + * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the + --enable-checking=gimple flag. + * config.in: Likewise. + * configure: Regenerated. + + * tree-ssa-operands.h: Tuplified. + * tree-vrp.c: Likewise. + * tree-loop-linear.c: Likewise. + * tree-into-ssa.c: Likewise. + * tree-ssa-loop-im.c: Likewise. + * tree-dump.c: Likewise. + * tree-complex.c: Likewise. + * cgraphbuild.c: Likewise. + * tree-ssa-threadupdate.c: Likewise. + * tree-ssa-loop-niter.c: Likewise. + * tree-pretty-print.c: Likewise. + * tracer.c: Likewise. + * gengtype.c: Likewise. + * tree-loop-distribution.c: Likewise. + * tree-ssa-loop-unswitch.c: Likewise. + * cgraph.c: Likewise. + * cgraph.h: Likewise. + * tree-ssa-loop-manip.c: Likewise. + * value-prof.c: Likewise. + * tree-ssa-loop-ch.c: Likewise. + * tree-tailcall.c: Likewise. + * value-prof.h: Likewise. + * tree.c: Likewise. + * tree.h: Likewise. + * tree-pass.h: Likewise. + * ipa-cp.c: Likewise. + * tree-scalar-evolution.c: Likewise. + * tree-scalar-evolution.h: Likewise. + * target.h: Likewise. + * lambda-mat.c: Likewise. + * tree-phinodes.c: Likewise. + * diagnostic.h: Likewise. + * builtins.c: Likewise. + * tree-ssa-alias-warnings.c: Likewise. + * cfghooks.c: Likewise. + * fold-const.c: Likewise. + * cfghooks.h: Likewise. + * omp-low.c: Likewise. + * tree-ssa-dse.c: Likewise. + * ipa-reference.c: Likewise. + * tree-ssa-uncprop.c: Likewise. + * toplev.c: Likewise. + * tree-gimple.c: Likewise. + * tree-gimple.h: Likewise. + * tree-chrec.c: Likewise. + * tree-chrec.h: Likewise. + * tree-ssa-sccvn.c: Likewise. + * tree-ssa-sccvn.h: Likewise. + * cgraphunit.c: Likewise. + * tree-ssa-copyrename.c: Likewise. + * tree-ssa-ccp.c: Likewise. + * tree-ssa-loop-ivopts.c: Likewise. + * tree-nomudflap.c: Likewise. + * tree-call-cdce.c: Likewise. + * ipa-pure-const.c: Likewise. + * c-format.c: Likewise. + * tree-stdarg.c: Likewise. + * tree-ssa-math-opts.c: Likewise. + * tree-ssa-dom.c: Likewise. + * tree-nrv.c: Likewise. + * tree-ssa-propagate.c: Likewise. + * ipa-utils.c: Likewise. + * tree-ssa-propagate.h: Likewise. + * tree-ssa-alias.c: Likewise. + * gimple-low.c: Likewise. + * tree-ssa-sink.c: Likewise. + * ipa-inline.c: Likewise. + * c-semantics.c: Likewise. + * dwarf2out.c: Likewise. + * expr.c: Likewise. + * tree-ssa-loop-ivcanon.c: Likewise. + * predict.c: Likewise. + * tree-ssa-loop.c: Likewise. + * tree-parloops.c: Likewise. + * tree-ssa-address.c: Likewise. + * tree-ssa-ifcombine.c: Likewise. + * matrix-reorg.c: Likewise. + * c-decl.c: Likewise. + * tree-eh.c: Likewise. + * c-pretty-print.c: Likewise. + * lambda-trans.c: Likewise. + * function.c: Likewise. + * langhooks.c: Likewise. + * ebitmap.h: Likewise. + * tree-vectorizer.c: Likewise. + * function.h: Likewise. + * langhooks.h: Likewise. + * tree-vectorizer.h: Likewise. + * ipa-type-escape.c: Likewise. + * ipa-type-escape.h: Likewise. + * domwalk.c: Likewise. + * tree-if-conv.c: Likewise. + * profile.c: Likewise. + * domwalk.h: Likewise. + * tree-data-ref.c: Likewise. + * tree-data-ref.h: Likewise. + * tree-flow-inline.h: Likewise. + * tree-affine.c: Likewise. + * tree-vect-analyze.c: Likewise. + * c-typeck.c: Likewise. + * gimplify.c: Likewise. + * coretypes.h: Likewise. + * tree-ssa-phiopt.c: Likewise. + * calls.c: Likewise. + * tree-ssa-coalesce.c: Likewise. + * tree.def: Likewise. + * tree-dfa.c: Likewise. + * except.c: Likewise. + * except.h: Likewise. + * cfgexpand.c: Likewise. + * tree-cfgcleanup.c: Likewise. + * tree-ssa-pre.c: Likewise. + * tree-ssa-live.c: Likewise. + * tree-sra.c: Likewise. + * tree-ssa-live.h: Likewise. + * tree-predcom.c: Likewise. + * lambda.h: Likewise. + * tree-mudflap.c: Likewise. + * ipa-prop.c: Likewise. + * print-tree.c: Likewise. + * tree-ssa-copy.c: Likewise. + * ipa-prop.h: Likewise. + * tree-ssa-forwprop.c: Likewise. + * ggc-page.c: Likewise. + * c-omp.c: Likewise. + * tree-ssa-dce.c: Likewise. + * tree-vect-patterns.c: Likewise. + * tree-ssa-ter.c: Likewise. + * tree-nested.c: Likewise. + * tree-ssa.c: Likewise. + * lambda-code.c: Likewise. + * tree-ssa-loop-prefetch.c: Likewise. + * tree-inline.c: Likewise. + * tree-inline.h: Likewise. + * tree-iterator.c: Likewise. + * tree-optimize.c: Likewise. + * tree-ssa-phiprop.c: Likewise. + * tree-vect-transform.c: Likewise. + * tree-object-size.c: Likewise. + * tree-outof-ssa.c: Likewise. + * cfgloop.c: Likewise. + * system.h: Likewise. + * tree-profile.c: Likewise. + * cfgloop.h: Likewise. + * c-gimplify.c: Likewise. + * c-common.c: Likewise. + * tree-vect-generic.c: Likewise. + * tree-flow.h: Likewise. + * c-common.h: Likewise. + * basic-block.h: Likewise. + * tree-ssa-structalias.c: Likewise. + * tree-switch-conversion.c: Likewise. + * tree-ssa-structalias.h: Likewise. + * tree-cfg.c: Likewise. + * passes.c: Likewise. + * ipa-struct-reorg.c: Likewise. + * ipa-struct-reorg.h: Likewise. + * tree-ssa-reassoc.c: Likewise. + * cfgrtl.c: Likewise. + * varpool.c: Likewise. + * stmt.c: Likewise. + * tree-ssanames.c: Likewise. + * tree-ssa-threadedge.c: Likewise. + * langhooks-def.h: Likewise. + * tree-ssa-operands.c: Likewise. + * config/alpha/alpha.c: Likewise. + * config/frv/frv.c: Likewise. + * config/s390/s390.c: Likewise. + * config/m32c/m32c.c: Likewise. + * config/m32c/m32c-protos.h: Likewise. + * config/spu/spu.c: Likewise. + * config/sparc/sparc.c: Likewise. + * config/i386/i386.c: Likewise. + * config/sh/sh.c: Likewise. + * config/xtensa/xtensa.c: Likewise. + * config/stormy16/stormy16.c: Likewise. + * config/ia64/ia64.c: Likewise. + * config/rs6000/rs6000.c: Likewise. + * config/pa/pa.c: Likewise. + * config/mips/mips.c: Likewise. + 2008-07-28 Simon Baldwin * c-pragma.c (handle_pragma_message): New function. diff --git a/gcc/ChangeLog.tuples b/gcc/ChangeLog.tuples new file mode 100644 index 00000000000..d5e338368b5 --- /dev/null +++ b/gcc/ChangeLog.tuples @@ -0,0 +1,8231 @@ +2008-07-28 Richard Guenther + + Merge with mainline @138201. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-07-27 Jakub Jelinek + + * omp-low.c (expand_omp_atomic_fetch_op): Fix a merge glitch. + +2008-07-27 Andrew Pinski + + * config/spu/spu.c (spu_gimplify_va_arg_expr): Unshare the args + and skip trees. + +2008-07-27 Richard Guenther + + * tree-eh.c (lookup_expr_eh_region): Do not allocate a tree + annotation. + * tree-dfa.c (create_tree_common_ann): Set eh region to -1. + * tree-flow.h (struct tree_ann_common_d): Reorder rn member + to pack with type. + +2008-07-26 Richard Guenther + + Merge with mainline @138159. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-07-26 Richard Guenther + + * gimple.h (CALL_STMT_CANNOT_INLINE_P): Remove. + +2008-07-26 Jan Hubicka + + * ipa-inline.c (cgraph_decide_inlining_of_small_function): Use + gimple_call_set_cannot_inline. + (cgraph_decide_inlining): Likewise. + (cgraph_decide_inlining_incrementally): Likewise. + +2008-07-26 Richard Guenther + + Merge with mainline @138092. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-07-26 Richard Guenther + + Merge with mainline @138091. + +2008-07-25 Richard Guenther + + * config/ia64/ia64.c (ia64_gimplify_va_arg): Unshare valist + before reusing it. + +2008-07-25 Andreas Krebbel + + * tree-tailcall.c (process_assignment): Prevent tail call + optimization if the modes of the return types don't match. + +2008-07-24 Aldy Hernandez + + * tree-inline.c (expand_call_inline): Allow casts in assert. + +2008-07-24 Richard Guenther + + PR middle-end/36885 + * tree.c (walk_tree_1): Also walk CHANGE_DYNAMIC_TYPE_EXPR operands. + * gimple.c (gss_for_code): GIMPLE_CHANGE_DYNAMIC_TYPE is GSS_WITH_OPS. + * gsstruct.def (GSS_CHANGE_DYNAMIC_TYPE): Remove. + +2008-07-24 Richard Guenther + + * tree-sra.c (sra_walk_expr): Also handle CONVERT_EXPR. + (sra_walk_gimple_assign): Correctly detect assigns we can handle. + * expr.c (expand_expr_real_1): Pass MOVE_NONTEMPORAL to + expand_assignment. + +2008-07-23 Richard Guenther + + * tree-ssa-dse.c (get_kill_of_stmt_lhs): Tuplify correct. + * gimple-pretty-print.c (dump_gimple_label): Dump non-local flag. + * tree.h (maybe_fold_stmt_addition): Declare. + * tree-ssa-ccp.c (maybe_fold_stmt_addition): Export. + (fold_gimple_assign): Return the new rhs instead of modifying the stmt. + (fold_stmt): Deal with that. + (fold_stmt_inplace): Only replace the rhs of a statement if + that has enough operand space to hold the new operands. + * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Fix + POINTER_PLUS_EXPR handling. + +2008-07-23 Richard Guenther + + * tree-eh.c (record_in_goto_queue): Fix bootstrap with + --disable-checking. + +2008-07-23 Aldy Hernandez + + Merge with mainline @138071. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-07-23 Richard Guenther + + * tree-eh.c (union treemple): Add tree * member. + (find_goto_replacement): Adjust. + (replace_goto_queue_cond_clause): Use the address of the + individual labels as unique identifier. + (replace_goto_queue_1): Use the statement as unique identifier + for GIMPLE_GOTO. + (record_in_goto_queue): Add checking. + (record_in_goto_queue_label): Adjust. + (maybe_record_in_goto_queue): Likewise. + (do_goto_redirection): Get leh_tf_state. + (lower_try_finally_nofallthru): Pass it. + (lower_try_finally_onedest): Likewise. + (lower_try_finally_copy): Likewise. + (lower_try_finally_switch): Likewise. + +2008-07-22 Aldy Hernandez + Jakub Jelinek + + * gimplify.c (gimple_do_not_emit_location_p): New. + (gimple_set_do_not_emit_location): New. + (annotate_one_with_location): Do not annotate if + gimple_do_not_emit_location_p. + (gimplify_cond_expr): Do not optimize if the COND_EXPR and + GOTO_EXPR have different locations. + Do not emit location information for some GIMPLE_COND's. + +2008-07-22 Richard Guenther + + * tree-ssa-ccp.c (ccp_fold): Use gimple_expr_type. + (fold_gimple_assign): Likewise. + * tree-inline.c (remap_gimple_op_r): Do not set TREE_BLOCK on + non-statements. Recurse to copy_tree_body_r with NULL block. + (copy_phis_for_bb): Likewise. + * tree-cfg.c (move_stmt_op): Do not set TREE_BLOCK on + non-statements. + +2008-07-22 Diego Novillo + Richard Guenther + + * tree-ssa-dom.c (hashable_expr_equal_p): Do nothing if + either TYPE0 or TYPE1 is NULL. + +2008-07-21 Diego Novillo + + * tree-ssa-alias-warnings.c (struct gimple_tree_map): New. + Change every use of struct tree_map to struct gimple_tree_map. + (gimple_tree_map_eq): New. + (gimple_tree_map_hash): New. + * tree-ssa-ccp.c (evaluate_stmt): Remove stale FIXME note. + * gimplify.c (gimplify_expr): Remove stale FIXME note. + * tree-ssa-pre.c: Remove stale references to GIMPLE_MODIFY_STMT. + * tree-vect-generic.c (expand_vector_operations_1): Change + FIXME tuples to NOTE. + +2008-07-21 Richard Guenther + + * tree-ssa-phiprop.c (propagate_with_phi): Only look through + SSA_NAME copies. + +2008-07-21 Richard Guenther + + * gimplify.c (gimplify_init_constructor): Clear TREE_SIDE_EFFECTS + on the remaining empty constructor. + +2008-07-21 Richard Guenther + + * tree-ssa-ccp.c (fold_gimple_assign): Handle pointer conversions + like fold_stmt_r did. + * gimple-pretty-print.c (dump_gimple_cond): Place semicolons + where trunk did. + * tree-inline.c (copy_bb): Do not insert GIMPLE_NOPs. + +2008-07-21 Richard Guenther + + PR tree-optimization/36826 + * tree-ssa-pre.c (eliminate): Do not eliminate in unused + statements. + +2008-07-20 Richard Guenther + + * gimple.h (gimple_expr_type): The expression type is always + the base type of an integral sub-type result type. + * tree-eh.c (replace_goto_queue_cond_clause): Copy the sequence + before handing it off to gsi_insert_seq_after. + * tree-sra.c (insert_edge_copies_seq): Make sure to not keep an + uninserted but marked for update sequence. + +2008-07-20 Richard Guenther + + * gimple.c (DEFTREECODE): Add REALIGN_LOAD_EXPR. + +2008-07-19 Richard Guenther + + * tree-ssa-sccvn.h (get_constant_value_id): Declare. + (vn_constant_eq_with_type): Make sure an integral type is + never equal to a non-integral type. + (vn_hash_constant_with_type): Adjust. + * tree-ssa-sccvn.c (get_constant_value_id): New function. + * tree-ssa-pre.c (get_expr_value_id): For newly created + constant value-ids make sure to add the expression to its + expression-set. + +2008-07-18 Jakub Jelinek + + * gimple.c (gimple_regimplify_operands): Moved to... + * gimplify.c (gimple_regimplify_operands): ... here. Rework using + lower_omp_1 regimplification code, if regimplified LHS of + GIMPLE_ASSIGN or GIMPLE_CALL requires simpler RHS, create a temporary. + * omp-low.c (gimple_regimplify_operands): Use + gimple_regimplify_operands. + +2008-07-18 Richard Guenther + + * tree-ssa-reassoc.c (get_rank): For single rhs process its + operands. + +2008-07-18 Richard Guenther + + * tree-ssa-loop-niter.c (expand_simple_operations): Expand + as much as trunk does. + * tree-ssa-sccvn.c (simplify_binary_expression): For comparisons + always expand the first operand. + +2008-07-18 Jakub Jelinek + + * gimple-pretty-print.c (dump_gimple_cond): Print a semicolon if + goto or else goto has been printed. + (dump_gimple_goto): Print as goto instead of gimple_goto, print + a semicolon at the end. + (dump_gimple_asm): Print a semicolon at the end. + + * gimplify.c (gimplify_cond_expr): If COND_EXPR has both non-trivial + THEN and ELSE statements and the THEN sequence can't fallthru, avoid + adding label_cont and jump to it. + +2008-07-18 Aldy Hernandez + + * Makefile.in. Remove TREE_GIMPLE_H definition. + Rename all TREE_GIMPLE_H uses to GIMPLE_H. + Depend on tree-iterator.h when necessary. + * tree-into-ssa.c: Include gimple.h instead of tree-gimple.h. + * tree-complex.c: Same. + * cgraphbuild.c: Same. + * cgraph.c: Same. + * builtins.c: Same. + * tree-ssa-sccvn.c: Same. + * tree-ssa-copyrename.c: Same. + * tree-nomudflap.c: Same. + * tree-call-cdce.c: Same. + * ipa-pure-const.c: Same. + * ipa-utils.c: Same. + * tree-ssa-alias.c: Same. + * tree-ssa-sink.c: Same. + * langhooks.c: Same. + * function.c: Same. + * ipa-type-escape.c: Same. + * tree-affine.c: Same. + * c-typeck.c: Same. + * tree-dfa.c: Same. + * tree-ssa-pre.c: Same. + * tree-sra.c: Same. + * c-omp.c: Same. + * tree-ssa-dce.c: Same. + * tree-nested.c: Same. + * tree-ssa.c: Same. + * tree-inline.c: Same. + * tree-iterator.c: Same. + * c-gimplify.c: Same. + * tree-vect-generic.c: Same. + * tree-flow.h: Same. + * tree-ssa-structalias.c: Same. + * ipa-struct-reorg.c: Same. + * tree-ssa-reassoc.c: Same. + * config/alpha/alpha.c: Same. + * config/s390/s390.c: Same. + * config/m32c/m32c.c: Same. + * config/spu/spu.c: Same. + * config/sparc/sparc.c: Same. + * config/i386/i386.c: Same. + * config/sh/sh.c: Same. + * config/xtensa/xtensa.c: Same. + * config/stormy16/stormy16.c: Same. + * config/ia64/ia64.c: Same. + * config/rs6000/rs6000: Same. + * config/mips/mips.c: Same. + * varpool.c: Same. + * cgraphunit.c: Same. Include tree-iterator.h + * tree-mudflap.c: Same. + * gimplify.c: Same. + * c-decl.c: Same. + * omp-low.c: Same. + * c-semantics: Same. + * gimple-low.c: Same. + * tree-gimple.c: Merge contents into... + * gimple.c: ...here. + * tree-gimple.h: Merge contents into... + * gimple.h: ...here. + +2008-07-17 Jakub Jelinek + + * omp-low.c (expand_omp_atomic_pipeline): Call + force_gimple_operand_gsi on RHS for IADDR initialization. + + * gimplify.c (gimplify_cond_expr): Push statements in between + gimple_push_condition and gimple_pop_condition into a new + gimple_seq, append it after gimple_pop_condition cleanups. + +2008-07-17 Richard Guenther + + * tree-complex.c (init_dont_simulate_again): Handle + {REAL,IMAG}PART_EXPR correctly. + * gimple-pretty-print.c (dump_unary_rhs): Dump VIEW_CONVERT_EXPR + and ASSERT_EXPR the same way as on trunk. + * tree-ssa-dom.c (initialize_hash_element): Do not record + the type for single rhs assigns. + (hashable_expr_equal_p): Deal with NULL types. + (eliminate_redundant_computations): Use print_gimple_expr. + * tree-vrp.c (stmt_interesting_for_vrp): Fix builtin call check. + (vrp_visit_stmt): Likewise. + * tree-ssa-forwprop.c (simplify_gimple_switch): Fix typo. + +2008-07-16 Richard Guenther + + PR tree-optimization/36792 + * tree-ssa-pre.c (get_or_alloc_expr_for): Handle unary + expressions inserted by SCCVN. + (do_SCCVN_insertion): Adjust comment. + (execute_pre): Allow insertion for FRE again. + + * tree-ssa-sccvn.c (simplify_unary_expression): Deal with + the GIMPLE_SINGLE_RHS statemens we get. + (init_scc_vn): Init VN_INFO->expr to NULL. + +2008-07-16 Richard Guenther + + Revert + 2008-07-16 Richard Guenther + * tree-ssa-pre.c (get_constant_for_value_id): Only hand out + constants of the correct type. + (fully_constant_expression): Pass the required type to + get_constant_for_value_id. + + * tree-ssa-sccvn.h (vn_hash_constant_with_type): New function. + (vn_constant_eq_with_type): Likewise. + * tree-ssa-sccvn.c (vn_constant_eq): Use vn_constant_eq_with_type. + (get_or_alloc_constant_value_id): Use vn_hash_constant_with_type. + * tree-ssa-pre.c (pre_expr_eq): Use vn_constant_eq_with_type. + (pre_expr_hash): Use vn_hash_constant_with_type. + (get_representative_for): Use constants as their representative. + (fully_constant_expression): Use constant parts in expressions + directly. + +2008-07-15 Aldy Hernandez + + * tree-ssa-propagate.c (valid_gimple_expression_p): Remove. + * tree-ssa-propagate.h (valid_gimple_expression_p): Remove. + * tree-eh.c: Factor out common code in operation_could_trap_p and + stmt_could_throw_1_p into... + (operation_could_trap_helper_p): New. + * gimplify.c (gimplify_expr): Rephrase fixme. + * tree-mudflap.c: Remove fixme. + +2008-07-17 Jakub Jelinek + + * tree-eh.c (collect_finally_tree): Call collect_finally_tree_1 + with region as second argument for GIMPLE_TRY_FINALLY's cleanup. + + * gimplify.c (gimplify_expr): Call gimple_try_set_catch_is_cleanup + for TRY_CATCH_EXPR. + +2008-07-16 Jakub Jelinek + + * tree-gimple.c (is_gimple_reg_rhs): Don't check for CALL_EXPRs + with side-effects. + * gimple.c (extract_ops_from_tree): Remove assert. + * gimplify.c (is_gimple_reg_or_call_rhs): New function. + (rhs_predicate_for): Return it instead of is_gimple_reg_rhs. + (gimplify_expr): Handle is_gimple_reg_or_call_rhs. + + * tree-ssa-threadedge.c (record_temporary_equivalences_for_stmts, + simplify_control_stmt_condition): Pass stmt instead of NULL as second + argument to simplify callback. + + * tree-vect-patterns.c (vect_recog_pow_pattern): Don't call + gimple_call_set_lhs with lhs of last_stmt. + * tree-vect-transform.c (vectorizable_call): Build a new dummy + assignment, replace the call with it and move over stmt_info. + + * tree-ssa-loop-niter.c (infer_loop_bounds_from_array): Use + is_gimple_assign instead of gimple_code () == GIMPLE_ASSIGN and + is_gimple_call instead of gimple_code () == GIMPLE_CALL. + * tree-ssa-propagate.c (update_call_from_tree, substitute_and_fold): + Likewise. + * tree-ssa-sccvn.c (visit_use): Likewise. + * tree-eh.c (stmt_could_throw_p): Likewise. + * tree-optimize.c (execute_fixup_cfg): Likewise. + * omp-low.c (check_omp_nesting_restrictions, scan_omp_1_stmt, + optimize_omp_library_calls): Likewise. + * tree-ssa-loop-im.c (movement_possibility, stmt_cost, + determine_invariantness_stmt): Likewise. + * tree-ssa-phiprop.c (phivn_valid_p, phiprop_insert_phi, + propagate_with_phi): Likewise. + * tree-ssa-ccp.c (get_default_value, surely_varying_stmt_p, + ccp_fold_builtin, gimplify_and_update_call_from_tree): Likewise. + * ipa-struct-reorg.c (is_result_of_mult, create_general_new_stmt): + Likewise. + * tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise. + * tree-object-size.c (alloc_object_size, call_object_size, + check_for_plus_in_loops): Likewise. + * tree-ssa.c (verify_ssa): Likewise. + * predict.c (expr_expected_value_1, tree_bb_level_predictions, + tree_estimate_probability): Likewise. + * tree-cfg.c (verify_stmt): Likewise. + * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, + copy_loop_headers): Likewise. + * tree-ssa-ter.c (is_replaceable_p): Likewise. + * ipa-prop.c (ipa_count_arguments, ipa_compute_jump_functions): + Likewise. + * tree-ssa-dom.c (gimple_assign_unary_useless_conversion_p, + record_equivalences_from_stmt, optimize_stmt, + get_lhs_or_phi_result): Likewise. + * tree-ssa-sink.c (is_hidden_global_store): Likewise. + * tree-nrv.c (tree_nrv, execute_return_slot_opt): Likewise. + * value-prof.c (gimple_divmod_fixed_value, + gimple_mod_pow2, gimple_mod_subtract): Likewise. + * tree-predcom.c (name_for_ref, find_looparound_phi, + replace_ref_with, remove_name_from_operation): Likewise. + * tree-ssa-math-opts.c (is_division_by, execute_cse_reciprocals, + execute_cse_sincos, execute_convert_to_rsqrt): Likewise. + * tree-complex.c (expand_complex_move, expand_complex_operations_1): + Likewise. + * tree-outof-ssa.c (identical_copies_p): Likewise. + * tree-ssa-pre.c (is_exception_related): Likewise. + * tree-sra.c (scalarize_use, scalarize_copy): Likewise. + * tree-ssa-alias.c (count_uses_and_derefs, update_alias_info_1, + is_escape_site): Likewise. + * lambda-code.c (can_put_in_inner_loop, + cannot_convert_bb_to_perfect_nest): Likewise. + * tree-tailcall.c (find_tail_calls, eliminate_tail_call): Likewise. + * ipa-type-escape.c (look_for_casts_stmt, is_cast_from_non_pointer): + Likewise. + * tree-vect-transform.c (vectorizable_reduction): Likewise. + * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts): + Likewise. + * tree-ssa-phiopt.c (nt_init_block): Likewise. + * tree-ssa-structalias.c (find_func_aliases): Likewise. + * tree-ssa-forwprop.c (can_propagate_from, + forward_propagate_comparison, simplify_not_neg_expr, + simplify_gimple_switch, tree_ssa_forward_propagate_single_use_vars): + Likewise. + * tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise. + * tree-ssa-dse.c (get_kill_of_stmt_lhs, dse_possible_dead_store_p, + dse_optimize_stmt, execute_simple_dse): Likewise. + * tree-ssa-loop-ivopts.c (find_interesting_uses_op, + find_interesting_uses_stmt, rewrite_use_nonlinear_expr): Likewise. + * tree-vrp.c (stmt_overflow_infinity, vrp_stmt_computes_nonzero, + register_edge_assert_for_2, register_edge_assert_for, + find_assert_locations, check_all_array_refs, + remove_range_assertions, stmt_interesting_for_vrp, vrp_visit_stmt, + simplify_stmt_using_ranges): Likewise. + * tree-ssa-loop-prefetch.c (gather_memory_references): Likewise. + * tree-ssa-copy.c (may_propagate_copy_into_stmt, + propagate_tree_value_into_stmt): Likewise. + * tree-inline.c (copy_bb, expand_call_inline, + gimple_expand_calls_inline, fold_marked_statements): Likewise. + + * tree-ssa-copyrename.c (rename_ssa_copies): Use + gimple_assign_ssa_name_copy_p. + + * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Check + gimple_assign_rhs_code, type of rhs is TREE_TYPE (lhs), update + rhs_code. + +2008-07-16 Richard Guenther + + * tree-ssa-pre.c (get_constant_for_value_id): Only hand out + constants of the correct type. + (fully_constant_expression): Pass the required type to + get_constant_for_value_id. + +2008-07-15 Aldy Hernandez + + Merge with mainline @137837. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-07-15 Jakub Jelinek + + * common.opt (-fgimple-conversion=): Remove. + + * tree-affine.c (aff_combination_expand): Tuplify. + * cfgexpand.c (gimple_assign_rhs_to_tree): Remove prototype. + * tree-outof-ssa.c (gimple_assign_rhs_to_tree): Likewise. + * tree-gimple.h (gimple_assign_rhs_to_tree): New prototype. + +2008-07-15 Aldy Hernandez + + * tree.h: Remove gimple_unreachable_1 prototype. + +2008-07-15 Aldy Hernandez + + * Makefile.in (gimple-dummy.o): Remove. + * gimple-dummy.c: Delete. + * tree-ssa-propagate.c (valid_gimple_expression_p): Change + gimple_unreachable to gcc_unreachable. + * tree-affine.c (aff_combination_expand): Same. + * tree-vect-transform.c (vectorizable_call): Same. + +2008-07-15 Richard Guenther + + * gimplify.c (gimplify_expr): Gimplify an unused volatile load + properly. + +2008-07-15 Richard Guenther + + * tree-ssa-pre.c: Tuplify. Enable FRE and PRE. + (execute_pre): Disable SCCVN insertion even for FRE. + * tree-ssa-sccvn.h (copy_reference_ops_from_call): Declare. + * tree-ssa-sccvn.c (copy_reference_ops_from_call): Export. + (vn_get_expr_for): Handle more expression kinds. + (visit_reference_op_load): Properly set a value id for + inserted names. + (simplify_binary_expression): Use valid_gimple_rhs_p instead of + valid_gimple_expression_p. + (simplify_unary_expression): Likewise. + (process_scc): Clear the cached/simplified expressions at the + start of the iteration. + (free_scc_vn): Do not clear SSA_NAME_VALUE. + (run_scc_vn): Remove broken special case in printing VNs. + * tree-ssa-propagate.c (valid_gimple_rhs_p): Allow + gimple-min-invariants and SSA names. + +2008-07-14 Andreas Krebbel + + * config/s390/s390.c: (s390_gimplify_va_arg) Unshare the args* tree. + +2008-07-14 Richard Guenther + + * tree-ssa-math-opts.c (execute_cse_reciprocals): Process + SSA_NAME defs of calls. + * gimple-pretty-print.c (dump_unary_rhs): Do not prefix + CONSTRUCTOR with [constructor]. + +2008-07-14 Aldy Hernandez + + * config/alpha/alpha.c (va_list_skip_additions): Change + GIMPLE_STMT_OPERAND to TREE_OPERAND. + +2008-07-14 Jakub Jelinek + + * tree-vect-transform.c (vect_create_data_ref_ptr): Update comment. + * config/s390/s390.c (s390_va_start): Build MODIFY_EXPR instead of + GIMPLE_MODIFY_STMT. + (s390_gimplify_va_arg): Use gimplify_assign. + * config/sh/sh.c (sh_va_start): Build MODIFY_EXPR instead of + GIMPLE_MODIFY_STMT. + (sh_gimplify_va_arg_expr): Use gimplify_assign. + * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise. + * config/spu/spu.c (spu_va_start): Build MODIFY_EXPR instead of + GIMPLE_MODIFY_STMT. + (spu_gimplify_va_arg_expr): Use gimplify_assign. + * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): + Build MODIFY_EXPR instead of GIMPLE_MODIFY_STMT. + (xstormy16_gimplify_va_arg_expr): Likewise. Use gimplify_assign. + * config/xtensa/xtensa.c (xtensa_va_start): Build MODIFY_EXPR + instead of GIMPLE_MODIFY_STMT. + (xtensa_gimplify_va_arg_expr): Use gimplify_assign. + +2008-07-14 Aldy Hernandez + + * config/alpha/alpha.c (va_list_skip_additions): Rename + GIMPLE_MODIFY_STMT to MODIFY_EXPR. + (alpha_va_start): Same. + (alpha_gimplify_va_arg_1): Use gimplify_assign. + (alpha_gimplify_va_arg): Same. + * config/frv/frv.c (frv_expand_builtin_va_start): Rename + GIMPLE_MODIFY_STMT to MODIFY_EXPR. + * config/ia64/ia64.c (ia64_gimplify_va_arg): Use gimplify_assign. + * config/alpha/mips.c (mips_va_start): Rename GIMPLE_MODIFY_STMT to + MODIFY_EXPR or use gimplify_assign when appropriate. + (mips_gimplify_va_arg_expr): Same. + +2008-07-14 Aldy Hernandez + + * config/rs6000/rs6000.c (rs6000_va_start): Change + GIMPLE_MODIFY_STMT to MODIFY_EXPR. + (rs6000_gimplify_va_arg): Use gimplify_assign. + Build GIMPLE_GOTO directly. + +2008-07-14 Aldy Hernandez + + * tree-dump.c (dequeue_and_dump): Remove GIMPLE_MODIFY_STMT case. + * tree-ssa-loop-niter.c (simplify_replace_tree): Remove GIMPLE_STMT_P + call. + * tree-pretty-print.c (dump_generic_node): Remove any references to + GIMPLE_MODIFY_STMT, GIMPLE_STMT_P, GIMPLE_TUPLE_P. + (op_prio): Same. + (op_symbol_code): Same. + * java/java-gimplify.c (java_gimplify_expr): Same. + (java_gimplify_modify_expr): Same. + * java/java-tree.h: Rename GENERIC_NEXT to TREE_CHAIN. + * tree-tailcall.c (find_tail_calls): Update comment. + * tree.c (tree_code_class_string): Remove "gimple_stmt". + (tree_node_kind): Remove "gimple statments". + (tree_code_size): Remove tcc_gimple_stmt. + (make_node_stat): Same. + (copy_node_stat): Remove any references to + GIMPLE_MODIFY_STMT, GIMPLE_STMT_P, GIMPLE_TUPLE_P, tcc_gimple_stmt, + TS_GIMPLE_STATEMENT, GENERIC_TREE_OPERAND, GENERIC_TREE_TYPE, + GIMPLE_TUPLE_HAS_LOCUS_P, GIMPLE_STMT_LOCUS, GIMPLE_STMT_BLOCK, + IS_GIMPLE_STMT_CODE_CLASS, GIMPLE_STMT_BLOCK. + (expr_align): Same. + (tree_node_structure): Same. + (build2_stat): Same. + (set_expr_locus): Same. + (walk_tree_1): Same. + (tree_block): Same. + (build_gimple_modify_stmt_stat): Remove. + (expr_location): Remove. + (set_expr_location): Remove. + (expr_hash_location): Remove. + (expr_locus): Remove. + (expr_filename): Remove. + (expr_lineno): Remove. + (generic_tree_operand): Remove. + (generic_tree_type): Remove. + * tree.h (tree_code_class): Remove tcc_gimple_stmt. + (IS_GIMPLE_STMT_CODE_CLASS): Remove. + (struct gimple_stmt): Remove. + (GIMPLE_STMT_CHECK): Remove. + (TREE_OPERAND_CHECK): Remove GIMPLE_TUPLE_P. + (TREE_CHAIN): Same. + (GIMPLE_STMT_OPERAND_CHECK): Remove. + (GIMPLE_STMT_OPERAND_CHECK): Remove. + (GIMPLE_STMT_P): Remove. + (GIMPLE_TUPLE_P): Remove. + (GIMPLE_TUPLE_HAS_LOCUS_P): Remove. + (GENERIC_TREE_OPERAND): Remove. + (GENERIC_TREE_TYPE): Remove. + (GENERIC_NEXT): Remove. + (IS_CONVERT_EXPR_CODE_P): Rename GENERIC_TREE_TYPE to TREE_TYPE. + (MOVE_NONTEMPORAL): Remove GIMPLE_MODIFY_STMT_CHECK. + Remove GIMPLE_STMT_OPERAND, GIMPLE_STMT_LOCUS, GIMPLE_STMT_BLOCK. + (EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_HAS_LOCATION, EXPR_LOCUS, + EXPR_FILENAME, EXPR_LINENO): Do ont call functions. + (CAN_HAVE_LOCATION_P): Remove GIMPLE_STMT_P. + (union tree_node): Remove gstmt. + (build_gimple_modify_stmt*): Remove. + (expr_location, set_expr_location, expr_has_location, + expr_locus, expr_filename, expr_lineno, generic_tree_operand, + generic_tree_type): Remove. + * tree-scalar-evolution.c (follow_ssa_edge): Update comment. + (interpret_condition_phi): Same. + * gimple.h (gimplify_assign): New. + * builtins.c, fold-const.c, omp-low.c, tree-ssa-dse.c, tree-gimple.c, + tree-ssa-math-opts.c, tree-nrv.c, gimple-low.c, dwarf2out.c, + expr.c, tree-parloops.c, matrix-reorg.c, c-decl.c, tree-eh.c, + c-pretty-print.c, langhooks.c, function.c, tree-affine.c, + gimplify.c, tree.def, cfgexpand.c, tree-predcom.c, print-tree.c, + tree-ssa-ter.c, tree-ssa.c, tree-inline.c, gimple.c, gimple.h, + tree-cfg.c, config/i386/i386.c, stmt.c, tree-ssa-operands.c) + Remove any references to + GIMPLE_MODIFY_STMT, GIMPLE_STMT_P, GIMPLE_TUPLE_P, tcc_gimple_stmt, + TS_GIMPLE_STATEMENT, GENERIC_TREE_OPERAND, GENERIC_TREE_TYPE, + GIMPLE_TUPLE_HAS_LOCUS_P, GIMPLE_STMT_LOCUS, GIMPLE_STMT_BLOCK, + IS_GIMPLE_STMT_CODE_CLASS, GIMPLE_STMT_BLOCK. + Call gimplify_assign or generate a GIMPLE_ASSIGN directly when + appropriate. + +2008-07-14 Jakub Jelinek + + * cfgexpand.c (gimple_cond_pred_to_tree): New function. + (gimple_to_tree) : Use it. + (release_stmt_tree): New function. + (expand_gimple_cond): Call just gimple_cond_pred_to_tree + instead of gimple_to_tree, ggc_free pred before returning. + (expand_gimple_tailcall): Call release_stmt_tree. + (expand_gimple_basic_block): Call release_stmt_tree instead + of ggc_free. + + * gimplify.c (internal_get_tmp_var, gimplify_decl_expr, + gimplify_init_ctor_eval, gimplify_target_expr): Call ggc_free + on the INIT_EXPR. + +2008-07-14 Richard Guenther + + * tree-ssa-ccp.c (ccp_fold): Move ADDR_EXPR handing to + GIMPLE_SINGLE_RHS case. + * tree-ssa-ifcombine.c (ifcombine_iforif): Fix typo. + +2008-07-14 Jakub Jelinek + + * system.h (CONST_CAST2): Avoid using a union for all GCCs <= 4.0.x. + +2008-07-12 Diego Novillo + + * tree-loop-distribution.c: Tuplify. + * tree-ssa-propagate.c (substitute_and_fold): Remove + stale FIXME tuples note. + +2008-07-11 Jakub Jelinek + + * tree-dump.c (dump_options): Don't set TDF_RHS_ONLY for -all. + + * omp-low.c (lower_omp_1): Only use rhs_predicate_for if + GIMPLE_SINGLE_RHS. + + * tree-vect-analyze.c (vect_determine_vectorization_factor): Handle + GIMPLE_CALL with non-NULL lhs. + (vect_build_slp_tree): Likewise. Fix reversed check for references. + * tree-vectorizer.c (stmt_vec_info_htab, stmt_vec_info_eq, + stmt_vec_info_hash, init_stmt_vec_info_htab, + free_stmt_vec_info_htab): Remove. + (stmt_vec_info_vec): New variable. + (init_stmt_vec_info_vec, free_stmt_vec_info_vec): New functions. + (new_loop_vec_info): Clear stmt uid before calling + set_vinfo_for_stmt. + (vect_is_simple_use): Handle GIMPLE_CALL with non-NULL lhs. + (vectorize_loops): Call {init,free}_stmt_vec_info_vec instead of + {init,free}_stmt_vec_info_htab. + * tree-parloops.c (parallelize_loops): Likewise. + * tree-ssa-operands.c (get_expr_operands): Handle VEC_COND_EXPR. + * tree-vectorizer.h (stmt_vec_info_htab): Removed. + (init_stmt_vec_info_htab, free_stmt_vec_info_htab): Remove + prototypes. + (stmt_vec_info_vec): New extern decl. + (init_stmt_vec_info_vec, free_stmt_vec_info_vec): New prototypes. + (vinfo_for_stmt, set_vinfo_for_stmt): Rewritten using stmt uid + and vector instead of a hash table. + * tree-vect-patterns.c (vect_recog_pow_pattern): Request + a GIMPLE_CALL with non-NULL lhs instead of GIMPLE_ASSIGN. + (vect_pattern_recog_1): Use is_gimple_call instead of comparing + gimple_code with GIMPLE_CALL. + * gimple.c (gimple_rhs_class_table): Use GIMPLE_SINGLE_RHS for + DOT_PROD_EXPR and VEC_COND_EXPR. + * tree-vect-transform.c (vect_get_slp_vect_defs): Use gimple_get_lhs + instead of gimple_assign_lhs. + (get_initial_def_for_induction): Use build_int_cst even for + pointers. Use POINTER_PLUS_EXPR for POINTER_TYPE_P (scalar_type). + (vect_get_vec_def_for_operand): Use is_gimple_call instead of + comparing gimple_code with GIMPLE_CALL. + (vectorizable_call): Likewise. Use gimple_call_lhs instead of + gimple_assign_lhs. Build a vector of arguments, use + gimple_build_call_vec. + (vect_get_vec_def_for_stmt_copy): Use gimple_get_lhs. + (vectorizable_live_operation): Handle GIMPLE_SINGLE_RHS operands. + +2008-07-11 Doug Kwan + + * gimple-dummy.c (vectorizable_induction, vectorizable_type_promotion, + vectorizable_type_demotion, vectorizable_conversion, + vectorizable_operation, vectorizable_assignment, + vectorizable_load, vectorizable_call, vectorizable_store, + vectorizable_condition, vectorizable_reduction, + vectorizable_live_operation, vectorizable_function, + vect_estimate_min_profitable_iters, vect_model_simple_cost, + vect_model_store_cost, vect_model_load_cost, vect_transform_loop): + Remove DUMMY_FNs. + * tree-ssa-loop.c (gate_tree_vectorize): Reenable vectorizer. + * tree-vectorizer.c (vect_is_simple_use): Fix handling of + GIMPLE_NOP. + * tree-vectorizer.h (vectorizable_load, vectorizable_store, + vectorizable_operation, vectorizable_type_promotion, + vectorizable_type_demotion, vectorizable_conversion, + vectorizable_assignment, vectorizable_call, vectorizable_condition, + vectorizable_live_operation, vectorizable_reduction, + vectorizable_induction): Adjust prototypes. + * tree-vect-transform.c (vectorizable_load, vectorizable_store, + vectorizable_operation, vectorizable_type_promotion, + vectorizable_type_demotion, vectorizable_conversion, + vectorizable_assignment, vectorizable_call, vectorizable_condition, + vectorizable_live_operation, vectorizable_reduction, + vectorizable_induction, vect_transform_stmt, + vect_create_data_ref_ptr, vect_create_addr_base_for_vector_ref, + vect_get_vec_def_for_operand, vect_init_vector, + vect_finish_stmt_generation, vect_create_epilog_for_reduction, + get_initial_def_for_reduction, cost_for_stmt, + vect_estimate_min_profitable_iters, vect_model_reduction_cost, + vect_cost_strided_group_size, vect_model_load_cost, bump_vector_ptr, + vect_get_constant_vectors, vect_get_slp_vect_defs, + vect_get_slp_defs, get_initial_def_for_induction, + vect_get_vec_def_for_stmt_copy, vect_get_vec_defs, + vectorizable_function, vect_gen_widened_results_half, + vect_permute_store_chain, vect_setup_realignment, + vect_permute_load_chain, vect_transform_strided_load, + vect_is_simple_cond, vect_build_loop_niters, + vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer, + vect_do_peeling_for_loop_bound, vect_gen_niters_for_prolog_loop, + vect_do_peeling_for_alignment, vect_create_cond_for_align_checks, + vect_create_cond_for_alias_checks, vect_loop_versioning, + vect_remove_stores, vect_schedule_slp_instance, + vect_transform_loop): Tuplify. + +2008-07-10 Richard Guenther + + * gimple.h (gimple_assign_ssa_name_copy_p): Declare. + (gimple_has_lhs): New function. + * gimple.c (gimple_assign_ssa_name_copy_p): New function. + * tree-ssa-copy.c (propagate_tree_value_into_stmt): Remove + redundant gimple_set_location call. + * gimple-iterator.c (gsi_remove): Do not free stmt operands. + * tree-ssa-structalias.c (find_func_aliases): Correctly let + all things with pointers escape. + * tree-pass.h (TDF_RHS_ONLY): New flag. + * diagnostic.h (print_gimple_expr): Declare. + * gimple-pretty-print.c (print_gimple_expr): New function. + (dump_gimple_assign): Dump the RHS as expression if TDF_RHS_ONLY. + (dump_gimple_call): Likewise. + (dump_gimple_cond): Likewise. + * tree-ssa-propagate.c (fold_predicate_in): Use print_gimple_expr. + * tree-ssa-sccvn.c (visit_use): Use gimple_has_lhs. + Use print_gimple_expr. Handle tcc_expression correctly. + +2008-07-09 Jakub Jelinek + + * gimplify.c (struct gimplify_ctx): Move to tree-gimple.h. + (push_gimplify_context): Don't allocate bind_expr_stack, + temp_htab nor c itself here. Add c argument. + (pop_gimplify_context): Allow bind_expr_stack being NULL. Check + c->temp_htab instead of optimize whether htab_delete should be called. + Don't free c. + (gimple_push_bind_expr): Create bind_expr_stack lazily. + (lookup_tmp_var): Create temp_htab lazily. + (gimplify_scan_omp_clauses, gimplify_omp_parallel, gimplify_omp_task, + gimplify_body, force_gimple_operand): Adjust push_gimplify_context + callers. + * omp-low.c (lower_omp_sections, lower_omp_single, lower_omp_master, + lower_omp_ordered, lower_omp_critical, lower_omp_for, + create_task_copyfn, lower_omp_taskreg, execute_lower_omp): + * tree-ssa-ccp.c (gimplify_and_update_call_from_tree): Likewise. + * tree-sra.c (generate_element_init): Likewise. + * tree-mudflap.c (execute_mudflap_function_ops, + execute_mudflap_function_decls): Likewise. + * tree-inline.c (setup_one_parameter, optimize_inline_calls): Likewise. + * tree-gimple.h (struct gimplify_ctx): New type. + (push_gimplify_context): Adjust prototype. + + * gimple.h (gimple_rhs_class_table): New extern decl. + (get_gimple_rhs_class): Change into inline. + * gimple.c (get_gimple_rhs_class): Removed. + (gimple_rhs_class_table): New variable. + +2008-07-09 Doug Kwan + Diego Novillo + + * tree-ssa-ccp.c (fold_stmt_r): Remove gcc_unreachable + call from COND_EXPR handler. + * tree-if-conv.c: Tuplify. + * gimple.c (gimple_could_trap_p_1): Factor out of ... + (gimple_could_trap_p): ... here. + Call it. + (gimple_assign_rhs_could_trap_p): New. + * gimple.h (gimple_assign_rhs_could_trap_p): Declare. + * tree-ssa-operands.c (get_expr_operands): Handle + COND_EXPR. + +2008-07-08 Jakub Jelinek + + Merge with mainline @137633. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-07-08 Jakub Jelinek + + * tree-cfg.c (remove_useless_stmts_cond): Avoid calling + fold_binary. + +2008-07-07 Jakub Jelinek + + * gimple-pretty-print.c (dump_gimple_return): Don't print space + after return if return has no argument. + (dump_gimple_seq): Don't print newline after last statement in + the sequence. + (dump_gimple_fmt, dump_gimple_try, dump_gimple_omp_for, + dump_gimple_omp_single, dump_gimple_omp_sections, + dump_gimple_omp_block, dump_gimple_omp_critical, + dump_gimple_omp_parallel, dump_gimple_omp_task): Use + newline_and_indent after dump_gimple_seq instead of INDENT. + (dump_gimple_bind): Likewise. If there are no bind vars, don't + print two newlines before the sequence, just one. + * tree-cfg.c (dump_function_to_file): Fix dumping lowered gimple + before CFG is built. + +2008-07-07 Diego Novillo + + * tree-vrp.c (ssa_name_nonnegative_p): Tuplify. + (ssa_name_nonzero_p): Tuplify. + (extract_range_from_comparison): Tidy. + (vrp_evaluate_conditional_warnv_with_ops): Tidy. + (vrp_evaluate_conditional): Change STMT argument to gimple. + Update all users. + (simplify_stmt_for_jump_threading): Change WITHIN_STMT argument + to gimple. + Update all users. + (identify_jump_threads): Tidy. + * tree-tailcall.c (find_tail_calls): Remove stale FIXME note. + * tree.c (tree_node_structure): Likewise. + * tree.h (struct tree_base): Likewise. + (struct gimple_stmt): Likewise. + * builtins.c (expand_builtin_memcpy): Likewise. + (expand_builtin_memset_args): Likewise. + * tree-chrec.h (build_polynomial_chrec): Do not initialize VAL. + * tree-ssa-ccp.c (fold_stmt_r): Do not handle COND_EXPR. + (fold_stmt): Remove #if 0 code. + * tree-ssa-dom.c (EXTRA_DETAILS): Remove. + Update all users. + (hashable_expr_equal_p): Remove stale FIXME note. + (simplify_stmt_for_jump_threading): Convert WITHIN_STMT + argument to gimple. Update all users. + * tree-ssa-propagate.c: Include gimple.h + (get_rhs): Remove. + (set_rhs): Remove. + (fold_predicate_in): Tuplify. + * Makefile.in (tree-ssa-propagate.o): Add dependency on + GIMPLE_H. + * tree-ssa-propagate.h (get_rhs, set_rhs): Remove. + * tree-parloops.c (create_parallel_loop): Remove FIXME + tuples note. + * tree-eh.c (lookup_stmt_eh_region): Remove FIXME tuples + editorial note. + * cfgexpand.c (gimple_to_tree): Likewise. + * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Tidy. + Do not handle GIMPLE_BIND. + * tree-inline.c (remap_gimple_op_r): Remove stale FIXME notes. + * tree-optimize.c (execute_fixup_cfg): Likewise. + * tree-flow.h (struct tree_ann_common_d): Remove stale + FIXME tuples notes. + (tree_vrp_evaluate_conditional): Change last argument type to + gimple. Update all users. + (thread_across_edge): Likewise. + * gimple.c (gimple_has_side_effects): If any argument has + TREE_SIDE_EFFECTS set, assert that S has volatile operands. + (gimple_rhs_has_side_effects): Likewise. + * gimple.h (gimple_phi_capacity): Remove stale FIXME tuples note. + * tree-cfg.c (group_case_labels): Remove FIXME tuples note. + Assert that the new size is smaller than the old size. + (remove_useless_stmts_warn_notreached): Remove #if 0 code. + (remove_useless_stmts_cond): Remove stale FIXME tuples note. + (remove_useless_stmts_1): Likewise. + (verify_types_in_gimple_assign): Likewise. + * passes.c (init_optimization_passes): Re-enable + pass_ipa_increase_alignment. + * tree-ssa-threadedge.c + (record_temporary_equivalences_from_stmts_at_dest): + Change SIMPLIFY to accept two arguments of type gimple. + Update all users. + (simplify_control_stmt_condition): Likewise. + (thread_accross_edge): Likewise. + * tree-ssa-operands.c (add_call_clobber_ops): Re-enable + calls to ipa_reference_get_not_read_globals and + ipa_reference_get_not_written_global. + +2008-07-07 Aldy Hernandez + + * tree-ssa-dom.c: Remove FIXME tuples. + +2008-07-07 Aldy Hernandez + + * tree-cfg.c (verify_types_in_gimple_assign): Remove + FIXME tuples. + +2008-07-04 Jakub Jelinek + + * cfgexpand.c (gimple_to_tree) : Copy + CALL_EXPR_VA_ARG_PACK. + + * gimple.c (gimple_build_bind): Set gimple_bind_block rather + than gimple_block. + (gimple_copy) : Don't unshare gimple_bind_block. + + * gimple.h (GF_ASM_INPUT, GF_ASM_VOLATILE, GF_CALL_CANNOT_INLINE, + GF_CALL_FROM_TRUNK, GF_CALL_RETURN_SLOT_OPT, GF_CALL_TAILCALL, + GF_CALL_VA_ARG_PACK, GF_OMP_PARALLEL_COMBINED, GF_OMP_RETURN_NOWAIT, + GF_OMP_SECTION_LAST, GF_PREDICT_TAKEN): Change from static const ints + into enum values. + (struct gimple_statement_base): Move subcode after flags to make it + 16-bit aligned. + + * tree-ssa-structalias.c (find_func_aliases): Handle ADDR_EXPR + as GIMPLE_SINGLE_RHS instead of GIMPLE_UNARY_RHS. + + * tree-ssa-operands.c (get_expr_operands): Don't handle + OMP_FOR, OMP_PARALLEL, OMP_TASK, OMP_SECTIONS and PREDICT_EXPR + here. + + * gimple.def (GIMPLE_PREDICT): New. + * gimple.h: Update comment above GF_* flags. + (GF_PREDICT_TAKEN): New. + (gimple_build_predict): New prototype. + (gimple_predict_predictor, gimple_predict_outcome, + gimple_predict_set_predictor, gimple_predict_set_outcome): New + inlines. + * gimple.c (gss_for_code): Handle GIMPLE_PREDICT. + (gimple_size, walk_gimple_op): Likewise. + (gimple_build_predict): New function. + * gimple-pretty-print.c (dump_gimple_stmt): Handle GIMPLE_PREDICT. + * predict.c (tree_bb_level_predictions): Likewise. + * cfgexpand.c (gimple_to_tree): Likewise. + * tree-inline.c (estimate_num_insns): Likewise. + * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. + * gimple-low.c (lower_stmt): Likewise. + * tree-cfg.c (verify_types_in_gimple_seq_2): Likewise. + (verify_types_in_gimple_stmt): Likewise. Don't handle PREDICT_EXPR. + * gimplify.c (gimplify_expr): Gimplify PREDICT_EXPR into + GIMPLE_PREDICT. + * expr.c (expand_expr_real): Don't handle PREDICT_EXPR. + +2008-07-04 Aldy Hernandez + + * tree-ssa-forwprop.c (rhs_to_tree): Remove fixme. + (forward_propagate_into_cond): Add comment. + (forward_propagate_into_gimple_cond): Add comment. + (forward_propagate_addr_expr_1): Enable optimization. + +2008-07-04 David Edelsohn + + Revert: + * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Unshare t. + + * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Unshare reg. + +2008-07-03 David Edelsohn + + * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Unshare t. + +2008-07-03 Doug Kwan + + * gimple-dummy.c (vectorizable_function): New dummy. + (vect_pattern_recog): Remove dummy. + * tree-vectorizer.h (vect_recog_func_ptr): Adjust types for tuples. + * tree-vect-patterns.c (File): Re-enable all code. + (widened_name_p): Tuplify. + (vect_recog_temp_ssa_var): New. + (vect_recog_dot_prod_pattern): Tuplify. + (vect_recog_widen_mult_pattern): Same. + (vect_recog_pow_pattern): Same. + (vect_recog_widen_sum_pattern): Same. + (vect_pattern_recog_1): Tuplify. Factor out code to create SSA + temporaries to vect_recog_temp_ssa_var. Remove code for building + assignment statement. + (vect_pattern_recog): Tuplify. + +2008-07-03 Janis Johnson + David Edelsohn + + * config/rs6000/rs6000.c (rs6000_va_start): Unshare valist. + (rs6000_gimplify_va_arg): Unshare valist, reg, addr, ovf. + +2008-07-03 Jakub Jelinek + + * tree-inline.c (remap_gimple_op_r): Remap TREE_BLOCK of + expressions. + + * tree-switch-conversion.c (gen_inbound_check): Force RHS to be + gimple operand. Use fold_build* instead of build*. + (build_arrays): Likewise. Convert RHS to LHS's type. + + * tree-switch-conversion.c (struct switch_conv_info): Change + arr_ref_first and arr_ref_last to gimple. + (check_range, check_final_bb, gather_default_values, + build_constructors, build_one_array, build_arrays, gen_def_assign, + fix_phi_nodes, gen_inbound_check, process_switch, do_switchconv): + Tuplify. + (create_temp_arrays): Formatting. + + * gimple.h (gimple_try_set_kind): New inline function. + * tree-eh.c (same_handler_p, optimize_double_finally, + refactor_eh_r, refactor_eh): Tuplify. + * passes.c (init_optimization_passes): Reenable pass_refactor_eh. + +2008-07-02 Jakub Jelinek + + * tree-parloops.c (struct reduction_info): Change reduc_stmt, + reduc_phi, keep_res and new_phi field types to gimple. + (struct elv_data): Add info field. + (reduction_phi, loop_parallel_p, take_address_of, + initialize_reductions, eliminate_local_variables_stmt, + eliminate_local_variables, expr_invariant_in_region_p, + separate_decls_in_region_name, separate_decls_in_region_stmt, + create_phi_for_local_result, create_call_for_reduction_1, + create_call_for_reduction, create_loads_for_reductions, + create_final_loads_for_reduction, create_stores_for_reduction, + create_loads_and_stores_for_name, separate_decls_in_region, + canonicalize_loop_ivs, transform_to_exit_first_loop, + create_parallel_loop, gen_parallel_loop, + loop_has_vector_phi_nodes, parallelize_loops): Tuplify. + * tree-cfg.c (gimple_duplicate_sese_tail): Tuplify. + (move_block_to_fn): Don't call gsi_next after calling + remove_phi_node. + +2008-07-02 Aldy Hernandez + Richard Guenther + + * tree-ssa-forwprop.c (can_propagate_from): Exclude loads + from decls explicitly. + (gate_forwprop): Enable. + +2008-07-02 Jakub Jelinek + + * tree-vectorizer.h (vinfo_for_stmt): Use htab_find_slot_with_hash. + (set_vinfo_for_stmt): Likewise. If info is NULL, delete entry from + hash table. + * tree-vectorizer.c (stmt_vec_info_eq, stmt_vec_info_hash): New + functions. + (init_stmt_vec_info_htab): Use them instead of htab_hash_pointer + and htab_eq_pointer. + (free_stmt_vec_info): Free stmt_info only after set_vinfo_for_stmt + call. + + Merge with mainline @137346. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + * builtins.c (gimple_rewrite_call_expr): Fix -Wc++-compat and/or + -Wcast-qual warnings. + * gimple.c (gimple_alloc_stat, gimple_build_omp_for, + gimple_range_check_failed, gimple_copy): Likewise. + * tree-mudflap.c (mx_xfn_xform_decls): Likewise. + * tree-nested.c (convert_nonlocal_reference_stmt, + convert_local_reference_stmt): Likewise. + * gimple-iterator.c (gsi_insert_before_without_update, + gsi_insert_after_without_update): Likewise. + * tree-ssa-loop-im.c (init_lim_data, get_lim_data, + clear_lim_data): Likewise. + * tree-ssa-sccvn.c (vn_nary_op_insert_stmt): Likewise. + * tree-vrp.c (check_all_array_refs): Likewise. + * value-prof.c (histogram_eq): Likewise. + * cgraphbuild.c (record_reference): Don't handle OMP_PARALLEL + and OMP_TASK here. + (build_cgraph_edges): Handle GIMPLE_OMP_{PARALLEL,TASK}. + * cgraph.c (cgraph_add_new_function): Call gimple_register_cfg_hooks + instead of tree_register_cfg_hooks. + * omp-low.c (finalize_task_copyfn): Ensure the new function's + body is a gimple_seq with just GIMPLE_BIND in it. + (scan_omp_1_stmt): Fix -Wc++-compat and/or -Wcast-qual warnings. + * tree-cfg.c (move_stmt_op, have_similar_memory_accesses_1, + ref_base_address_1): Likewise. + (move_stmt_r): Handle gimple_block updating. + * tree-ssa-alias.c (update_alias_info_1): Tuplify. + (update_alias_info): Likewise. + * tree-switch-conversion.c: Stub out temporarily. + +2008-06-30 Aldy Hernandez + + * tree-ssa-forwprop.c: Remove obsolete comment. + (get_prop_source_stmt): Wrap call to gimple_assign_lhs with a + TREE_TYPE. + (forward_propagate_comparison): Use build2 instead of + fold_binary. + +2008-06-27 Diego Novillo + + * cfgexpand.c (gimple_assign_rhs_to_tree): Factor out of ... + (gimple_to_tree): ... here. + Update comments referring to mainline merge. + * tree-ssa-ter.c: Tuplify. + * tree-outof-ssa.c (gimple_assign_rhs_to_tree): Declare. + (replace_use_variable): Call it. + (rewrite_trees): Tuplify. + (remove_ssa_form): Call it. + * gimple.h: Tidy some formatting. + * ipa-struct-reorg.c: Include gimple.h + * Makefile.in (ipa-struct-reorg.o): Add dependency on + GIMPLE_H. + +2008-06-27 Richard Guenther + + * tree-ssa-sccvn.c (vn_get_expr_for): New function. + (vuses_to_vec): Tuplify. + (copy_vuses_from_stmt): Likewise. + (vdefs_to_vec): Likewise. + (copy_vdefs_from_stmt): Likewise. + (shared_vuses_from_stmt): Likewise. + (copy_reference_ops_from_call): New function split out from + copy_reference_ops_from_ref. + (create_reference_ops_from_call): New function. + (shared_reference_ops_from_call): Likewise. + (get_def_ref_stmt_vuses): Tuplify. + (vn_reference_lookup): Likewise. + (vn_nary_op_lookup_stmt): New function. + (vn_nary_op_insert_stmt): Likewise. + (vn_phi_lookup): Tuplify. + (vn_phi_insert): Likewise. + (defs_to_varying): Likewise. + (visit_unary_op): Likewise. + (visit_binary_op): Likewise. + (visit_reference_op_call): New function. + (visit_reference_op_load): Tuplify. + (visit_reference_op_store): Likewise. + (visit_phi): Likewise. + (stmt_has_constants): New function. + (simplify_binary_expression): Tuplify. + (simplify_unary_expression): Likewise. + (try_to_simplify): Likewise. + (visit_use): Likewise. + (compare_ops): Likewise. + (DFS): Likewise. + (run_scc_vn): Likewise. + * tree-ssa-sccvn.h (shared_vuses_from_stmt): Adjust prototype. + (copy_vuses_from_stmt): Likewise. + (vn_get_expr_for): Declare. + (vn_nary_op_lookup_stmt): Likewise. + (vn_nary_op_insert_stmt): Likewise. + * tree-dfa.c (get_single_def_stmt): Tuplify. + (get_single_def_stmt_from_phi): Likewise. + (get_single_def_stmt_with_phi): Likewise. + * tree-ssa-pre.c (do_SCCVN_insertion): Use vn_get_expr_for. + (eliminate): Likewise. + (execute_pre): Enable SCCVN. + (gate_fre): Enable. + * tree-flow.h (get_single_def_stmt): Adjust prototype. + (get_single_def_stmt_from_phi): Likewise. + (get_single_def_stmt_with_phi): Likewise. + (vn_lookup_or_add_with_stmt): Likewise. + (vn_lookup_with_stmt): Likewise. + * gimple.c (gimple_fold): Fix. + * tree-vn.c (vn_add): Disable call to add_to_value. + (vn_add_with_vuses): Likewise. + (vn_lookup_with_stmt): Tuplify. + (vn_lookup_or_add_with_stmt): Likewise. + +2008-06-27 Aldy Hernandez + + * gimple.c (gimple_cond_get_ops_from_tree): Handle TRUTH_NOT_EXPR. + +2008-06-25 Diego Novillo + + * gimple.h (enum gimple_rhs_class): Move from tree-gimple.h + (struct gimple_statement_base): Change CODE field to 8 + bits. + Change SUBCODE field to 16 bits. + (gimple_set_subcode): Move to gimple.c. + (gimple_subcode): Remove. + (gimple_expr_type): Handle GIMPLE_ASSIGN, GIMPLE_CALL and + GIMPLE_COND explicitly. + Move earlier in the file. + (gimple_expr_code): New. + (gimple_omp_subcode): New. + (gimple_omp_set_subcode): New. + (gimple_omp_return_nowait_p): Call gimple_omp_subcode. + (gimple_omp_section_last_p): Likewise. + (gimple_omp_parallel_combined_p): Likewise. + (gimple_assign_rhs_code): New. + (gimple_assign_set_rhs_code): New. + (gimple_assign_cast_p): Call gimple_assign_rhs_code. + Handle VIEW_CONVERT_EXPR. + (gimple_call_tail_p): Access subcode field directly. + (gimple_call_cannot_inline_p): Likewise. + (gimple_call_return_slot_opt_p): Likewise. + (gimple_call_from_thunk_p): Likewise. + (gimple_call_va_arg_pack_p): Likewise. + (gimple_call_copy_flags): Likewise. + (gimple_cond_code): Likewise. + (gimple_cond_set_code): Likewise. + (gimple_cond_make_false): Likewise. + (gimple_cond_make_true): Likewise. + (gimple_asm_volatile_p): Likewise. + (gimple_asm_input_p): Likewise. + (gimple_eh_filter_must_not_throw): Likewise. + (gimple_eh_filter_set_must_not_throw): Likewise. + (gimple_try_kind): Likewise. + (gimple_try_catch_is_cleanup): Likewise. + (gimple_wce_cleanup_eh_only): Likewise. + + * tree-vrp.c (simplify_div_or_mod_using_ranges): Call + gimple_assign_set_rhs_code instead of gimple_set_subcode. + (simplify_abs_using_ranges): Likewise. + * tree-complex.c (init_dont_simulate_again): Call + gimple_expr_code instead of gimple_subcode. + (complex_visit_stmt): Likewise. + (expand_complex_move): Call gimple_assign_rhs_code + instead of gimple_subcode. + (expand_complex_operations_1): Likewise. + * value-prof.c (gimple_divmod_fixed_value): Likewise. + (gimple_mod_pow2): Likewise. + (gimple_mod_subtract): Likewise. + (gimple_divmod_values_to_profile): Likewise. + * tree-ssa-alias-warnings.c (find_alias_site_helper): + Call gimple_assign_cast_p. + (already_warned_in_frontend_p): Likewise. + * gimple.def: Add comments warning about code orderings. + * omp-low.c (expand_omp_taskreg): Call gimple_omp_set_subcode. + (expand_omp_atomic_fetch_op): Call gimple_assign_rhs_code. + * tree-gimple.c (get_gimple_rhs_class): Move to gimple.c + (get_gimple_rhs_num_ops): Likewise. + (gimple_assign_rhs_code): Move to gimple.h. + * tree-gimple.h (enum gimple_rhs_class): Move to gimple.h. + * tree-ssa-ccp.c (fold_gimple_assign): Call + gimple_assign_rhs_code instead of gimple_subcode. + * tree-stdarg.c (va_list_counter_bump): Likewise. + (check_all_va_list_escapes): Likewise. + (execute_optimize_stdarg): Likewise. + * tree-ssa-math-opts.c (is_division_by): Likewise. + (replace_reciprocal): Likewise. + (execute_cse_reciprocals): Likewise. + (execute_convert_to_rsqrt): Likewise. + * tree-ssa-dom.c (initialize_hash_element): Likewise. + (simple_iv_increment_p): Likewise. + (gimple_assign_unary_useless_conversion_p): Likewise. + * tree-ssa-alias.c (is_escape_site): Call gimple_assign_cast_p. + * predict.c (expr_expected_value_1): Call gimple_assign_rhs_code + instead of gimple_subcode. + * tree-eh.c (tree_could_trap_p): Call gimple_expr_code + instead of gimple_subcode. + * ipa-type-escape.c (is_array_access_through_pointer_and_index): + Call gimple_assign_rhs_code instead of gimple_subcode. + (check_assign): Likewise. + * gimplify.c (gimplify_omp_parallel): Call gimple_omp_set_subcode + instead of gimple_set_subcode. + * tree-mudflap.c (mf_xform_derefs): Call gimple_assign_rhs_code + instead of gimple_subcode. + * tree-ssa-forwprop.c (get_prop_source_stmt): Likewise. + (can_propagate_from): Likewise. + (remove_prop_source_from_use): Likewise. + (forward_propagate_addr_into_variable_array): Likewise. + * tree-object-size.c (plus_stmt_object_size): Likewise. + (collect_object_sizes_for): Likewise. + (check_for_plus_in_loops_1): Likewise. + (check_for_plus_in_loops): Likewise. + * gimple.c (gimple_set_subcode): Move from gimple.h + (gimple_check_failed): Access subcode field directly. + (gimple_assign_single_p): Call gimple_assign_rhs_code + instead of gimple_subcode. + (gimple_assign_unary_nop_p): Likewise. + (gimple_get_lhs): Change argument type to const_gimple. + (gimple_could_trap_p): Call gimple_assign_rhs_code + instead of gimple_subcode. + (get_gimple_rhs_class): Move from tree-gimple.c. + (get_gimple_rhs_num_ops): Likewise. + * tree-ssa-structalias.c (update_alias_info): Call + gimple_assign_rhs_code instead of gimple_subcode. + (find_func_aliases): Likewise. + * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis): + Likewise. + +2008-06-25 Doug Kwan + + * gimple-dummy.c: (vect_free_slp_tree) Remove dummy. + (vect_analyze_loop): Same. + (vectorizable_induction): New dummy. + (vectorizable_type_promotion): Same. + (vectorizable_type_demotion): Same. + (vectorizable_conversion): Same. + (vectorizable_operation): Same. + (vectorizable_assignment): Same. + (vectorizable_load): Same. + (vectorizable_call): Same. + (vectorizable_store): Same. + (vectorizable_condition): Same. + (vectorizable_reduction): Same. + (vectorizable_live_operation): Same. + (vect_estimate_min_profitable_iters): Same. + (vect_model_simple_cost): Same. + (vect_model_store_cost): Same. + (vect_model_load_cost): Same. + (vect_pattern_recog): Same. + * tree-vectorizer.h (struct _stmt_vec_info): Change fields FIRST_DR + and NEXT_DR from tree to gimple type. + (vectorizable_load): Change type of parameter STMT to gimple. + (vectorizable_store): Same. + (vectorizable_operation): Same. + (vectorizable_type_promotion): Same. + (vectorizable_type_demotion): Same. + (vectorizable_conversion): Same. + (vectorizable_assignment): Same. + (vectorizable_function): Same. + (vectorizable_call): Same. + (vectorizable_condition): Same. + (vectorizable_live_operation): Same. + (vectorizable_reduction): Same. + (vectorizable_induction): Same. + * tree-vect-analyze.c (File): Re-enable all previously disabled code. + (vect_determine_vectorization_factor): Tuplify. + (vect_analyze_operations): Same. + (exist_non_indexing_operands_for_use_p): Same. + (vect_analyze_scalar_cycles_1): Same. + (vect_insert_into_interleaving_chain): Same. + (vect_same_range_drs): Same. + (vect_compute_data_ref_alignment): Same. + (vect_verify_datarefs_alignment): Same. + (vector_alignment_reachable_p): Same. + (vect_enhance_data_refs_alignment): Same. + (vect_analyze_group_access): Same. + (vect_analyze_data_ref_access): Same. + (vect_free_slp_tree): Same. + (vect_get_and_check_slp_defs): Same. + (vect_build_slp_tree): Same. + (vect_print_slp_tree): Same. + (vect_mark_slp_stmts): Same. + (vect_analyze_slp_instance): Same. + (vect_analyze_slp): Same. + (vect_detect_hybrid_slp_stmts): Same. + (vect_analyze_data_refs): Same. + (vect_mark_relevant): Same. + (process_use): Same. + (vect_mark_stmts_to_be_vectorized): Same. + (vect_can_advance_ivs_p): Same. + (vect_get_loop_niters): Same. + (vect_analyze_loop_form): Same. + +2008-06-25 Diego Novillo + + * tree-vectorizer.c (hash_gimple_stmt): Remove. + (eq_gimple_stmt): Remove. + (init_stmt_vec_info_htab): Use htab_hash_pointer and + htab_eq_pointer for STMT_VEC_INFO_HTAB. + +2008-06-24 Doug Kwan + + * gimple-dummy.c (vect_set_verbosity_level): Remove. + (vectorize_loops): Same. + (vect_free_slp_tree): New dummy. + (vect_analyze_loop): Same. + (vect_transform_loop): Same. + * tree-vectorize.c (hashtab.h): New include. + (File): Re-enable all previously commented out code. + (stmt_vec_info_htab): New var. + (rename_variables_in_bb): Tuplify. + (slpeel_update_phis_for_duplicate_loop): Same. + (slpeel_update_phi_nodes_for_guard1): Same. + (slpeel_update_phi_nodes_for_guard2): Same. + (slpeel_make_loop_iterate_ntimes): Same. + (slpeel_tree_duplicate_loop_to_edge_cfg): Same. + (slpeel_add_loop_guard): Same. + (slpeel_can_duplicate_loop_p): Same. + (set_prologue_iterations): Same. + (find_loop_location): Same. + (new_stmt_vec_info): Same. + (hash_gimple_stmt): New function. + (init_stmt_vec_info_htab): New function. + (free_stmt_vec_info_htab): New function. + (free_stmt_vec_info): Replace statement info with hash table entry. + (new_loop_vec_info): Tuplify. + (destroy_loop_vec_info): Same. + (vect_supportable_dr_alignment): Same + (vect_is_simple_use): Same. + (supportable_widening_operation): Same. + (supportable_narrowing_operation): Same. + (report_vec_op): New function. Code factored out from ... + (vect_is_simple_reduction): Call it. Tuplify. + (vectorize_loops): Set up and tear down stmt_vec_info hash table. + * tree-vectorizer.h (struct _slp_tree): Change statement fields + (struct _loop_vec_info): Same. + (struct _stmt_vec_info): + (nested_in_vect_loop): Re-enable. + (init_stmt_vec_info_htab): New prototype. + (free_stmt_vec_info_htab): New prototype. + (vinfo_for_stmt): Use hash table instead of statement info. + (set_stmt_info): Remove. + (set_vinfo_for_stmt): New inline. + (is_pattern_stmt_p): Tuplify. + (vect_is_simple_use): Tuplify prototype. + (vect_is_simple_reduction): Same. + (supportable_widening_operation): Same. + (supportable_narrowing_operation): Same. + (new_stmt_vec_info): Same. + (free_stmt_vec_info): Same. + Makefile.in (tree-vectorize.o): Add HASTAB_H dependency. + +2008-06-22 Andrew Pinski + + * gimple-pretty-print.c (dump_binary_rhs): Print out MIN_EXPR and + MAX_EXPR specially. + +2008-06-20 Doug Kwan + + * tree-loop-linear.c (File): Re-enable all previously disabled code. + (gather_interchange_stats): Tuplify. + (linear_transform_loops): Likewise. + * gimple-dummy.c (get_type): Remove unused dummy. + (ipa_add_method): Same. + (ipa_callsite_callee): Same. + (ipa_callsite_compute_count): Same. + (ipa_callsite_compute_param): Same. + (ipa_callsite_param): Same. + (ipa_callsite_param_count): Same. + (ipa_callsite_param_count_set): Same. + (ipa_edges_create): Same. + (ipa_edges_free): Same. + (ipa_free): Same. + (ipa_jf_get_info_type): Same. + (ipa_method_compute_modify): Same. + (ipa_method_compute_tree_map): Same. + (ipa_method_formal_compute_count): Same. + (ipa_method_formal_count): Same. + (ipa_method_formal_count_set): Same. + (ipa_method_get_tree): Same. + (ipa_method_modify_print): Same. + (ipa_method_tree_print): Same. + (ipa_methodlist_init): Same. + (ipa_methodlist_not_empty): Same. + (ipa_node_create): Same. + (ipa_nodes_create): Same. + (ipa_nodes_free): Same. + (ipa_remove_method): Same. + (vec_set_verbosity_level): Same. + * tree-ssa-loop.c (tree_linear_transform): Re-enable. + +2008-06-19 Jan Hubicka + + * gimple.c (gimple_alloc): Annotate with MEM_STAT_INFO + (gimple_build_with_ops): Likewise. + (gimple_build_assign): Likewise. + (gimple_build_assign_with_ops): Likewise. + * gimple.h (gimple_build_assign, gimple_build_assign_with_ops): + Annotate with MEM_STAT_INFO. + +2008-06-17 Jan Hubicka + + * config/i386.c (ix86_gimplify_va_arg): Fix sharing issue. + +2008-06-17 Jan Hubicka + + * gimplify.c (gimplify_modify_expr): Unshare only returned value when + want_value is set instead of copying operands all the time. + +2008-06-17 Diego Novillo + + * tree-ssa-loop-niter.c (get_val_for): Fix FIXME note. + +2008-06-17 Steven Bosscher + + * gimple-dummy.c (canonicalize_induction_variables): Remove dummy. + (remove_empty_loops): Likewise. + (tree_unroll_loops_completely): Likewise. + * tree-ssa-ivcanon.c (tree_num_loop_insns): Replace bsi with gsi. + (create_canonical_iv): Convert to tuples. + (try_unroll_loop_completely): Likewise. + (empty_loop_p): Likewise. + (remove_empty_loop): Likewise. + * tree-ssa-loop.c (tree_ssa_loop_ivcanon): Re-enable. + (tree_ssa_empty_loop): Likewise. + (tree_complete_unroll): Likewise. + (tree_complete_unroll_inner): Likewise. + +2008-06-16 Doug Kwan + + * tree-ssa-ifcombine.c (File): Re-enable all previously diabled code. + (bb_no_side_effects_p): Tuplify. + (same_phi_args_p): Likewise. + (get_name_for_bit_test): Likewise. + (operand_precision): New. + (integral_operand_p): New. + (recognize_single_bit_test): Tuplify. + (regcognize_bits_test): Tuplify. + (ifcombine_ifandif): Likewise. + (ifcombine_iforif): Likewise. + (tree_ssa_ifcombine): Likewise. + * passes.c: Re-enable pass_tree_ifcombine. + +2008-06-16 Doug Kwan + + * tree-ssa-loop-unswitch.c (File): Re-enable all previously disabled + code. + (tree_may_unswitch_on): Tuplify. + (simplify_using_entry_checks): Likewise. + (tree_unswitch_single_loop): Likewise. + * gimple-dummy.c (tree_ssa_unswitch_loops): Remove dummy. + * tree-ssa-loop.c (gate_tree_ssa_loop_unswitch): Re-enable. + +2008-06-16 Steven Bosscher + + * tree-ssa-reassoc.c: Convrt to tuples. + +2008-06-15 Diego Novillo + + * tree-ssa-live.c (mark_all_vars_used_1): Mark as used + the TREE_BLOCK of any _EXPR node. + +2008-06-13 Doug Kwan + + * tree-mudflap.c (File): Re-enable previously disabled code. + (mf_decl_cache_locals): Tuplify. + (mf_build_check_statement_for): Likewise. + (mf_xform_derefs_1): Re-enable. + (mf_xform_derefs): Tuplify. + (execute_mudflap_function_decls): Likewise. + (mx_register_decls): Tuplify. Add a new formal parameter for + the location of newly generated statements. Change function to + return modified gimple sequence instead of of modifying in-place. + (mx_xfn_xform_decls): Tuplify. + (mf_xform_decls): Tuplify. + * passes.c (init_optimization_passes): Re-enable mudflap passes. + +2008-06-13 Jakub Jelinek + + Merge with mainline @136757. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-06-13 Doug Kwan + + * ipa-reference.c (scan_stmt_for_static_refs): Rename walk_subtrees + parameter to handled_ops_p and correct bug of using walk_tree callback + semantics. + * ipa-pure-const.c (scan_function_stmt): Likewise. + * tree-inline.c (mark_local_labes_stmt): Rename walk_subtrees + parameter to handle_ops_p. + (replace_locals_stmt): Likewise. + +2008-06-10 Steven Bosscher + + * passes.c (init_optimization_passes): Re-enable pass_uncprop. + * tree-ssa-uncprop (associate_equivalences_with_edges): Convert + to tuples. + (uncprop_into_successor_phis): Likewise. + +2008-06-09 Diego Novillo + + * ipa-cp.c (cgraph_gate_cp): Fix 'FIXME tuples' note. + * cfg.c (compact_blocks): Likewise. + * dominance.c (free_dominance_info): Likewise. + * gimple-low.c (gimple_stmt_may_fallthru): Likewise + * c-gimplify.c (add_block_to_enclosing): Likewise. + * lambda-mat.c: Include tree-flow.h. + * lambda-trans.c: Likewise. + * Makefile.in (lambda-mat.o, lambda-trans.o): Add dependency + on $(TREE_FLOW_H). + * builtins.c (expand_builtin_setjmp_receiver): Remove #if 0 markers. + (fold_call_stmt): Call gimple_call_va_arg_pack_p. + * tree-gimple.h (gimple_bind_expr_stack): Declare. + * cgraphunit.c (update_call_expr): Do not try to access operand 0 + of a FUNCTION_DECL. + * tree-ssa-loop-ivopts.c (stmt_invariant_in_loop_p): New. + * tree-flow.h (stmt_invariant_in_loop_p): Declare. + * gimple-dummy.c (remove_iv): Remove. + (gimple_stmt_may_fallthru): + * ipa-type-escape.c (check_tree): Call DECL_P before testing + DECL_INITIAL. + (check_assign): Do not access TREE_OPERAND 0 on the RHS + operand. + * gimplify.c (gimple_bind_expr_stack): New. + * gimple.h (struct gimple_statement_bind): Add more comments + for field BLOCK. + (gimple_cond_set_condition): New. + * gimple.c (gimple_cond_set_condition_from_tree): Call it. + (gimple_copy_no_def_use): Remove. Update all users. + (gimple_has_side_effects): + (gimple_rhs_has_side_effects): + * passes.c (init_optimization_passes): Enable + pass_release_ssa_names, pass_ipa_type_escape, pass_ipa_pta, + pass_ipa_struct_reorg, pass_record_bounds, + pass_late_warn_uninitialized and pass_rename_ssa_copies. + + * lambda-code.c: Tuplify. + * ipa-struct-reorg.c: Tuplify. + * ipa-struct-reorg.h: Tuplify. + +2008-06-09 Jakub Jelinek + + * gimplify.c (gimplify_omp_for): Call gimple_omp_for_set_incr + with the RHS of the GIMPLE_MODIFY_STMT instead of the + GIMPLE_MODIFY_STMT itself. + * gimple-pretty-print.c (dump_gimple_omp_for): Adjust for it. + * tree-nested.c (walk_gimple_omp_for): Likewise. + * omp-low.c (extract_omp_for_data, lower_omp_for): Likewise. + +2008-06-09 Aldy Hernandez + + * tree-ssa-forwprop.c (forward_propagate_into_cond): First argument is + a GSI. + (forward_propagate_addr_into_variable_array_index): Accept a GSI + instead of a gimple statement. Update accordingly. + (forward_propagate_addr_expr_1): Same. + (forward_propagate_addr_expr): Pass a GSI to + forward_propagate_addr_expr_1. + (simplify_not_neg_expr): Argument is a GSI. + Adjust accordingly. + (tree_ssa_forward_propagate_single_use_va): Pass GSI to + simplify_not_neg_expr and forward_propagate_into_cond. + +2008-06-09 Aldy Hernandez + + * tree.h (IS_CONVERT_EXPR_P): New. + (CONVERT_EXPR_P): Use IS_CONVERT_EXPR_P. + * tree-ssa-forwprop.c (get_prop_dest_stmt): Convert to tuples. + (get_prop_source_stmt): Same. + (can_propagate_from): Same. + (remove_prop_source_from_use): Same. + (combine_cond_expr_cond): Same. + (forward_propagate_into_cond): Same. + (tidy_after_forward_propagate_addr): Same. + (forward_propagate_addr_into_variable_array_index): Same. + (forward_propagate_addr_expr_1): Same. + (forward_propagate_addr_expr): Same. + (forward_propagate_comparison): Same. + (simplify_not_neg_expr): Same. + (tree_ssa_forward_propagate_single_use_vars): Same. + (simplify_gimple_switch): Rename from -simplify_switch_expr. + (rhs_to_tree): New. + (forward_propagate_into_gimple_cond): New. + * Makefile.in (tree-ssa-forwprop.o): Depend on GIMPLE_H. + * passes.c (init_optimization_passes): Enable pass_forwprop. + +2008-06-09 Jakub Jelinek + + * tree.def (OMP_SECTIONS_SWITCH, OMP_ATOMIC_LOAD, OMP_ATOMIC_STORE): + Removed. + * tree-gimple.c (is_gimple_stmt): Don't handle them. + * gimplify.c (gimplify_expr): Likewise. + * tree-pretty-print.c (dump_generic_node): Likewise. + * tree-ssa-operands.c (get_expr_operands): Likewise. + * expr.c (expand_expr_real_1): Likewise. + * omp-low.c (expand_omp_atomic_pipeline): Adjust comment. + +2008-06-09 Jakub Jelinek + + Merge with mainline @136433. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-06-08 Diego Novillo + + Merge with mainline @136432. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-06-08 Diego Novillo + + * tree-call-cdce.c: Tuplify. + +2008-06-06 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00353.html + + * gimple.def: Add a third argument to all GIMPLE codes. + Update all users. + * calls.c (gimple_alloca_call_p): Fix comment. + * system.h (CONST_CAST_GIMPLE): Define. + * gimple.c (gimple_ops_offset_): Declare. Fill in from + third argument in gimple.def. + (gimple_set_stored_syms, gimple_set_loaded_syms): Move + from tree-ssa-operands.c + (gimple_alloc): Add argument NUM_OPS. Update all users. + Compute size by adding enough space for NUM_OPS operands. + (gimple_alloc_ops): Remove. Update all users. + (gimple_assign_set_rhs_from_tree): Change first argument + to gimple_stmt_iterator *. Update all users. + Allocate a new statement, if there are more operands that + can fit in the old one. + (gimple_assign_set_rhs_with_ops): Likewise. + (gimple_copy): Fix clearing of stores/loads sets in the + copied statement. + * gimple.h (struct gimple_statement_base): Remove fields + UNUSED_1, UNUSED_2, UNUSED_3. + Add fields MODIFIED, HAS_VOLATILE_OPS, REFERENCES_MEMORY_P, + UID and NUM_OPS. + Re-organize existing fields to eliminate holes on 64 bit + hosts. + Update all users. + (struct gimple_statement_with_ops_base): Define. + Factor out struct gimple_statement_with_ops. Include fields GSBASE, + ADDRESSES_TAKEN, DEF_OPS and USE_OPS. + (struct gimple_statement_with_ops): Include struct + gimple_statement_with_ops_base. + Remove field NUM_OPS. + (struct gimple_statement_with_memory_ops_base): Define. + Factor out of struct gimple_statement_with_memory_ops. + Include fields OPBASE, VDEF_OPS, VUSE_OPS, STORES and + LOADS. + Remove fields HAS_VOLATILE_OPS and REFERENCES_MEMORY_P. + (struct gimple_statement_with_memory_ops): Include + struct gimple_statement_with_memory_ops_base. + (struct gimple_statement_phi): Change size_t fields to + unsigned. Update all users. + (struct gimple_statement_asm): Include struct + gimple_statement_with_memory_ops_base. + Change fields NI and NO to unsigned char. + Change field NC to short. + Update all users. + Add field OP. + (struct gimple_statement_change_dynamic_type): Remove. + Update all users. + (union gimple_statement_d): Rename field WITH_OPS to GSOPS. + Rename field WITH_MEM_OPS to GSMEM. + Update all users. + (gimple_addresses_taken): New. + (gimple_addresses_taken_ptr): New. + (gimple_set_addresses_taken): New. + (gimple_num_ops): Move earlier. + (gimple_ops): Use gimple_ops_offset_ to compute address + of the operand vector. + (gimple_op): Call gimple_ops. + (gimple_op_ptr): Likewise. + (gimple_set_op): Likewise. + (gimple_switch_num_labels): Call gimple_num_ops. + (gimple_switch_set_num_labels): Call gimple_set_num_ops. + (gimple_switch_set_label): Call gimple_num_ops. + (gimple_return_retval_ptr): Likewise. + (gimple_return_retval): Likewise. + (gimple_set_retval): Likewise. + (gimple_cdt_new_type): Use operand 1. + (gimple_cdt_new_type_ptr): Likewise. + (gimple_cdt_set_new_type): Likewise. + * tree-cfg.c (gimple_block_ends_with_call_p): Use + CONST_CAST_BB. + * tree-ssa-operands.c (gimple_set_stored_syms, + gimple_set_loaded_syms): Declare. + * value-prof.c (gimple_divmod_fixed_value_transform, + gimple_mod_pow2_value_transform, + gimple_mod_subtract_transform): Change argument to + gimple_stmt_iterator *. Update all users. + * tree-ssa-ccp.c (fold_gimple_assign): Change parameter + to gimple_stmt_iterator *. Update all users + +2008-06-05 Jakub Jelinek + + * gimplify.c (gimplify_modify_expr_to_memcpy): Use gimplify_arg + for gimplification of call arguments. + (gimplify_modify_expr_to_memset): Likewise. + +2008-06-02 Jakub Jelinek + + PR tree-optimization/36389 + * gimplify.c (gimplify_cond_expr): If one or both branches are + GOTO_EXPRs jumping to LABEL_DECLs, don't create unnecessary + extra LABEL_DECLs and jumps around. + * tree-cfg.c (remove_useless_stmts_cond): Set may_branch also + for GIMPLE_COND stmts. + * tree-eh.c (replace_goto_queue_cond_clause): Set label to + create_artificial_label () rather than LABEL_EXPR. + +2008-05-30 Diego Novillo + + * calls.c (gimple_alloca_call_p): Fix detection of + alloca() calls. + +2008-05-30 Diego Novillo + + * toplev.c: Include gimple.h. + (dump_memory_report): Call dump_gimple_statistics. + * Makefile.in (toplev.o): Add dependency on GIMPLE_H. + * gimple-low.c (pass_lower_cf): Restore disabled bits. + * tree-dfa.c (pass_referenced_vars): Likewise. + * cfgexpand.c (pass_expand): Likewise. + * tree-outof-ssa.c (pass_del_ssa): Likewise. + * gimple.c (gimple_alloc): Fix non-C99 declaration. + * gimplify.c (gimplify_function_tree): Remove calls to + dump_tree_statistics and dump_gimple_statistics. + +2008-05-30 Jakub Jelinek + + * omp-low.c (diagnose_omp_structured_block_errors): Temporarily + switch cfun to DECL_STRUCT_FUNCTION (fndecl). + + * omp-low.c (scan_sharing_clauses): Call scan_omp on + OMP_CLAUSE_REDUCTION_GIMPLE_{INIT,MERGE} instead of + scan_omp_op on OMP_CLAUSE_REDUCTION_{INIT,MERGE}. + (lower_rec_input_clauses): Clear + OMP_CLAUSE_REDUCTION_GIMPLE_{INIT,MERGE} instead of + OMP_CLAUSE_REDUCTION_{INIT,MERGE}. Call lower_omp + on OMP_CLAUSE_REDUCTION_GIMPLE_MERGE before gimple_seq_add_seq + to replace all occurences of placeholder in the seq. + * gimplify.c (gimplify_scan_omp_clauses): Clear + OMP_CLAUSE_REDUCTION_{INIT,MERGE} after gimplifying it. + + * tree-nested.c (init_tmp_var_with_call, init_tmp_var, save_tmp_var): + Only set location if not gsi_end_p. + (walk_gimple_omp_for): Avoid adding an empty statement to seq. + + * tree-inline.c (remap_gimple_stmt): Remap body of + GIMPLE_OMP_{MASTER,ORDERED,SECTION,SECTIONS,SINGLE}. + +2008-05-28 Andrew Pinski + + * gimple-pretty-print.c (dump_unary_rhs): Handle conversions correctly. + Handle PAREN_EXPR, ABS_EXPR, and NEGATE_EXPR. + +2008-05-29 Jakub Jelinek + + * omp-low.c (lower_omp_1): Handle regimplification of GIMPLE_ASM. + Fix GIMPLE_ASSIGN regimplification. + * gimple-pretty-print.c (dump_gimple_omp_sections, + dump_gimple_omp_block, dump_gimple_omp_critical): New functions. + (dump_gimple_omp_parallel): Formatting. + (dump_gimple_stmt): Handle remaining GIMPLE_OMP_* statements. + +2008-05-29 Aldy Hernandez + + * tree-inline.c (remap_gimple_stmt): Handle GIMPLE_OMP_* cases. + +2008-05-29 Aldy Hernandez + + * gimple-pretty-print.c (dump_gimple_stmt): Add cases for + GIMPLE_OMP_MASTER and GIMPLE_OMP_ORDERED. + +2008-05-29 Aldy Hernandez + + * omp-low.c (expand_omp_parallel): Parse an assignment from an + ADDR_EXPR correctly. + * gimple-pretty-print.c (dump_gimple_omp_parallel): Print braces when + appropriate. + +2008-05-29 Jakub Jelinek + + * omp-low.c (lower_omp_1): Fix regimplification of GIMPLE_COND and + GIMPLE_CALL. + +2008-05-28 Jakub Jelinek + + * gimple.c (gimple_regimplify_operands): Don't call gimple_num_ops + twice. Write regimplified operand to the correct operand slot. + * gimplify.c (rhs_predicate_for): No longer static. + * tree-gimple.h (rhs_predicate_for): New prototype. + * omp-low.c (lower_omp_1): Don't call gimple_regimplify_operands, + instead forcefully gimplify_expr each operand with the right + predicate. + + * gimple.h (gimple_omp_atomic_store_val_ptr, + gimple_omp_atomic_load_lhs_ptr, gimple_omp_atomic_load_rhs_ptr): New + inlines. + * gimple.c (walk_gimple_op): Handle GIMPLE_OMP_ATOMIC_LOAD and + GIMPLE_OMP_ATOMIC_STORE. + * omp-low.c (lower_omp_1): Handle GIMPLE_OMP_ATOMIC_LOAD. + + * gimple-pretty-print.c (dump_gimple_omp_for): Don't indent twice + before gimple_omp_body, don't emit extra newline after it. + (dump_gimple_omp_single): Likewise. + +2008-05-27 Aldy Hernandez + + * tree-nested.c (walk_omp_for): Rename to... + (walk_gimple_omp_for): Enable and convert to tuples. + (convert_nonlocal_reference_stmt): Enable call to walk_gimple_omp_for. + (convert_local_reference_stmt): Same. + * gimple.c (walk_gimple_op): Remove fixme note. + +2008-05-27 Diego Novillo + + * tree-gimple.c (get_gimple_rhs_class): Handle + POLYNOMIAL_CHREC. + * tree-cfg.c (verify_types_in_gimple_assign): Do not + check every operand against the LHS type for tcc_binary + expressions. + +2008-05-26 Diego Novillo + + Merge with mainline @135951. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-05-22 Aldy Hernandez + + * tree-cfg.c (make_edges): Change OMP_SECTION to GIMPLE_OMP_SECTIONS. + Update comments. + (verify_types_in_gimple_stmt): Update comments. + (verify_stmt): Same. + +2008-05-21 Andreas Tobler + + * ../configure: Regenerate with the correct autoconf version: 2.59. + +2008-05-21 Aldy Hernandez + + * omp-low.c (lower_reduction_clauses): Generate OMP_ATOMIC_* directly. + Concatenate atomic code correctly. + +2008-05-20 Aldy Hernandez + + * omp-low.c (WALK_SUBSTMTS): New. + (check_combined_parallel): Walk sub-statements. + (diagnose_sb_1): Same. + (diagnose_sb_2): Same. + Handle switch labels and return statements correctly. + * testsuite/gcc.dg/gomp/block-7.c: Adjust for new error message. + * testsuite/gcc.dg/gomp/block-2.c: Same. + * testsuite/gcc.dg/gomp/block-4.c: Same. + * testsuite/gcc.dg/gomp/block-6.c: Same. + * testsuite/gcc.dg/gomp/block-8.c: Same. + * testsuite/gcc.dg/gomp/block-1.c: Same. + * testsuite/gcc.dg/gomp/block-3.c: Same. + * testsuite/gcc.dg/gomp/block-5.c: Same. + +2008-05-20 Aldy Hernandez + + * omp-low.c (lower_omp_single): Append to bind variables. + (lower_omp_master): Same. + (lower_omp_ordered): Same. + (lower_omp_critical): Same. + * gimplify.c (gimplify_modify_expr_to_memcpy): Make sure we are + fully gimplified. + (gimplify_omp_for): Same. + * gimple.h (gimple_bind_set_vars): New. + +2008-05-16 Andreas Tobler + + * config/alpha/alpha.c (alpha_gimplify_va_arg): Adjust arguments. + * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. + * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. + * config/m32c/m32c-protos.h (m32c_gimplify_va_arg_expr): Likewise. + * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise. + * config/stormy16/stormy16.c (xstormy16_gimplify_va_arg_expr): Likewise. + * config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise. + + * config/sparc/sparc.c (sparc_gimplify_va_arg): Adjust arguments. + +2008-05-16 Diego Novillo + + * tree-into-ssa.c (rewrite_uses_p): Fix return type. + * tree-vectorizer.h (nested_in_vect_loop_p): Add return value. + * tree-ssa-pre.c (execute_pre): Add return value. + +2008-05-15 Aldy Hernandez + + * config/s390/s390.c (s390_gimplify_va_arg): Adjust for tuples. + +2008-05-15 Diego Novillo + + * Makefile.in (STRICT_WARN): Revert to mainline behaviour. + (builtins.o-warn, expr.o-warn, dse.o-warn, + ebitmap.o-warn, lower-subreg.o-warn, tree-chrec.o-warn, + tree-ssa-structalias.o-warn, varasm.o-warn): Remove. + * config/arm/arm.c (arm_return_in_memory): Fix return type. + * config/arm/arm-protos.h (arm_return_in_memory): Likewise. + +2008-05-15 Aldy Hernandez + + * gimplify.c (gimplify_omp_for): Handle a MODIFY_EXPR in + gimple_omp_for_incr. + * cfgexpand.c (gimple_to_tree): Do not die on compile errors. + +2008-05-15 Aldy Hernandez + + * omp-low.c (check_omp_nesting_restrictions): Fetch clauses from for. + (expand_omp_atomic): Parse GIMPLE_OMP_ATOMIC correctly. + (lower_omp_single_simple): Create GIMPLE_COND with both tlabel and + flabel. + (lower_omp_for): Make sure we have a body before look inside. + * gimple-low.c (lower_stmt): Add case for GIMPLE_OMP_SECTIONS_SWITCH. + * gimple-pretty-print.c (dump_gimple_omp_single): New. + (dump_gimple_stmt): Add case for GIMPLE_OMP_SINGLE. + * gimplify.c (gimplify_omp_workshare): Remove fixme. Enable code. + * gimple.c (gss_for_code): Add case for GIMPLE_OMP_{RETURN, + SECTIONS_SWITCH}. + (gimple_regimplify_operands): Do not regimplify GIMPLE_ASM + operands. Do not look inside empty operands. + * gimple.h (is_gimple_omp): Fix typo for GIMPLE_OMP_ATOMIC*. + * tree-cfg.c (make_edges): Rename OMP_SECTION to GIMPLE_OMP_SECTION. + +2008-05-14 Aldy Hernandez + + * omp-low.c (optimize_omp_library_calls): Make sure statement is + a GIMPLE_CALL before we look inside of it. + * tree-cfg.c (move_stmt_op): Exit gracefully. + +2008-05-13 Aldy Hernandez + + * omp-low.c (scan_omp_op): Remove walk_subtrees. Call walk_tree. + (scan_omp_for): Scan OMP body. + (scan_omp_1_stmt): Set handled_ops_p. + (expand_omp_parallel): Parse ADDR_EXPR correctly. + (diagnose_sb_1): Rename walk_subtrees to handled_ops_p and set + appropriately. + (diagnose_sb_2): Same. + * gimple-pretty-print.c (dump_gimple_omp_for): Print braces around + OMP body. + * tree-inline.c (estimate_num_insns): GIMPLE_OMP_CONTINUE does not + have a body. + * tree-cfg.c (move_stmt_op): Parse move_stmt_d out of data correctly. + (move_stmt_r): Rename walk_subtrees to handled_ops_p and set + appropriately. + +2008-05-12 Diego Novillo + + Merge with mainline @135126. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-05-11 Doug Kwan + + * gimplify.c (gimple_pop_condition): Clear + conditional_cleanups field after the associated gimple sequence has + been freed implicitly. + (gimplify_cleanup_point_expr): Clear conditional_cleanups field + of gimplfiy_ctxp after resetting the conditions field. + * gimple.h (gimple_call_return_type): Handle REFERENCE_TYPE like + POINTER_TYPE. + +2008-05-10 Kaz Kojima + + * config/sh/sh.c (sh_gimplify_va_arg_expr): Change pre_p and + post_p types to gimple_seq *. + +2008-05-09 Aldy Hernandez + + * omp-low.c (maybe_catch_exception): Return body when no exceptions. + (gate_lower_omp): Enable pass. + * gimple-low.c (lower_stmt): Add GIMPLE_OMP_ATOMIC_* cases. + +2008-05-08 Aldy Hernandez + + * omp-low.c (extract_omp_for_data): Update comment. + (get_ws_args_for): Same. + (lower_send_shared_vars): Same. + (expand_omp_parallel): Same. + (expand_omp_for_static_nochunk): Same. + (expand_omp_for_static_chunk): Same. + (expand_omp_sections): Same. + (expand_omp_atomic_fetch_op): Same. + (expand_omp_atomic_pipeline): Same. + (build_omp_regions_1): Same. + (lower_omp_for): Same. + (expand_omp_atomic_mutex): Change OMP_ATOMIC_STORE to + GIMPLE_OMP_ATOMIC_STORE. + * gimple-pretty-print.c (dump_gimple_omp_parallel): Print child fn + and data_arg. + * tree-cfg.c (make_edges): Enable commented out code and convert + to tuples. + (replace_by_duplicate_decl): Same. + (replace_ssa_name): Same. + (move_stmt_r): Same. + (move_stmt_op): New. + (mark_virtual_ops_in_bb): Enable and convert to tuples. + (makr_virtual_ops_in_region): Same. + (move_block_to_fn): Convert to tuples. + (find_outermost_region_in_block): Enable and convert to tuples. + (move_sese_region_to_fn): Same. + +2008-05-05 Aldy Hernandez + + * omp-low.c (expand_omp_parallel): Remove fixmes. + (expand_omp_for_static_chunk): Enable and tuplify code. + (expand_omp_sections): Remove fixmes. Tuplify. + (lower_omp_sections): Same. + (diagnose_sb_0): Remove fixme. + * tree-ssa.c (redirect_edge_var_map_dup): Fix typo in comment. + * gimple.c (gimple_size): Add case for GIMPLE_OMP_SECTIONS_SWITCH. + (gimple_build_omp_sections): New. + * gimple.h (gimple_build_omp_sections_switch): New prototype. + +2008-05-03 Aldy Hernandez + + * omp-low.c (diagnose_sb_0): Tuplify and enable. + (diagnose_sb_1): Same. + (diagnose_sb_2): Same. + (diagnose_omp_structured_block_errors): Tuplify. + * gimple-dummy.c (DUMMY_FN): Remove + diagnose_omp_structured_block_errors. + * c-decl.c (c_gimple_diagnostics_recursively): Remove fixme + and enable call to diagnose_omp_structured_block_errors. + * Makefile.in (GTFILES): Add omp-low.c again. + +2008-05-02 Rafael Espindola + + * tree-gimple.c (is_gimple_condexpr): Do not allow + trapping comparisons. + * tree-eh.c (tree_could_trap_p): Fix handling of floating + point comparisons. + +2008-05-02 Doug Kwan + + * value-prof.c (gimple_divmod_fixed_value): Remove formal parameters + OPERATION, OP1 and OP2 and derive their values from parameter STMT + instead. Update prototype and caller. + (gimple_mod_pow2): Remove formal parameters OPERATION, OP1 and OP2 + and derive their values from parameter STMT instead. Update prototype + and caller. + (gimple_mod_pow2_value_transform): Remove temporares OP, OP1 and OP2. + Use a new tempory LHS_TYPE to store assignment LHS type. + (gimple_mode_subtract): Remove formal parameters OPERATION, OP1 and OP2 + and derive their values from parameter STMT instead. Update prototype + and caller. Fix a bug in a call to gimple_build_assign_with_ops. + (gimple_mod_subtract_transform): Remove temporares OP, OP1 and OP2. + Use a new tempory LHS_TYPE to store assignment LHS type. + (gimple_ic, gimple_indirect_call_to_profile): Fix bug in tree-code + tests. + * tree-profile.c (File): Re-enable all previously disabled code. + (tree_gen_edge_profiler): Tuplify. + (prepare_instrumented_value): Ditto. + (tree_gen_interval_profiler): Ditto. + (tree_gen_pow2_profiler): Ditto. + (tree_gen_one_value_profiler): Ditto. + (tree_gen_ic_profiler): Ditto. + (tree_gen_ic_func_profiler): Ditto. + (tree_gen_const_delta_profiler): Re-format formal parameters for + proper alignement. + (tree_gen_average_profiler): Tuplify. + (tree_gen_ior_profiler): Ditto. + (do_tree_profiling): Re-enable previously disabled code. Remove + FIXME. + (tree_profiling): Ditto. + * gimple.c (gimple_set_bb): Remove assertion. + * tree-cfg.c (change_bb_for_stmt): Remove. Redirect callers to + gimple_set_bb. + (gimple_merge_blocks): Call gimple_set_bb instead of + change_bb_for_stmt. + (gimple_split_block): Ditto. + (verify_stmts): Add code to check that label_to_block_map and labels + are consistent. + +2008-04-22 Rafael Espindola + + Merge with mainline @134843. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-05-01 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00053.html + + * tree-vrp.c (vrp_visit_phi_node): Cast variable I to int + for printing. + * cgraph.c (cgraph_release_function_body): Only call + gimple_set_body if NODE->DECL has a struct function. + * tree.c (make_node_stat): Do not call gimple_set_body. + * cp/Make-lang.in (cp/semantics.o): Add dependency on + $(GIMPLE_H). + * cp/semantics.c: Include gimple.h + (expand_or_defer_fn): Assert that FN has a gimple body. + * function.h (struct function): Add field GIMPLE_BODY. + * gimple.c (gimple_bodies_vec): Remove. + (gimple_bodies_map): Remove. + (gimple_set_body): Re-write to use GIMPLE_BODY in FN's + function object. + (gimple_body): Likewise. + +2008-05-01 Oleg Ryjkov + + http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00053.html + + * tree-eh.c (record_in_goto_queue, record_in_goto_queue_label): + New functions. + (maybe_record_in_goto_queue): Refactored and added support for + recording labels embedded in GIMPLE_CONDs. + (lower_catch, lower_cleanup): Fix 3 typos that were introduced + during the conversion to tuples. + (lower_eh_constructs_2): Call maybe_record_in_goto_queue for + GIMPLE_CONDs. + +2008-05-01 Rafael Espindola + + * gimple-pretty-print.c (dump_gimple_try): Print like trunk does. + (dump_gimple_catch): Print like trunk does. + +2008-05-01 Rafael Espindola + + * passes.c (gimple_verify_flow_info): Enable remaining + pass_rename_ssa_copies passes. + +2008-05-01 Rafael Espindola + + * tree-cfg.c (gimple_verify_flow_info): Handle switches with only the + default label. + +2008-04-30 Doug Kwan + + * cfgexpand.c (gimple_to_tree): Change code to annotate EH region + numbers only if numbers are greater than zero. Also propagate EH + region number to CALL_EXPRs nested in assignments. + +2008-04-29 Doug Kwan + + * tree-eh.c (lower_try_finally_dup_block): Call + copy_gimple_seq_and_replace_locals instead of gimple_seq_copy. + (optimize_double_finally): Add a note about replacing unsave_expr_now + with copy_gimple_seq_and_replace_locals. + * tree-inline.c (mark_local_labels_stmt, replace_locals_op, + replace_locals_stmt, copy_gimple_seq_and_replace_locals): New. + * tree-inline.h (copy_gimple_seq_and_replace_locals): New prototype. + +2008-04-29 Rafael Espindola + + * gimple-pretty-print.c (dump_gimple_return): Add missing space. + * tree-ssa-threadedge.c (simplify_control_stmt_condition): Fix type + of variable. + +2008-04-29 Rafael Espindola + + * gimple-pretty-print.c (pp_cfg_jump): add missing ";". + +2008-04-29 Rafael Espindola + + * gimple-pretty-print.c (dump_gimple_assign): print ";" at the end. + (dump_gimple_return):print ";" at the end. + (dump_gimple_call): print ";" at the end. + (dump_gimple_cond): use op_symbol_code instead of tree_code_name. + (pp_cfg_jump): print ";" at the end. + +2008-04-29 Rafael Espindola + + * ipa-cp.c (ipcp_driver): Disable. + * matrix-reorg.c (matrix_reorg): Comment body. + (gate_matrix_reorg): Disable. + * passes.c (init_optimization_passes): Enable first pass_merge_phi, + pass_ipa_cp and pass_ipa_matrix_reorg. + +2008-04-29 Doug Kwan + + * tree-eh.c (lower_catch): Fix bug of accessing sub-statements + using gimple_catch_handler. Fix bug of mixing up GIMPLE_GOTO and + GIMPLE_LABEL in statement building. + (lower_cleanup): Fix bug of mixing up gimple_try_clean and + gimple_try_eval. + (lower_cleanup): Use gimple codes instead of tree codes in switch + statement. + (tree-cfg.c): Add code to generate EH edges of GIMPLE_ASSIGN. + +2008-04-28 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02051.html + + * tree-ssa-phiprop.c (phiprop_insert_phi): Remove + OLD_ARG_CODE. Use TREE_CODE (ARG) instead. + Assert that NEW_VAR is a GIMPLE register. + (propagate_with_phi): Fix test of is_gimple_reg_type for + ARG. + Do not set subcode of USE_STMT to NOP_EXPR. + +2008-04-28 Doug Kwan + + * tree-inline.c (remap_gimple_op_r): Remove code to handle RESX_EXPR + region number remapping. + (remap_gimple_stmt): Add code to handle GIMPLE_RESX region number + remapping. + +2008-04-28 Rafael Espindola + + * cfgexpand.c (gimple_to_tree): Add support for switch stmts without + a default label. + * fold-const.c (tree_call_nonnegative_warnv_p): Remove the code + argument. + (tree_invalid_nonnegative_warnv_p): Update call to + tree_call_nonnegative_warnv_p. + * gimple.h (gimple_location_ptr): New. + * tree-flow.h (simplify_stmt_using_ranges): Change signature. + * tree-ssa-propagate.c (substitute_and_fold): Call + simplify_stmt_using_ranges. + * tree-vrp.c (struct assert_locus_d): Tuplify. + (switch_update): Tuplify. + (stmt_overflow_infinity): New. + (gimple_assign_nonnegative_warnv_p): New. + (gimple_call_nonnegative_warnv_p): New. + (gimple_stmt_nonnegative_warnv_p): New. + (gimple_assign_nonzero_warnv_p): New. + (gimple_stmt_nonzero_warnv_p): New. + (vrp_stmt_computes_nonzero): Tuplify. + (extract_range_basic): Tuplify. + (extract_range_from_expr): Tuplify. Rename to + extract_range_from_assignment. + (adjust_range_with_scev): Tuplify. + (vrp_var_may_overflow): Tuplify. + (build_assert_expr_for): Tuplify. + (fp_predicate): Tuplify. + (infer_value_range): Tuplify. + (dump_asserts_for): Tuplify. + (register_new_assert_for): Tuplify. + (register_edge_assert_for_2): Tuplify. + (register_edge_assert_for_1): Tuplify. + (register_edge_assert_for): Tuplify. + (find_conditional_asserts): Tuplify. + (find_switch_asserts): Tuplify. + (find_assert_locations): Tuplify. + (process_assert_insertions_for): Tuplify. + (process_assert_insertions): Tuplify. + (check_array_ref): Tuplify. + (search_for_addr_array): Tuplify. + (check_array_bounds): Tuplify. + (check_all_array_refs): Tuplify. + (remove_range_assertions): Tuplify. + (stmt_interesting_for_vrp): Tuplify. + (vrp_initialize): Tuplify. + (vrp_visit_assignment): Tuplify. Rename to vrp_visit_assignment_or_call. + (vrp_visit_cond_stmt): Tuplify. + (find_case_label_index): Tuplify. + (find_case_label_range): Tuplify. + (vrp_visit_switch_stmt): Tuplify. + (vrp_visit_stmt): Tuplify. + (vrp_visit_phi_node): Tuplify. + (simplify_div_or_mod_using_ranges): Tuplify. + (simplify_abs_using_ranges): Tuplify. + (simplify_cond_using_ranges): Tuplify. + (simplify_switch_using_ranges): Tuplify. + (simplify_stmt_using_ranges): Tuplify. + (simplify_stmt_for_jump_threading): Tuplify. + (identify_jump_threads): Tuplify. + (execute_vrp): Tuplify. + (gate_vrp): Enable. + * tree.h (tree_call_nonnegative_warnv_p): Remove the code argument. + +2008-04-28 Doug Kwan + + * cp/cp-gimplify.c (finish_bc_block): Tuplify. + (build_bc_goto): Renamed to get_bc_label. Return a label + only. Uupdate callers. + (get_bc_label): New + (gimplify_cp_loop): Tuplify. Also check COND for error_mark_node + before gimplifying it. + (gimplify_for_stmt): Tuplify. + (gimplify_while_stmt): Tuplify. + (gimplify_for_stmt): Tuplify. + (gimplify_do_stmt): Tuplify. + (gimplify_switch_stmt): Tuplify. + (cp_gimplify_omp_switch_stmt): Add temporary code to pop block + label stack. + (cp_gimplify_expr): Pass pre_p to gimplify_while_stmt, + gimplify_do_stmt and gimplify_switch_stmt. Tuplify + gimplification of CONTINUE_STMT and BREAK_STMT. + +2008-04-26 Rafael Espindola + + * gimple.c (gimple_build_assign_with_ops): Don't set SSA_NAME_DEF_STMT. + * gimple.h (gimple_assign_set_lhs): Set SSA_NAME_DEF_STMT. + (gimple_call_set_lhs): Set SSA_NAME_DEF_STMT. + * omp-low.c (expand_parallel_call): Don't set SSA_NAME_DEF_STMT if not + needed. + (expand_omp_for_generic): Same. + (expand_omp_for_static_nochunk): Same. + (expand_omp_for_static_chunk): Same. + (expand_omp_sections): Same. + (expand_omp_atomic_mutex): Same. + * predict.c (strip_builtin_expect): Same. + * tree-cfg.c (gimple_merge_blocks): Same. + * tree-inline.c (remap_ssa_name): Same. + (setup_one_parameter): Same. + * tree-predcom.c (replace_ref_with): Same. + (replace_ref_with): Same. + (initialize_root_vars_lm): Same. + (reassociate_to_the_same_stmt): Same. + * tree-scalar-evolution.c (scev_const_prop): Same. + * tree-ssa-loop-im.c (rewrite_reciprocal): Same. + * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Same. + * tree-ssa-loop-manip.c (create_iv): Same. + * tree-ssa-math-opts.c (execute_cse_sincos_1): Same. + * tree-ssa-phiopt.c (minmax_replacement): Same. + (abs_replacement): Same. + +2008-04-25 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01965.html + + * gimplify.c (annotate_all_with_location_after): New. + (gimplify_expr): Call it. + +2008-04-25 Diego Novillo + + Merge with mainline @134692. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-25 Doug Kwan + + * tree-inline.c (expand_call_inline): Save old call statement + and use it to look up correct EH region. + +2008-04-24 Doug Kwan + + * Makefile.in (STRICT_WARN): Remove -Wno-format and + -Wno-missing-format-attribute. + * gimplify.c (gimple_pop_condition): Remove redundant and incorrect + gimple_seq_free. + (gimplify_init_ctor_eval_range): Add a fall-through label for + GIMPLE_COND statement. + +2008-04-25 Rafael Espindola + + * tree-ssa-dom.c (avail_expr_eq): Return false if the hashes don't + match. + +2008-04-24 Oleg Ryjkov + + * gimplify.c (gimplify_expr): Fix the assertion that verifies validity + of parameters. + * tree-inline.c (estimate_num_insns): Handle + GIMPLE_CHANGE_DYNAMIC_TYPE. + * tree-cfg.c (verify_types_in_gimple_stmt): Likewise. + +2008-04-24 Rafael Espindola + + * tree-ssa-dom.c (initialize_hash_element): Fix the type of the code + variable. + +2008-04-23 Rafael Espindola + + * omp-low.c (gate_lower_omp): Return 0. + * passes.c (init_optimization_passes): Enable all passes whose + corresponding dump options are used in the testsuite. + * tree-loop-distribution.c (tree_loop_distribution): Comment body. + (gate_tree_loop_distribution): Return 0. + * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): + Comment body. + (gate_forwprop): Return 0. + * tree-ssa-loop.c (gate_tree_ssa_loop_unswitch): Return 0. + (gate_tree_vectorize): Return 0. + (gate_tree_ssa_loop_ivcanon): Return 0. + (tree_ssa_empty_loop): Return 0. + (gate_tree_complete_unroll): Return 0. + * tree-ssa-pre.c (gate_fre): Return 0. + * tree-ssa-reassoc.c (execute_reassoc): Comment body. + (gate_tree_ssa_reassoc): Return 0. + * tree-stdarg.c (gate_optimize_stdarg): Return 0. + (execute_optimize_stdarg): Comment body. + * tree-vrp.c (execute_vrp): Comment body. + (gate_vrp): Return 0. + +2008-04-22 Aldy Hernandez + + * omp-low.c (lower_omp_parallel): Add new argument to + gimple_omp_parallel_set_combined_p. + (lower_omp_1): Remove debugging code. + * gimple.h (gimple_omp_parallel_combined_p): Add new argument. + +2008-04-22 Rafael Espindola + + Merge with mainline @134552. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-21 Doug Kwan + + * tree-ssa-phiopt.c (FILE): Uncomment all previously disabled code. + (tree_ssa_phiopt): Remove FIXME and re-enable code. + (tree_ssa_cs_elim): Remove FIXME and re-enable code. + (tree_ssa_phiopt_worker): Tuplify. + (replace_phi_edge_with_variable): Tuplify. + (conditional_replacement): Tuplify and simplify optimization logic. + Construct a boolean tree and let fold and force_gimple_operand_gsi + do optimization and code genaration. + (value_replacement): Tuplify. + (minmax_replacement): Tuplify. + (abs_replacement): Tuplify. + (nt_init_block): Tuplify. + (cond_store_replacement): Tuplify. + * gimple.h (gimple_seq_singleton_p): Fix empty sequence bug. + * passes.c (init_optimization_passes): Re-enable pass_cselim + and pass_phiopt. + +2008-04-21 Diego Novillo + + * tree.c (make_node_stat): Clear gimple_body() for newly + created FUNCTION_DECLs. + * tree-gimple.c (rhs_predicate_for): Move to gimplify.c. + * tree-gimple.h (rhs_predicate_for): Remove declaration. + * gimple-pretty-print.c (dump_gimple_assign): Add support + for showing volatile operands. + (dump_gimple_call): Likewise. + Add support for showing __builtin_va_arg_pack, static + chains, return slot optimized and tail calls. + (dump_gimple_phi): Remove code to print memory symbols. + * gimplify.c (is_gimple_formal_tmp_or_call_rhs): New. + (is_gimple_mem_or_call_rhs): New. + (rhs_predicate_for): Call them. + (internal_get_tmp_var): Use is_gimple_formal_tmp_or_call_rhs as + the gimplification predicate. + Use the last statement in *PRE_P to get the temporary to + be updated when in SSA form. + (gimplify_bind_expr): Clear out *EXPR_P before returning. + (gimplify_call_expr): Do not build a GIMPLE_CALL if + WANT_VALUE is true. + Call gimple_build_call_from_tree if WANT_VALUE is false. + Remove local variable ARGS. + (gimplify_modify_expr): If after gimplification *FROM_P + is a CALL_EXPR, create a GIMPLE_CALL instead of a + GIMPLE_ASSIGN. + Document why the gimplification of the RHS should accept + CALL_EXPRs. + (gimplify_expr): Document where the generated statement + is stored. + Accept is_gimple_formal_tmp_or_call_rhs and + is_gimple_mem_or_call_rhs as gimplification predicates. + When gimplifying statements, clear out *EXPR_P before + returning. + When generating an rvalue, call is_gimple_formal_tmp_or_call_rhs + to test *EXPR_P. + * tree-dfa.c (mark_symbols_for_renaming): Remove + ATTRIBUTE_UNUSED. + * tree-flow.h (stmt_references_memory_p): Remove. + * gimple.c (gimple_build_call_from_tree): New. + * gimple.h (struct gimple_statement_with_memory_ops): Add + bitfield references_memory_p. + (gimple_build_call_from_tree): Declare. + (gimple_references_memory_p): Rename from + stmt_references_memory_p. Move here. Update all users. + (gimple_set_references_memory): New. + (gimple_assign_set_rhs1): When the assignment has more + than one operand on the RHS, assert that the operands are + gimple values. + (gimple_assign_set_rhs2): Assert that the operand is a + gimple value. + (gimple_call_set_return_slot_opt): Fix mask clearing. + (gimple_call_set_from_thunk): Likewise. + (gimple_call_set_va_arg_pack): Likewise. + * tree-cfg.c (dump_function_to_file): Do not indent when + doing a GIMPLE dump. + * tree-ssa-operands.c (add_virtual_operand): Call + gimple_set_references_memory. + (get_addr_dereference_operands): Likewise. + (get_tmr_operands): Likewise. + (maybe_add_call_clobbered_vops): Likewise. + (get_asm_expr_operands): Likewise. + (parse_ssa_operands): Likewise. + (build_ssa_operands): Likewise. + (stmt_references_memory_p): Remove. + +2008-04-21 Rafael Espindola + + Cherry pick http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01213.html + + * params.def (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE): Set default + to zero, thus disable creation of SFTs. + * gcc.dg/tree-ssa/salias-1.c: Remove. + * gcc.dg/tree-ssa/pr26421.c: Adjust pattern. + * gcc.dg/tree-ssa/alias-15.c: Likewise. + * gcc.dg/tree-ssa/ssa-lim-3.c: Run at -O2. + +2008-04-20 Zdenek Dvorak + + * passes.c (init_optimization_passes): Enable pass_dce_loop. + +2008-04-20 Zdenek Dvorak + + * tree-data-ref.c (split_constant_offset_1): Use POINTER_PLUS_EXPR + for pointer addition. + (split_constant_offset): Set VAR to EXP before conversions are + stripped, when no offset is removed. Handle chrec_dont_know. + * tree-predcom.c: Tuplified. + * passes.c (init_optimization_passes): Enable pass_predcom. + +2008-04-18 Aldy Hernandez + + * omp-low.c (lower_rec_input_clauses): Remove fixme and + ATTRIBUTE_UNUSED. + (lower_lastprivate_clauses): Same. + (lower_reduction_clauses): Same. + (lower_copyprivate_clauses): Same. + (lower_send_clauses): Same. + (lower_send_shared_vars): Same. + (maybe_catch_exception): Convert to tuples. + (lower_omp_sections): Same. + (lower_omp_single_simple): Same. + (lower_omp_single_copy): Same. + (lower_omp_single): Same. + (lower_omp_master): Same. + (lower_omp_ordered): Same. + (lower_omp_critical): Same. + (lower_omp_for_lastprivate): Same. + (lower_omp_for): Same. + (check_combined_parallel): Same. + (lower_omp_parallel): Same. + (lower_omp_1): Same. + (execute_lower_omp): Enable. + * gimple-dummy.c: Remove dummy functions for lower_omp_*. + * gimple-low.c (lower_omp_directive): Convert to tuples. + (lower_stmt): Remove fixme. + * gimple.h (gimple_seq_alloc_with_stmt): New. + (gimple_omp_section_set_last): New. + (gimple_omp_parallel_set_combined_p): New. + (gimple_bind_add_stmt): New. + (gimple_bind_add_seq): New. + * tree-cfg.c (verify_node_sharing): Fix typo in comment. + +2008-04-17 Oleg Ryjkov + + * Reverting forwprop patch. + + 2008-04-16 Oleg Ryjkov + + * tree-ssa-forwprop.c (get_prop_dest_stmtm get_prop_source_stmt, + can_propagate_from, remove_prop_source_from_use, + tidy_after_forward_propagate_addr, + forward_propagate_addr_into_variable_array_index, + forward_propagate_addr_expr_1, forward_propagate_addr_expr, + forward_propagate_comparison, simplify_not_neg_expr, + simplify_switch_expr, + tree_ssa_forward_propagate_single_use_variables): Tuplified. + (forward_propagate_into_cond): Tuplified and moved some functionality + into forward_propagate_into_cond_gimple. + (rhs_to_tree, forward_propagate_into_cond_gimple): New functions. + * passes.c (init_optimization_passes): Enabled pass_forwprop. + * tree-cfg.c (find_taken_edge_cond_expr): Fixed comment. + +2008-04-16 Oleg Ryjkov + + * tree-ssa-forwprop.c (get_prop_dest_stmtm get_prop_source_stmt, + can_propagate_from, remove_prop_source_from_use, + tidy_after_forward_propagate_addr, + forward_propagate_addr_into_variable_array_index, + forward_propagate_addr_expr_1, forward_propagate_addr_expr, + forward_propagate_comparison, simplify_not_neg_expr, + simplify_switch_expr, + tree_ssa_forward_propagate_single_use_variables): Tuplified. + (forward_propagate_into_cond): Tuplified and moved some functionality + into forward_propagate_into_cond_gimple. + (rhs_to_tree, forward_propagate_into_cond_gimple): New functions. + * passes.c (init_optimization_passes): Enabled pass_forwprop. + * tree-cfg.c (find_taken_edge_cond_expr): Fixed comment. + +2008-04-16 Doug Kwan + + * Makefile.in (STRICT_WARN): Disable -Wmissing-format-attribute + and -Wformat temporarily for bootstrapping. + * lambda-code.c (invariant_in_loop_and_outer_loops): Comment out + to avoid defined-and-not-used warning. + * tree-cfg.c (gather_blocks_in_sese_region): Comment out to avoid + defined-and-not-used warning. + +2008-04-16 Doug Kwan + + * Makefile.in (GTFILES): Add back ipa-reference.h and ipa-reference.c. + * gimple-dummy.c (memory_identifier_string): Remove. + * ipa-cp.c (constant_val_insert): Tuplify. + * ipa-prop.c (File): Uncomment all previously disabled code. + (ipa_method_modify_stmt): Tuplify. + (ipa_method_compute_modify): Tuplify. + (ipa_callsite_tree): Renamed to ipa_callsite_stmt. Update callers. + (ipa_callsite_stmt): New. + (ipa_callsite_compute_count): Tuplify. + (ipa_callsite_compute_param): Tuplify. + * ipa-reference.c (File): Uncomment all previously disabled code. + (get_asm_stmt_operands): Tuplify. + (check_call): Tuplify. Also add code to handle assignment of + returned value. + (scan_for_static_refs): Remove. Tuplify body and split into two + new functions scan_stmt_for_static_refs and scan_op_for_static_refs. + Update callers. + (scan_stmt_for_static_refs): New. Split from scan_for_static_refs. + (scan_op_for_static_refs): New. Split from scan_for_static_refs. + (analyze_variable): Update walk_tree call. + (analyze_function): Tuplify. + * passes.c (init_optimization_passes): Re-enable pass_ipa_reference. + * tree-flow.h (struct function_ann_d): Uncomment field + ipa_reference_vars_info. + +2008-04-15 Doug Kwan + + * tree-eh.c (operation_could_trap_p): Fix filtering logic. + +2008-04-15 Bill Maddox + + * tree-ssa-dom.c: (degenerate_phi_result, remove_stmt_or_phi, + get_rhs_or_phi_arg, get_lhs_or_phi_result, propagate_rhs_into_lhs, + eliminate_const_or_copy, eliminate_degenerate_phis_1, + eliminate_degenerate_phis): Convert to tuples. + * passes.c (init_optimization_passes): Enable pass_phi_only_cprop. + +2008-04-15 Oleg Ryjkov + + * tree-ssa-dom.c (record_const_or_copy): Moving a variable declaration to + the top of a block. + +2008-04-15 Doug Kwan + + * tree-ssa-sink.c (File): Uncomment all previously disabled code. + (find_bb_for_arg): Tuplify. + (all_immediate_uses_sample_place): Tuplify. + (nearest_common_dominator_of_uses): Tuplify. + (statement_sink_location): Tuplify. Remove parameter tobb and update + caller. + (sink_code_in_bb): Tuplify. + * passes.c (init_optimization_passes): Re-enable pass_sink_code. + +2008-04-14 Bill Maddox + + * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edge, + create_edge_and_update_destination_phis, redirection_block_p): + Convert to tuples. + * tree.c (iterative_hash_exprs_commutative): New function. + * tree.h (iterative_hash_exprs_commutative): Declare. + * tree-ssa_dom.c (enum expr_kind, struct hashable_expr, + struct cond_equivalence): New types. + (struct edge_info): Use struct cond_equivalence. + (avail_exprs_stack): Stack of expr_hash_elt*, not expressions. + (stmts_to_rescan): Use type gimple for statements. + (struct expr_hash_elt): Represent statement RHS with hashable_expr, + not a tree. Add unique stamp to each entry for efficient and reliable + element removal. + (struct eq_expr_value): Delete unused type. + (initialize_hash_element): Convert to tuples. Now applies + only to statements. + (initialize_expr_from_cond, initialize_hash_element_from_expr): + New functions. Replace former functionality of initialize_hash_element + for conditions presented as trees. + (hashable_expr_equal_p, iterative_hash_hashable_expr): New functions. + (print_expr_hash_elt): New function. + (free_expr_hash_elt): New function. + (tree_ssa_dominator_optimize): Convert to tuples + (canonicalize_comparison): Convert to tuples. + (remove_local_expressions_from_table): Use new avail_exprs_stack + representation. Add optional extra diagnostic details. + (simplify_stmt_for_jump_threading, dom_thread_across_edge, + dom_opt_finalize_block): Convert to tuples. + (record_cond, build_and_record_new_cond): Convert to tuples. + Use new hashable_expr type. Extra diagnostic details. + (record_const_or_copy_1): Extra diagnostic details. + (record_const_or_copy): Add assertion. + (simple_iv_increment_p, cprop_into_successor_phis, record_edge_info): + Convert to tuples. + (eliminate_redundant_computations): Convert to tuples. + Additional diagnostic details. + (gimple_assign_unary_useless_conversion_p): New function. + (record_equivalences_from_statement): Convert to tuples. + Additional diagnostic details. + (cprop_operand, cprop_into_stmt): Convert to tuples. + (optimize_stmt): Convert to tuples. + (lookup_avail_expr): Use hashable_expr. Additional diagnostic details. + (avail_expr_hash, avail_expr_eq): Use hashable_expr. + * tree-ssa-copy.c (may_propagate_copy_into_stmt, + propagate_tree_value_into_stmt): New functions. + * tree-flow.h: (may_propagate_copy_into_stmt, + propagate_tree_value_into_stmt): Declare. + (thread_across_edge): Change declaration of callback to accept a + gimple statement. + * gimple.c (gimple_call_flags): Declare argument as a constant. + (gimple_has_side_effects): Declare argument as a constant. + Examine function arguments for side-effects. + (gimple_rhs_has_side_effects): New function. + * gimple.h (gimple_call_flags): Declare argument as a constant. + (gimple_has_side_effects): Declare argument as a constant. + (gimple_rhs_has_side_effects): Declare new function. + (is_gimple_assign): New inline function. + (gimple_switch_index_ptr): New function. + * passes.c (init_optimization_passes): Enable pass_dominator. + * tree-ssa_threadedge.c (potentially_threadable_block, + lhs_of_dominating_assert, record_temporary_equivalences_from_phis): + Convert to tuples. + (fold_assignment_stmt): New function. + (record_temporary_equivalences_from_stmts_at_dest, + simplify_control_stmt_condition, thread_across_edge): Convert to tuples. + +2008-04-14 Doug Kwan + + * c-typeck.c (convert_for_assignment): Call c_common_unsigned_type + +2008-04-14 Doug Kwan + + * gimple-iterator.c (gsi_move_to_bb_end): Use gsi_last_bb + instead of calling both gsi_last and bb_seq. + * passes.c (init_optimization_passes): Re-eanble second tail-recursion + pass. + +2008-04-14 Doug Kwan + + * tree-nrv.c (dest_safe_for_nrv_p): Uncomment. + (execute_return_slot_opt): Tuplify. + * passes.c (init_optimization_passes): Re-enable pass_return_slot. + +2008-04-14 Aldy Hernandez + + * tree-cfg.c (gimple_can_merge_blocks_p): Fix typo. + * omp-low.c (maybe_lookup_ctx): Uncomment and set ATTRIBUTE_UNUSED. + (lower_lastprivate_clauses): Same. + (lower_reduction_clauses): Same. + (lower_send_clauses): Same. + (expand_omp_for_generic): Uncomment and convert for tuples. + (expand_omp_for): Remove fixme. + (expand_omp_sections): Same. + (lower_omp_parallel): Partially convert for tuples. + (lower_omp_regimplify_p): Rename from lower_omp_2. + (lower_omp_1): Convert for tuples. + (lower_omp): Same. + (gimple-dummy.c): Add lower_omp_parallel, lower_omp_for, + lower_omp_sections, lower_omp_single, lower_omp_master, + lower_omp_ordered, lower_omp_critical. + +2008-04-13 Diego Novillo + + * tree-cfg.c (need_fake_edge_p): Initialize CALL_FLAGS. + +2008-04-12 Rafael Espindola + + Merge with mainline @134237. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-13 Rafael Espindola + + * config/extensions.m4: Add. Was missing from previous merge. + +2008-04-12 Rafael Espindola + + Merge with mainline @133860. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-11 Oleg Ryjkov + + * tree-sra.c (scalarize_use): Moving a variable declaration to + the top of a block. + +2008-04-11 Oleg Ryjkov + + * tree-sra.c (insert_edge_copies_seq): Removed unused variable. + +2008-04-11 Oleg Ryjkov + + * tree-sra.c (sra_build_assignment): Tuplified. + (mark_all_v_defs): Removed. + (mark_all_v_defs_seq, mark_all_v_defs_stmt): New functions. + (sra_walk_expr): Tuplified. + (sra_walk_tree_list): Removed. + (sra_walk_call_expr, sra_walk_gimple_asm, + sra_walk_gimple_modifY_stmt, ): Tuplified and renamed. + (sra_walk_gimple_call, sra_walk_gimple_asm, + sra_walk_gimple_assign): New names for tuplified functions. + (sra_walk_function, find_candidates_for_sra, scan_use, scan_copy, + scan_ldst, instantiate_element, decide_instantiations, + mark_all_v_defs_1, sra_build_assignment, sra_build_bf_assignment, + sra_build_elt_assignment, generate_copy_inout, + generate_element_copy, generate_element_zero, + generate_one_element_init, generate_element_init_1): Tuplified. + (insert_edge_copies): Removed. + (insert_edge_copies_seq): New function. + (sra_insert_before, sra_insert_after, sra_replace, + sra_explode_bitfield_assignment, sra_sync_for_bitfield_assignment, + scalarize_use, scalarize_copy, scalarize_init, mark_no_trap, + scalarize_ldst, scalarize_parms, scalarize_function): Tuplified. + (tree_sra, tree_sra_early): Enabled + (sra_init_cache): Removed extra space. + * tree-flow.h (insert_edge_copies_seq): New declaration. + * gimple.h (gimple_asm_input_op_ptr, gimple_asm_output_op_ptr, + gimple_return_retval_ptr): New functions. + * passes.c (init_optimization_passes): Enabled pass_sra, + pass_early_sra. + +2008-04-11 Doug Kwan + + * ipa-pure-const.c (get_asm_expr_operands): Tuplify. + (get_asm_expr_operands): Tuplify. + (check_call): Tuplify. Add code to handle return value assignment. + (scan_function): Remove. Original code is tuplified and split into + two new functions scan_function_op and scan_function_stmt. + (scan_function_op): New function. + (scan_function_stmt): New function. + (analyze_function): Tuplify and re-enable previously disabled code. + * passes.c (init_optimization_passes): Re-enable pass_ipa_pure_const. + +2008-04-11 Oleg Ryjkov + + * builtins.c (fold_call_stmt): Return the proper value. + * tree-ssa-ccp.c (maybe_fold_stmt_addition): Modify arguments to + allow this function to be called on a GIMPLE_ASSIGN. + (fold_stmt_r): Update the call to maybe_fold_stmt_addition. + (fold_gimple_assign): Manually call maybe_fold_stmt_addition to + fold a POINTER_PLUS_EXPR. + +2008-04-11 Doug Kwan + + * tree-ssa-phiprop.c (File): Uncomment all previously disabled code. + (struct phiprop_d): Change type of vop_stmt to gimple. + (phivn_valid_p): Tuplify. + (phiprop_insert_phi): Tuplify. + (propagate_with_phi): Tuplify. + (tree_ssa_phiprop_1): Tuplify. + (tree_ssa_phiprop): Tuplify. + * passes.c (init_optimization_passes): Re-enable pass_phiprop. + +2008-04-11 Rafael Espindola + + * tree-ssa-math-opts.c (execute_cse_sincos_1): fix warning. + +2008-04-10 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00913.html + + * ipa-inline.c (cgraph_clone_inlined_nodes): Change uses + of DECL_SAVED_TREE with gimple_body. + (cgraph_decide_inlining_incrementally): Likewise. + * gimple-iterator.c (gsi_insert_seq_before_without_update): + Do nothing if SEQ is NULL. + (gsi_insert_seq_after_without_update): Likewise. + * tree-ssa-live.c (mark_all_vars_used_1): Do not handle + EXPR trees. + (remove_unused_locals): Mark the gimple_block of every + statement as used. + * tree-inline.c (remap_gimple_stmt): Forward declare. + (remap_decls): Tidy comments. + (remap_gimple_seq): New. + (copy_gimple_bind): New. + (remap_gimple_stmt): Call it. + Handle High GIMPLE statements. + (copy_bb): Regimplify operands on COPY_GSI instead of + GSI. + (copy_cfg_body): Tidy. + (copy_generic_body): Remove unused function. + (clone_body): Tuplify. + * c-common.c (c_warn_unused_result): Remove assertion for + FUNCTION_TYPE. + * gimple.c (gimple_seq_copy): Rename from + gimple_seq_deep_copy. Update all users. + (walk_gimple_stmt): Assert that STMT has no substatements + in the default case. + (gimple_copy_1): Merge into gimple_copy. + (gimple_copy): Always do deep copying. + Handle statements with substatements. + (gimple_shallow_copy): Remove unused function. + (gimple_deep_copy): Remove. Update all users. + * gimple.h: Tidy comments and structure fields + everywhere. + (gimple_has_substatements): New. + (walk_stmt_fn): Change last argument to struct walk_stmt_info *. + Update all users. + +2008-04-10 Oleg Ryjkov + + * tree.h (struct tree_base): Added a new flag default_def_flag. + (SSA_NAME_IS_DEFAULT_DEF): Changed to use the new flag. + +2008-04-08 Doug Kwan + + * gimplify.c (gimple_push_cleanup): Initialize cleanup_stmts to NULL. + +2008-04-08 Doug Kwan + + * tree-tailcall.c (struct tailcall): Remove call_block and replace + call_bsi by call_gsi. + (independent_of_stmt_p): Change type of parameter 'at' to GIMPLE and + change all tree using code to GIMPLE using equivalent. + Remove parameter block_stmt_iterator type parameter bsi with + gimple_stmt_iterator type parameter gsi. Replace uses of bsi with + that of gsi in function body as appropriate. + (process_assignment): Remove parameter 'ass' and change type of + parameter 'stmt' to GIMPLE. Change all tree using code to GIMPLE + using equivalent. + (propagate_through_phis, eliminate_tail_call, optimize_tail_call): + Change all tree using code to GIMPLE using equivalent. + (find_tail_calls): Change all tree using code to GIMPLE using + equivalent. Remove code that handles GIMPLE_MODIFY_STMT containing + a CALL_EXPR. + (add_successor_phi_arg, adjust_return_value_with_ops, + update_accumulator_with_ops, adjust_accumulator_values, + create_tailcall_accumulator): New functions from refactoring of + duplicated logic. + (adjust_accumulator_values, adjust_return_value): Refactor. + (tree_optimize_tail_calls_1): Refactor and change all tree using code + to GIMPLE using equivalent. Remove code to reverse phi list. + * passes.c (init_optimization_passes): Re-enable pass_tail_recursion + and pass_tail_calls. + +2008-04-04 Doug Kwan + + * tree-ssa-math-opts.c (struct occurrence): Change field type of + recip_def_stmt to gimple. + (is_division_by): Tuplify. + (insert_reciprocals): Tuplify. + (replace_reciprocals): Tuplify. + (execute_cse_reciprocals_1): Tuplify. + (execute_cse_reciprocals): Tuplify. + (maybe_record_sincos): Use vector of gimples instead of vector of + trees. + (execute_cse_sincos_1): Tuplify. When adjusting recorded old call + sites, generate new gimple assign statements and remove old gimple + call statements. + (execute_cse_sincos): Tuplify. + (execute_convert_to_rsqrt): Tuplify. + * passes.c (init_optimization_passes): Enable pass_cse_sincos, + pass_cse_reciprocals and pass_convert_to_rsqrt. + +2008-04-04 Aldy Hernandez + + * omp-low.c (gimple_build_cond_empty): New. + (expand_parallel_call): Convert COND_EXPR to GIMPLE_COND. + (expand_omp_for_generic): Same. + (expand_omp_for_static_nochunk): Same. + (expand_omp_for_static_chunk): Same. + (expand_omp_atomic_pipeline): Same. + +2008-04-04 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00413.html + + * tree-ssa-loop-im.c (movement_possibility): Return + MOVE_IMPOSSIBLE if that statement makes no assignment. + * tree-complex.c (get_component_ssa_name): Fix comment. + (set_component_ssa_name): Assert that COMP's definition + is LAST. + * cgraph.c (cgraph_update_edges_for_call_stmt): Tuplify. + (dump_cgraph_node): Likewise. + * tree.c (auto_var_in_fn_p): Fix comment. + * cgraphunit.c (verify_cgraph_node): Remove tuples hack + that avoided verifying nodes. + * gimple-pretty-print.c (dump_gimple_asm): Show the + volatile flag. + + * gimple-dummy.c (optimize_inline_calls): Remove. + (tree_function_versioning): Remove. + (tree_versionalbe_function_p): Remove. + * ipa-inline.c (cgraph_clone_inlined_bodies): Re-format. + (cgraph_decide_inlining): Re-format. + (cgraph_decide_inlining_incrementally): Re-format. + (pass_ipa_inline): Re-format. + * gimplify.c (gimplify_call_expr): Carry all the + CALL_EXPR flags to the newly created GIMPLE_CALL. + (gimplify_asm_expr): Carry ASM_VOLATILE_P and ASM_INPUT_P + over to the new GIMPLE_ASM. + * tree-dfa.c (find_new_referenced_vars): Change argument + to gimple. Update all callers. + * cfgexpand.c (set_expr_location_r): New private. + (gimple_to_tree): Call it. + Set ASM_VOLATILE_P and ASM_INPUT_P for ASM_EXPRs. + Carry flags from GIMPLE_CALL for CALL_EXPRs. + Set TREE_BLOCK on the newly created expression. + * tree-inline.c: Tuplify. + * tree-inline.h: Tuplify. + * tree-optimize.c (execute_fixup_cfg): Tuplify. + * gimple.c (gimple_build_call_vec): Change second + argument type to VEC(tree, heap). Update all callers. + (gimple_build_assign_with_ops): If the LHS is an + SSA_NAME, set SSA_NAME_DEF_STMT on it. + (walk_gimple_seq): Change return type to gimple. Update + all users. + If walk_gimple_stmt returned a value, store it in + WI->CALLBACK_RESULT. + (walk_gimple_op): Walk gimple_call_chain_ptr() and + gimple_call_fn_ptr() for GIMPLE_CALL. + (walk_gimple_stmt): Add new local HANDLED_OPS. + If callback_stmt() sets HANDLED_OPS, return its return + value. + If any call to walk_gimple_seq returns a non-NULL value, + return WI->CALLBACK_RESULT. + (gimple_copy_1): New function. + (gimple_deep_copy): Rename from gimple_copy. Update all + users. + Call gimple_copy_1. + (gimple_shallow_copy): New. + (gimple_regimplify_operands): New. + * gimple.h (GF_ASM_INPUT): Define. + (GF_ASM_VOLATILE): Define. + (GF_CALL_CANNOT_INLINE): Define. + (GF_CALL_FROM_THUNK): Define. + (GF_CALL_RETURN_SLOT_OPT): Define. + (GF_CALL_VA_ARG_PACK): Define. + (gimple_stmt_iterator): Move earlier in the file. + (gimple_omp_return_nowait_p): Fix return expression. + (gimple_omp_section_last_p): Likewise. + (gimple_omp_parallel_combined_p): Likewise. + (gimple_call_noreturn_p): Likewise. + (gimple_call_nothrow_p): Likewise. + (gimple_asm_volatile_p): Likewise. + (gimple_try_catch_is_cleanup): Likewise. + (gimple_assign_set_rhs1): assert that RHS is a gimple + operand. + (is_gimple_call): New. Change all users that tested + gimple_code() == GIMPLE_CALL. + (gimple_call_fn_ptr): New. + (gimple_call_chain_ptr): New. + (gimple_call_set_chain): Accept NULL values for CHAIN. + (gimple_call_set_tail): Add bool argument specifying the + value of the flag. Update all users. + (gimple_asm_set_volatile): Likewise. + (gimple_call_set_cannot_inline): Rename from + gimple_call_mark_uninlinable. Add bool argument + specifying the value of the flag. Update all users. + (gimple_call_set_return_slot_opt): New. + (gimple_call_return_slot_opt_p): New. + (gimple_call_set_from_thunk): New. + (gimple_call_from_thunk_p): New. + (gimple_call_va_arg_pack_p): New. + (gimple_call_copy_flags): New. + (gimple_asm_set_input): New. + (gimple_asm_input_p): New. + (gimple_asm_clear_volatile): Remove. + (walk_stmt_fn): Add second argument bool *. Update all + users. + (struct walk_stmt_info): Add new field callback_result. + * tree-cfg.c (gimple_split_block): Tuplify. + (gimple_block_ends_with_condjump_p): Tuplify. + (need_fake_edge_p): Tuplify. + (gimple_flow_call_edges_add): Tuplify. + (gimple_purge_dead_abnormal_call_edges): Tuplify. + (gimple_purge_dead_eh_edges): Remove ATTRIBUTE_UNUSED. + (gimple_cfg_hooks): Add gimple_block_ends_with_condjump_p + and gimple_flow_call_edges_add + * passes.c (init_optimization_passes): Enable + pass_cleanup_cfg, pass_inline_parameters, + pass_ipa_inline and pass_apply_inline. + (execute_todo): Re-enable check for TODO_update_ssa_any + if need_ssa_update_p() returns true. + * tree-ssa-operands.c (ssa_operands_active): Return false + if cfun is NULL. + + +2008-04-04 Rafael Espindola + + Merge with mainline @133632. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-04 Rafael Espindola + + Merge with mainline @133631. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-04 Rafael Espindola + + Merge with mainline @133630. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-03 Aldy Hernandez + + * omp-low.c (expand_omp_sections): Use + gimple_omp_sections_control. + (lower_omp_sections): Same. + * gimplify.c (gimplify_omp_workshare): Adjust OMP clauses before + creating gimple tuple. + Add gimple tuple to sequence. + Set OMP_SECTIONS_CONTROL in newly created tuple. + * gimple.h (gimple_statement_omp_sections): Add control. + (gimple_omp_sections_control): New. + (gimple_omp_sections_control_ptr): New. + (gimple_omp_sections_set_control): New. + +2008-04-03 Oleg Ryjkov + + * tree-nested.c (convert_nl_goto_receiver): Changed to hadle gimple + statements instead of trees. + (lower_nested_functions): Pass convert_nl_goto_receiver as the first + parameter to walk_all_functions. + +2008-04-03 Rafael Espindola + + Merge with mainline @133624. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-03 Rafael Espindola + + Merge with mainline @133612. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-03 Aldy Hernandez + + * tree-pretty-print.c (dump_generic_node): Remove + OMP_{RETURN,CONTINUE} cases. + * tree.h (OMP_RETURN_NOWAIT): Remove. + * omp-low.c (dump_omp_region): Rename OMP_{CONTINUE,RETURN} to + GIMPLE_OMP_{CONTINUE,RETURN}. + (expand_omp_for_generic): Handle new arguments to + GIMPLE_OMP_CONTINUE. + (expand_omp_for_static_nochunk): Same. + (expand_omp_for_static_chunk): Same. + (expand_omp_sections): Same. + (expand_omp): Rename all OMP_* to GIMPLE_OMP_*. + (lower_omp_sections): Rename OMP_CONTINUE to GIMPLE_OMP_CONTINUE. + (lower_omp_for): Same. + * tree-gimple.c (is_gimple_stmt): Remove OMP_{RETURN,CONTINUE} + cases. + * gsstruct.def: Add GSS_OMP_CONTINUE. + * gimple-pretty-print.c (dump_gimple_omp_continue): New. + (dump_gimple_omp_return): New. + (dump_gimple_stmt): Add cases for GIMPLE_OMP_{CONTINUE,RETURN}. + * gimplify.c (gimplify_expr): Remove cases for + OMP_{CONTINUE,RETURN}. + * tree.def (DEFTREECODE): Remove OMP_{RETURN,CONTINUE}. + * tree-cfgcleanup.c (cleanup_omp_return): Rename + OMP_SECTIONS_SWITCH to GIMPLE_OMP_SECTIONS_SWITCH. + * gimple.c (gss_for_code): GIMPLE_OMP_RETURN returns GSS_BASE. + GIMPLE_OMP_CONTINUE return GSS_OMP_CONTINUE. + (gimple_size): Adjust size of GIMPLE_OMP_{RETURN,CONTINUE}. + (gimple_build_omp_continue): Change arguments. + (walk_gimple_op): Walk GIMPLE_OMP_CONTINUE operands. + (walk_gimple_stmt): Remove GIMPLE_OMP_CONTINUE case. + * gimple.h (struct gimple_statement_omp_continue): New. + (union gimple_statement_d): Add gimple_omp_continue. + (gimple_build_omp_continue): Change argument types in prototype. + (gimple_omp_return_set_nowait): Rename OMP_RETURN to + GIMPLE_OMP_RETURN. + (gimple_omp_continue_control_def): New. + (gimple_omp_continue_control_def_ptr): New. + (gimple_omp_continue_set_control_def): New. + (gimple_omp_continue_control_use): New. + (gimple_omp_continue_control_use_ptr): New. + (gimple_omp_continue_set_control_use): New. + * tree-cfg.c (make_edges): Rename OMP_ to GIMPLE_OMP_. + (gimple_redirect_edge_and_branch): Same. + * tree-ssa-operands.c (get_expr_operands): Remove OMP_CONTINUE + case. + +2008-04-02 Doug Kwan + + * tree-complex.c (expand_complex_comparison): Set condition code + correctly for the NE_EXPR case. + * cfgexpand.c (gimple_to_tree): Generate assignment to return value + if necessary. + +2008-04-02 Rafael Espindola + + Merge with mainline @133597. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-02 Rafael Espindola + + Merge with mainline @133527. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-02 Rafael Espindola + + Merge with mainline @133519. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-02 Rafael Espindola + + Merge with mainline @133453. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-04-01 Doug Kwan + Bill Maddox . + + * value-prof.c (interesting_stringop_to_profile_p) Call + validate_gimple_arglist instead of validate_arglist. + * tree.h (validate_arglist): New declaration. + * builtins.c (expand_builtin_setjmp_receiver, expand_builtin_longjmp, + expand_builtin_nonlocal_goto, expand_builtin_nonlocal_goto, + expand_builtin_update_setjmp_buf, expand_builtin_prefetch, + expand_builtin_apply, expand_builtin_return, expand_builtin_mathfn, + expand_builtin_mathfn_2, expand_builtin_mathfn_3, + expand_builtin_interclass_mathfn, expand_builtin_sincos, + expand_builtin_cexpi, expand_builtin_int_roundingfn, + expand_builtin_int_roundingfn_2, expand_builtin_pow, + expand_builtin_powi, expand_builtin_strlen, expand_builtin_strlen, + expand_builtin_strstr, expand_builtin_strchr, expand_builtin_strrchr, + expand_builtin_memcpy, expand_builtin_memcpy, + expand_builtin_mempcpy_args, expand_builtin_bcopy, expand_movstr, + expand_builtin_stpcpy, expand_builtin_strncpy, builtin_memset_gen_str, + expand_builtin_bzero, expand_builtin_memchr, expand_builtin_memcmp, + expand_builtin_strcmp, expand_builtin_strncmp, expand_builtin_strcat, + expand_builtin_strncat, expand_builtin_strspn, expand_builtin_alloca, + expand_builtin_bswap, expand_builtin_unop, expand_builtin_fputs, + expand_builtin_fabs, expand_builtin_copysign, + expand_builtin___clear_cache, expand_builtin_init_trampoline, + expand_builtin_adjust_trampoline, expand_builtin_signbit, + expand_builtin, validate_arg, expand_builtin_object_size, + expand_builtin_object_size, expand_builtin_memory_chk) Re-enable code + previously disabled for GIMPLE. + (expand_builtin_memcpy, expand_builtin_memset_args): Re-enable code + previously disabled for GIMPLE. Look up tree attribute for original + GIMPLE statement. + (validate_arglist): Use old interface of tree node instead of GIMPLE + statement. + (validate_gimple_arglist): New function. + * cfgexpand.c (gimple_to_tree): Set GIMPLE statement tree attribute + for builtin function calls. + * tree-flow.h (struct tree_ann_common_d): New field stmt. + * gimple.h (validate_gimple_arglist): New declaration. + (validate_arglist): Moved to tree.h. + +2008-03-31 Oleg Ryjkov + + * gimplify.c (gimplify_switch_expr): Verify the return value from + gimplify_expr. + +2008-03-31 Rafael Espindola + + Merge with mainline @133452. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-31 Rafael Espindola + + Merge with mainline @133440. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-31 Rafael Espindola + + Merge with mainline @133423. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-30 Rafael Espindola + + Merge with mainline @133342. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-28 Rafael Espindola + + Merge with mainline @133341. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-28 Oleg Ryjkov + + * tree-eh.c (replace_goto_queue_1): Do a deep copy of the replacement + sequence. + (maybe_record_in_goto_queue): Set is_label flag when recording + GIMPLE_GOTOs. + (do_return_redirection, do_return_redirection): Changed to set + cont_stmt. + (lower_try_finally_onedest): Fix the code that assumes that gotos + themselves(instead of the labels) are recorded in the goto_queue. + (lower_try_finally_copy): Likewise. + (lower_try_finally_switch): Likewise, also fix the VEC_* operations. + * gimple.h (gimple_build_switch): Fixed comment. + +2008-03-28 Doug Kwan + + * omp-low.c (expand_omp_sections): Fix build breakage due to an + uninitialized variable. + +2008-03-28 Rafael Espindola + + Merge with mainline @133315. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-28 Diego Novillo + + * omp-low.c (expand_omp_for_static_chunk): Initialize + V_MAIN and V_BACK. + (expand_omp_for): Initialize VIN. + +2008-03-28 Rafael Espindola + + Merge with mainline @133313. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-27 Doug Kwan + + * c-decl.c (merge_decls): Also copy gimple bodies of decls. + * gimplify.c (gimplify_call_expr): Do not exit early when + gimplifying __builtin_va_start(). + +2008-03-27 Oleg Ryjkov + + * gimple.c (walk_gimple_op): Add a check for assignments with more + than one operand on the LHS. + +2008-03-27 Aldy Hernandez + + * tree.c (empty_body_p): Remove. + * tree.h (empty_body_p): Remove prototype. + * omp-low.c (struct omp_context): Convert to tuples. + (struct omp_context): Comment and convert to tuples. + (scan_omp_op): New. + (is_parallel_ctx): Convert to tuples. + (extract_omp_for_data): Same. + (workshare_safe_to_combine_p): Same. + (get_ws_args_for): Same. + (determine_parallel_type): Same. + (use_pointer_for_field): Same. + (dump_omp_region): Same. + (debug_all_omp_regions): Same. + (new_omp_region): Same. + (new_omp_context): Same. + (scan_sharing_clauses): Same. + (create_omp_child_function): Same. + (scan_omp_parallel): Same. + (scan_omp_for): Same. + (scan_omp_sections): Same. + (scan_omp_single): Same. + (check_omp_nesting_restrictions): Same. + (scan_omp_1_op): New. + (scan_omp_1_stmt): Rename from scan_omp_1. Rewrite for tuples. + (scan_omp): Convert to tuples. + (build_omp_barrier): Same. + (maybe_lookup_ctx): Same. + (lower_rec_input_clauses): Same. + (lower_lastprivate_clauses): Same. + (lower_reduction_clauses): Same. + (lower_copyprivate_clauses): Same. + (lower_send_clauses): Same. + (lower_send_shared_vars): Same. + (expand_parallel_call): Same. + (remove_exit_barrier): Same. + (remove_exit_barriers): Same. + (optimize_omp_library_calls): Same. + (expand_omp_parallel): Same. + (expand_omp_for_generic): Comment out, and convert to tuples. + (expand_omp_for_static_nochunk): Convert to tuples. + (expand_omp_for_static_chunk): Same. + (expand_omp_for): Same. + (expand_omp_sections): Same. + (expand_omp_synch): Same. + (expand_omp_atomic_fetch_op): Same. + (expand_omp_atomic_pipeline): Same. + (expand_omp_atomic_mutex): Same. + (expand_omp_atomic): Same. + (expand_omp): Same. + (build_omp_regions_1): Same. + (execute_expand_omp): Enable. + (execute_lower_omp): Enable and convert to tuples. + * gimple-dummy.c (omp_reduction_init): Remove. + * tree-flow.h (struct omp_region): Convert 'type' to tuples. + (new_omp_region): Adjust prototype for tuples. + * gimple.c (empty_stmt_p): New. + (empty_body_p): New. + * gimple.h (empty_body_p): New prototype. + (gimple_has_location): Remove fixmes. + * tree-cfg.c (gimple_block_label): Remove ATTRIBUTE_UNUSED. + +2008-03-27 Rafael Espindola + + Merge with mainline @133311. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-27 Rafael Espindola + + * gcc/tree-nested.c (save_tmp_var): Use gsi_insert_after_without_update + instead of gsi_insert_after. + +2008-03-26 Jakub Staszak + + * gimple.h (gimple_uid, gimple_set_uid): Defined. + (gimple_statement_base): Field UID added. + * tree-ssa-dse.c (execute_simple_dse): #if 0 removed, bitmap_empty_p + condition added. (memory_ssa_name_same, memory_address_same, + get_kill_of_stmt_lhs, dse_possible_dead_store_p, dse_optimize_stmt, + dse_record_phis, dse_finalize_block, tree_ssa_dse): Tuplified. + * passes.c (init_optimization_passes): pass_simple_dse and pass_dse + enabled. + * testsuite/gcc.dg/tree-ssa/ssa-dse-10.c: {dg-final} changed. + * testsuite/gcc.dg/tree-ssa/pr30375.c: {dg-final} changed. + +2008-03-26 Rafael Espindola + * gcc/tree-ssa-operands.c (ssa_operands_active): Assert that cfun is + not NULL. + * gcc/tree-nested.c (init_tmp_var): Use + gsi_insert_before_without_update instead of gsi_insert_before. + +2008-03-25 Rafael Espindola + + Merge with mainline @133309. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-25 Rafael Espindola + + Merge with mainline @133306. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-25 Bill Maddox + + * tree-ssa-dom.c (loop_depth_of_name): Tuplify. + * tree-ssa-copy.c (stmt_may_generate_copy, + copy_prop_visit_assignment, copy_prop_visi_cond_stmt, + copy_prop_visit_stmt, copy_prop_visit_phi_node, + init_copy_prop, execute_copy_prop): Tuplify. + * passes.c (init_optimization_passes): + Enable pass_copy_prop. + +2008-03-25 Rafael Espindola + + Merge with mainline @133257. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-25 Oleg Ryjkov + + * gimple.c (gimple_build_bind): Added a new parameter - the + containing block. + * gimple.h (gimple_build_bind): Changed the header accordingly. + * gimplify.c (gimplify_bind_expr, gimplify_function_tree): Updated + the callers of gimple_build_bind. + (gimplify_body): Updated the call to gimple_build_bind and moved + the copying of block information into gimplify_bind_expr. + +2008-03-25 Rafael Espindola + + Merge with mainline @133255. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-25 Rafael Espindola + + Merge with mainline @133251. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-25 Rafael Espindola + + Merge with mainline @133250. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-24 Rafael Espindola + + Merge with mainline @133246. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-24 Rafael Espindola + + Merge with mainline @133222. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-24 Andrew Pinski + + * passes.c (init_optimization_passes): Enable pass_split_crit_edges. + +2008-03-24 Rafael Espindola + + Merge with mainline @133169. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-21 Rafael Espindola + + Merge with mainline @133168. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-21 Rafael Espindola + + Merge with mainline @133167. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-20 Oleg Ryjkov + + * tree-eh.c (lower_try_finally): Correctly set the lowered sequence. + +2008-03-20 Jakub Staszak + Oleg Ryjkov + + * tree-ssa-sink.c (is_hidden_global_store): Tuplified. + * tree-ssa-dce.c (mark_stmt_necessary, mark_operand_necessary, + mark_stmt_if_obviously_necessary, + mark_control_dependent_edges_necessary, + find_obviously_necessary_stmts, propagate_necessity, + remove_dead_phis, eliminate_unnecessary_stmts, tree_dce_init, + tree_dce_done): Tuplified. + * tree-flow.h (is_hidden_global_store): Tuplified the declaration. + * passes.c (init_optimization_passes): Enabled pass_dce and + pass_cd_dce. + +2008-03-20 Oleg Ryjkov + + * tree-complex.c (init_dont_simulate_again, complex_visit_stmt, + update_complex_components, expand_complex_operations_1): Consider + GIMPLE_CALLs with a lhs, not only GIMPLE_ASSIGNs. + * gimplify.c (get_tmp_var_for): Removed. + (gimplify_call_expr): Remove call to get_tmp_var_for, set + gimple_register on a new lhs in some cases. + +2008-03-20 Rafael Espindola + + Merge with mainline @133162. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-20 Rafael Espindola + + Merge with mainline @133161. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-20 Rafael Espindola + + Merge with mainline @133140. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-20 Rafael Espindola + + Merge with mainline @133138. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-18 Bill Maddox + + * builtins.c (fold_builtin_object_size): + Enable call to compute_builtin_object_size, previously + stubbed out awaiting tuplification. + * tree-ssa-ccp.c (valid_gimple_rhs_p, valid_gimple_call_p, + move_ssa_defining_stmt_for_defs, update_call_from_tree): + Deleted, moved to tree-ssa-propagate.c. + (get_maxval_strlen): Use gimple_assign_single_p. + Handle assignment with unary NOP correctly. + * tree-ssa-propagate.c (valid_gimple_rhs_p, valid_gimple_call_p, + move_ssa_defining_stmt_for_defs, update_call_from_tree): + Moved here from tree-ssa-ccp.c. + * tree-ssa-propagate.h (valid_gimple_rhs_p, valid_gimple_call_p, + move_ssa_defining_stmt_for_defs, update_call_from_tree): Declared. + * gimple-dummy.c (compute_builtin_object_size): Removed dummy. + * tree_object_size.c (addr_object_size, alloc_object_size) + Tuplified. + (pass_through_call, compute_builtin_object_size): Tuplified. + (expr_object_size): Tuplified. Some cases broken out. + (plus_expr_object_size): Deleted. + (call_object_size, unknown_object_size, plus_stmt_object_size): + New functions. Handle cases broken out from expr_object_size. + (cond_expr_object_size): Fix comment. + (collect_object_sizes_for): Tuplify. + (check_for_plus_in_loops_1, check_for_plus_in_loops): Tuplify. + (compute_object_sizes): Tuplify. + * gimple.c (gimple_assign_single_p, gimple_assign_unary_nop_p): + New functions. + * gimple.h (gimple_assign_single_p, gimple_assign_unary_nop_p): + Declare. + * passes.c (init_optimization_passes): Enable pass_object_sizes. + +2008-03-18 Diego Novillo + Oleg Ryjkov + + * gimplify.c (gimplify_body): Copy the block information from + the tree function body to gimple function body. + (gimplify_function_tree): Correctly wrap the function body + into the try/finally block if creating one. + * gimple.c (gimple_seq_has_side_effects): Removed. + * gimple.h (gimple_seq_has_side_effects): Removed declaration. + * tree-cfg.c (remove_useless_stmts_tf, remove_useless_stmts_tc): + Modified to use gimple_seq_empty_p instead of + gimple_seq_has_side_effects. + +2008-03-18 Aldy Hernandez + + * gimple.c (walk_gimple_stmt): Collapse common code. + Add case for GIMPLE_WITH_CLEANUP_EXPR. + +2008-03-17 Zdenek Dvorak + + * gimple-iterator.c (gsi_for_stmt): Use gsi_start_phis. + (gsi_start_phis): New function. + * gimple.h (gsi_start_phis): Declare. + * tree-into-ssa.c (initialize_flags_in_bb, rewrite_initialize_block, + rewrite_add_phi_arguments, rewrite_update_init_block, + prepare_block_for_update): Use gsi_start_phis. + * tree-complex.c (init_dont_simulate_again, update_phi_components): + Ditto. + * tree-ssa-loop-manip.c (find_uses_to_rename_bb, + verify_loop_closed_ssa, split_loop_exit_edge, + tree_transform_and_unroll_loop): Ditto. + * tree-scalar-evolution.c (loop_closed_phi_def, + analyze_scalar_evolution_for_all_loop_phi_nodes, scev_const_prop): + Ditto. + * tree-phinodes.c (reserve_phi_args_for_new_edge, remove_phi_args): + Ditto. + * tree-ssa-copyrename.c (rename_ssa_copies): Ditto. + * tree-ssa-ccp.c (ccp_initialize): Ditto. + * tree-ssa-loop-ivopts.c (find_bivs, mark_bivs, + find_interesting_uses_outside, find_interesting_uses, + determine_set_costs): Ditto. + * tree-ssa-propagate.c (simulate_block, ssa_prop_init, + substitute_and_fold): Ditto. + * tree-ssa-alias.c (dump_points_to_info, create_structure_vars): Ditto. + * gimple-pretty-print.c (dump_phi_nodes): Ditto. + * tree-data-ref.c (stmts_from_loop): Ditto. + * tree-ssa-coalesce.c (build_ssa_conflict_graph, + create_outofssa_var_map, coalesce_partitions): Ditto. + * tree-dfa.c (collect_dfa_stats): Ditto. + * tree-cfgcleanup.c (phi_alternatives_equal, remove_forwarder_block, + remove_forwarder_block_with_phi, merge_phi_nodes): Ditto. + * tree-ssa-live.c (remove_unused_locals, calculate_live_on_exit, + verify_live_on_entry): Ditto. + * tree-ssa.c (ssa_redirect_edge, flush_pending_stmts, verify_ssa, + execute_late_warn_uninitialized, execute_update_addresses_taken): + Ditto. + * tree-outof-ssa.c (eliminate_build, eliminate_virtual_phis, + rewrite_trees, remove_ssa_form, insert_backedge_copies): + Ditto. + * cfgloop.c (find_subloop_latch_edge_by_ivs): Ditto. + * tree-ssa-structalias.c (compute_points_to_sets, ipa_pta_execute): + Ditto. + * tree-cfg.c (remove_phi_nodes_and_edges_for_unreachable_block, + reinstall_phi_args, verify_stmts, gimple_make_forwarder_block, + add_phi_args_after_copy_edge, gimple_lv_adjust_loop_header_phi): + Ditto. + +2008-03-16 Zdenek Dvorak + + * tree-ssa-loop-ivopts.c: Tuplify. + * gimple-dummy.c (multiplier_allowed_in_address_p, multiply_by_cost, + tree_ssa_iv_optimize): Removed. + * tree-ssa-phiopt.c (empty_block_p): Tuplify. + * gimple.h (gimple_cond_lhs_ptr, gimple_cond_rhs_ptr): New. + * passes.c (init_optimization_passes): Enable pass_iv_optimize. + + * gimplify.c (gimplify_omp_workshare, gimplify_expr): Avoid using + uninitialized sequence. + +2008-03-13 Bill Maddox + + * tree.h (fold_call_stmt, gimple_fold_builtin_snprintf_chk): + Declare new functions. + * builtins.c (fold_builtin_object_size): Disable call to + compute_builtin_object_size, which has not been converted. + (gimple_rewrite_call_expr, gimple_fold_builtin_sprintf_chk, + gimple_fold_builtin_snprintf_chk, gimple_fold_builtin_varargs, + fold_call_stmt): New functions. + * tree-chrec.h (build_polynomial_chrec): Silence uninitialized + variable warning. + * tree-ssa-ccp.c (likely_value): Recognize additional cases + of constant values. + (surely_varying_stmt_p): Note that return statements are not + interesting to CCP as they no longer contain assignments. + (ccp_fold): Add missing spaces. + (valid_gimple_call_p): New function. + (get_maxval_strlen): Don't trip over unary operator. + (ccp_fold_builtin): Use fold_call_stmt and + gimple_fold_builtin_snprintf_chk. Enable disabled + call now that target has been converted for tuples. + Add missing spaces. + (move_ssa_defining_stmt_for_defs): New function. + (update_call_from_tree): New function. + (fold_gimple_call): Use update_call_from_tree. + (fold_stmt_inplace): Assert that operand folding tree + walk goes to completion, i.e., does not return non-null. + (optimize_stack_restore, optimize_stdarg_builtin): + Convert to tuples + (convert_to_gimple_builtin): Removed. + (gimplify_and_update_call_from_tree): New function. + Replaces convert_to_gimple_builtin. + (execute_fold_all_builtins): Convert to tuples. + * tree-ssa-propagate.c (replace_uses_in): Removed + replaced_address argument. Made function static. + (replace_vuses_in): Removed replaced_address argument. + (substitute_and_fold): Removed replaced_address boolean, + which was set but never examined. + * tree-ssa-propagate.h (replace_uses_in): Removed declaration. + * gimple-iterator.c (update_modified_stmt): Moved to + head of file to avoid a forward declaration. + (update_modified_stmts): New function. + (gsi_insert_seq_before_without_update, + gsi_insert_before_without_update, + gsi_insert_seq_after_without_update, + gsi_insert_after_without_update): New functions. + (gsi_insert_before, gsi_insert_seq_before, + gsi_insert_after, gsi_insert_seq_after): Call the + _without_update variants. + * gimplify.c (gimplify_seq_add_stmt, gimplify_seq_add_seq): + New functions. + (gimple_pop_condition, gimplify_return_expr, gimplify_loop_expr, + gimplify_switch_expr, gimplify_case_label_expr, + gimplify_self_mod_expr, gimplify_call_expr, + gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset, + gimplify_init_ctor_eval_range, gimpllify_modify_expr_complex_part, + gimplify_modify_expr, gimplify_asm_expr, gimplify_cleanup_point_expr, + gimple_push_cleanup, gimplify_omp_parallel, gimplify_omp_atomic, + gimplify_expr, gimplify_body, gimplify_function_tree): When adding + to statement sequences in the gimplifier, do not update operands. + * tree-dfa.c (find_new_referenced_vars): Convert to tuples. + * tree-flow.h (find_new_referenced_vars): Declare with new signature. + * gimple.h (gimple_return_set_retval): Fix argument validation. + (gsi_insert_seq_before_without_update, + gsi_insert_before_without_update, + gsi_insert_seq_after_without_update, + gsi_insert_after_without_update): Declare new functions. + * gimple.c (gimple_build_return): Rely on gimple_return_set_retval + to perform argument validation. + * passes.c (init_optimization_passes): Enable pass_fold_builtins. + +2008-03-13 Oleg Ryjkov + + * tree-cfg.c (gimplify_val): Removed. + (gimplify_build1, gimplify_build2, gimplify_build3): Use + force_gimple_operand_gsi instead of gimplify_val. + * tree-complex.c (extract_component): Use force_gimple_operand_gsi + instead of gimplify_val. + * tree-vect-generic.c (expand_vector_parallel): Ditto. + +2008-03-13 Diego Novillo + Oleg Ryjkov + + * tree-ssa-operands.c (get_expr_operands): Handle FILTER_EXPR and + EXC_PTR_EXPR. + +2008-03-12 Diego Novillo + Oleg Ryjkov + + * cfgexpand.c (gimple_to_tree): Record the correct type when + converting GIMPLE_CALL. + +2008-03-12 Zdenek Dvorak + + * tree-ssa-loop-im.c (stmt_cost, rewrite_bittest, + determine_invariantness_stmt, gather_mem_refs_stmt): + Use gimple_assign_rhs_code. + * cfgexpand.c (gimple_to_tree): Ditto. + * tree-inline.c (estimate_num_insns): Ditto. + * tree-vect-generic.c (expand_vector_operations_1): Ditto. + * tree-ssa-ccp.c (likely_value, ccp_fold, evaluate_stmt, + * gimple.c (gimple_fold, gimple_assign_set_rhs_with_ops): Ditto. + * tree-ssa-structalias.c (handle_ptr_arith): Ditto. + fold_gimple_assign): Ditto. + * value-prof.c (gimple_divmod_fixed_value_transform): Ditto. + * tree-ssa-loop-ch.c (copy_loop_headers): Ditto. + * tree-ssa-propagate.c (stmt_makes_single_load, + substitute_and_fold): Ditto. + * tree-ssa-loop-niter.c (chain_of_csts_start): Exclude memory loads. + (get_val_for): Assert that the statement is an assignment. + (derive_constant_upper_bound_assign, + expand_simple_operations): Use gimple_assign_rhs_code. + * tree-ssa-loop-manip.c (create_iv, ip_normal_pos, + standard_iv_increment_position, determine_exit_conditions, + tree_transform_and_unroll_loop): Tuplify. + * tree-scalar-evolution.c (interpret_expr): Fail for chrecs. + (interpret_gimple_assign, follow_ssa_edge_in_rhs): Use + gimple_assign_rhs_code. + * tree-gimple.c (gimple_assign_rhs_code): New function. + * tree-gimple.h (gimple_assign_rhs_code): Declare. + * tree-ssa-loop-ivopts.c (single_dom_exit): Enable. + * gimple-dummy.c (compute_data_dependences_for_loop, dump_ddrs, + free_data_refs, free_dependence_relations, + gimple_duplicate_loop_to_header_edge, tree_ssa_prefetch_arrays, + estimated_loop_iterations_int): Removed. + * tree-ssa-loop-ivcanon.c (tree_num_loop_insns): Tuplify. + * predict.c, tree-data-ref.c, tree-ssa-loop-prefetch.c: Tuplify. + * tree-data-ref.h (struct data_reference, struct rdg_vertex): Change + the type of stmt to gimple. + (get_references_in_stmt, create_data_ref, rdg_vertex_for_stmt, + stores_from_loop, remove_similar_memory_refs, + have_similar_memory_accesses): Declaration changed. + * gimple-iterator.c (gsi_insert_seq_on_edge_immediate): New. + * gimple-pretty-print.c (dump_gimple_assign): Dump nontemporal + move. Use gimple_assign_rhs_code. + (dump_unary_rhs, dump_binary_rhs): Use gimple_assign_rhs_code. + * gimplify.c (gimplify_modify_expr): Set lhs of the assignment to + the new SSA name. + * tree-ssa-coalesce.c (build_ssa_conflict_graph, + create_outofssa_var_map): Use gimple_assign_copy_p. + * tree-predcom.c (mark_virtual_ops_for_renaming): Enable. + * tree-inline.c (estimate_num_insns): Use gimple_assign_rhs_code. + * tree-flow.h (mark_virtual_ops_for_renaming): Declaration changed. + * gimple.h (struct gimple_statement_base): Change unused_4 flag + to nontemporal_move flag. + (gimple_assign_nontemporal_move_p, gimple_assign_set_nontemporal_move): + New functions. + (gsi_insert_seq_on_edge_immediate): Declare. + (gimple_assign_rhs2): Return NULL if the statement does not have two + operands. + (gimple_assign_subcode): Removed. + * tree-cfg.c (verify_types_in_gimple_assign): Use + gimple_assign_rhs_code. + (gimple_lv_adjust_loop_header_phi, gimple_lv_add_condition_to_bb): + Tuplify. + (gimple_cfg_hooks): Enable lv_add_condition_to_bb and + lv_adjust_loop_header_phi hooks. + * passes.c (init_optimization_passes): Enable pass_profile, + pass_check_data_deps and pass_loop_prefetch. + +2008-03-11 Diego Novillo + + * tree-ssa-operands.h: Added declaration of add_to_addressable_set. + * tree-ssa-operands.h (add_to_addressable_set): New function. + (gimple_add_to_addresses_taken): Moved most of the logic to + add_addressable_set. + * tree-ssa-structalias.c (update_alias_info): Record the variables + whose address is taken inside a phi node. + +2008-03-11 Aldy Hernandez + + * tree-phinodes.c (allocate_phi_node): Update for tuples. + * gimplify.c (gimplify_function_tree): Dump memory stats. + * gimple.c: Declare gimple_alloc_counts, gimple_alloc_sizes, + and gimple_alloc_kind_names. + (gimple_alloc): Gather statistics for tuples. + (gimple_build_asm_1): Same. + (gimple_seq_alloc): Same. + (dump_gimple_statistics): New. + * gimple.h: Define gimple_alloc_kind. + (gimple_alloc_kind): New. + (dump_gimple_statistics): Protoize. + * tree-ssa-copy.c (replace_exp_1): Mark for_propagation as unused + (merged from mainline). + +2008-03-11 Diego Novillo + + Merge with mainline @133081. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-06 Diego Novillo + + Merge with mainline @132948 + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-03-06 Diego Novillo + + * config/rs6000/rs6000.c (rs6000_alloc_sdmode_stack_slot): + Call walk_gimple_op. + * tree-complex.c (expand_complex_div_wide): Call + split_block with STMT. + +2008-03-06 Diego Novillo + + * gimple.h (struct gimple_statement_base): Rename field + 'locus' to 'location'. Update all users. + (gimple_location): Rename from gimple_locus. Update all + users. + (gimple_set_location): Rename from gimple_set_locus. + Update all users. + (gimple_has_location): Rename from gimple_location_empty_p. + Change sign of return value. Update all users. + * gimplify.c (tree_annotate_all_with_location): Rename + from tree_annotate_all_with_locus. + (annotate_all_with_location): Rename from + annotate_all_with_locus. + +2008-03-05 Diego Novillo + + * gimple.c (gimple_set_lhs): Remove return keywords. + +2008-03-05 David Daney + + * builtins.c (expand_builtin___clear_cache): Disable call to + validate_arglist. + * config/mips/mips.c (mips_gimplify_va_arg_expr): Tuplify. + +2008-03-05 Bill Maddox + + * tree-ssa-ccp.c (dump_lattice_value, debug_lattice_value): + Re-enable functions #if'd out. + (test_default_value, likely_value, surely_varying_stmt_p, + ccp_initialize, ccp_visit_phi_node, ccp_fold, evaluate_stmt, + visit_assignment, visit_cond_stmt, ccp_visit_stmt): + Convert to tuples. + (fold_gimple_call): Don't trip over call that simplifies to + another call, not a constant. + * tree-ssa-propagate.c (ssa_prop_init): Initialize in-worklist + flag for phi nodes as well as statements. + (valid_gimple_expression_p): Add fixme comment to remove this. + function. It currently has static uses, but asserts when called. + (stmt_makes_single_load, stmt_makes_single_store): + Convert to tuples + (replace_phi_args_in): Convert to tuples. Fix typo in comment. + * gimple.c (gimple_copy_no_def_use, gimple_get_lhs, + gimple_set_lhs): New function. + * gimple.h (gimple_copy_no_def_use, gimple_get_lhs, + gimple_set_lhs): Declare new function. + * tree-cfg.c (replace_uses_by): Add comment regarding empty + operands. + * passes.c (init_optimization_passes): Enable pass_ccp and + pass_store_ccp. + +2008-03-05 David Daney + + * tree-phinodes.c (allocate_phi_node): Fix syntax errors from + previous commit. + +2008-03-05 Rafael Espindola + + * tree-phinodes.c (allocate_phi_node): free free_phinodes[bucket] + if empty. + +2008-03-05 Diego Novillo + + http://gcc.gnu.org/ml/gcc/2008-03/msg00256.html + + * fold-const.c (tree_binary_nonnegative_warnv_p): Fix + invalid C90 declaration. + (tree_single_nonnegative_warnv_p): Likewise. + * gimplify.c (gimplify_bind_expr): Likewise. + (gimplify_return_expr): Likewise. + +2008-03-04 Zdenek Dvorak + + * tree-ssa-loop-niter.c, tree-scalar-evolution.c: Tuplified. + * tree-ssa-loop-manip.c (split_loop_exit_edge): Ditto. + * tree-chrec.c (chrec_fold_plus, chrec_apply, chrec_convert_1, + convert_affine_scev, chrec_convert_rhs, chrec_convert, + chrec_convert_aggressive): Pass statements as gimple. + * tree-scalar-evolution.h (get_loop_exit_condition, simple_iv): + Type changed. + * tree-chrec.h (chrec_convert, chrec_convert_rhs): Ditto. + * tree-ssa-loop-ivopts.c (abnormal_ssa_name_p, + idx_contains_abnormal_ssa_name_p, contains_abnormal_ssa_name_p, + expr_invariant_in_loop_p, tree_int_cst_sign_bit): Enabled. + * gimple-dummy.c (chrec_dont_know, chrec_known, chrec_not_analyzed_yet, + analyze_scalar_evolution, chrec_contains_symbols_defined_in_loop, + estimate_numbers_of_iterations, expr_invariant_in_loop_p, + free_numbers_of_iterations_estimates, + free_numbers_of_iterations_estimates_loop, get_loop_exit_condition, + instantiate_parameters, nowrap_type_p. scev_const_prop. scev_finalize, + scev_initialize, scev_probably_wraps_p, scev_reset, + tree_int_cst_sign_bit, number_of_iterations_exit, loop_niter_by_eval, + substitute_in_loop_info): Removed. + * tree-ssa-loop.c (tree_loop_optimizer_init): Merged into... + (tree_ssa_loop_init): ... here. Enable scev_initialize call. + (tree_ssa_loop_done): Enable scev finalization. + * gimple-iterator.c (gsi_insert_seq_nodes_before): Allow inserting + at the end of basic block. + (gsi_for_stmt): Handle phi nodes. + * cfgloop.h (struct nb_iter_bound): Change type of stmt field to gimple. + * tree-flow.h (scev_probably_wraps_p, convert_affine_scev, + stmt_dominates_stmt_p): Types changed. + * Makefile.in (gt-tree-scalar-evolution.h): Enable. + * gimple.c (extract_ops_from_tree): Export. + (gimple_copy): Do not share bitmaps. + * gimple.h (extract_ops_from_tree): Declare. + (gimple_call_set_lhs): Allow lhs to be NULL. + * tree-cfg.c (add_phi_args_after_copy_edge, + add_phi_args_after_copy_bb): Tuplify. + * passes.c (init_optimization_passes): Enable pass_ch, pass_scev_cprop. + +2008-03-04 Oleg Ryjkov + + * tree-ssa-dse.c (execute_simple_dse): Commented out. + * passes.c (init_optimization_passes): Disabling pass_simple_dse. + +2008-03-04 Bill Maddox + + * tree-cfg.c (remove_useless_stmts_1): + Correctly distinguish try-catch and try-finally. + +2008-03-04 Oleg Ryjkov + + * tree-ssa-dse.c (execute_simple_dse): Tuplified. + * gimplify.c (gimplify_return_expr): Copy the NO_WARNING flag + to the newly created expr from the tree. + * tree-cfg.c (gimplify_build1): Tuplified. + * passes.c (init_optimization_passes): Enabled + pass_warn_function_return, pass_update_address_taken, + pass_simple_dse and pass_build_alias passes. + +2008-03-04 Rafael Espindola + + * fold-const.c (tree_simple_nonnegative_warnv_p): New. + (tree_unary_nonnegative_warnv_p): New. + (tree_binary_nonnegative_warnv_p): New. + (tree_single_nonnegative_warnv_p): New. + (tree_invalid_nonnegative_warnv_p): New. + (tree_expr_nonnegative_warnv_p): Redefine in term of the new functions. + +2008-03-04 Aldy Hernandez + + * gimple.c (walk_gimple_seq): Do not set wi->gsi. + (walk_gimple_stmt): Set wi->gsi. + * tree-cfg.c (verify_stmt): Use walk_gimple_op instead of + walk_gimple_stmt. + (verify_stmts): Same. + +2008-03-04 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00219.html + + * expr.c (expand_expr_real): Call lookup_expr_eh_region. + * tree-eh.c (lookup_stmt_eh_region_fn): + (lookup_stmt_eh_region): Fix comment. + (lookup_expr_eh_region): Handle missing cfun and missing + EH table. + (record_in_finally_tree): Fix comment. + (collect_finally_tree_1): Remove handler for + GIMPLE_SWITCH. + (maybe_record_in_goto_queue): Remove local variable + NEW_IS_LABEL. + Record GIMPLE_GOTOs instead of their label. + (verify_norecord_switch_expr): Retrieve the CASE_LABEL + from the case label expression. + (do_return_redirection): Change sign of assertion. + (lower_try_finally_onedest): Assert that + TF->GOTO_QUEUE[0] contains a GIMPLE statement. + (lower_try_finally_copy): Assert that Q contains a GIMPLE + statement. + (lower_try_finally_switch): Build a new GIMPLE label for + CONT_STMT. + (mark_eh_edge): Tuplify. + (verify_eh_edges): Tuplify. + (tree_can_throw_external): Remove unused function. + (optimize_double_finally): Remove #if 0. + * gimple-pretty-print.c (GIMPLE_NIY): Tidy. + (dump_gimple_resx): Fix format string for + dump_gimple_fmt. + * gimplify.c (gimplify_cleanup_point_expr): Initialize + BODY_SEQUENCE. + * calls.c (emit_call_1): Remove ATTRIBUTE_UNUSED markers. + * cfgexpand.c (gimple_to_tree) : Assign new + expression to T. + : Handle. + Always assign the value from lookup_stmt_eh_region to + ANN->RN. + * tree-cfg.c (start_recording_case_labels): + (recording_case_labels_p): Re-enable. + (get_cases_for_edge): Likewise. + (gimple_verify_flow_info): Re-enable call to + verify_eh_edges. + (gimple_redirect_edge_and_branch): Re-enable handling of + GIMPLE_SWITCH. + (gimple_block_ends_with_call_p): Tuplify. + (struct gimple_cfg_hooks): Enable block_ends_with_call_p + callback. + +2008-03-04 Rafael Espindola + + * fold-const.c (tree_unary_nonzero_warnv_p): New. + (tree_binary_nonzero_warnv_p): New. + (tree_single_nonzero_warnv_p): New. + (tree_expr_nonzero_warnv_p): Redefine using the new functions. + +2008-03-04 Aldy Hernandez + + * gimple.c (walk_gimple_op): Update comment. + (walk_gimple_stmt): Same. + +2008-03-03 Aldy Hernandez + + * cgraphbuild.c (build_cgraph_edges): Use walk_gimple_op instead of + walk_gimple_stmt. + * tree-ssa-alias-warnings.c (find_references_in_function): Same. + * tree-ssa-ccp.c (fold_stmt): Change walk_gimple_stmt call to + walk_gimple_op. + * tree-nrv.c (tree_nrv): Same. + * tree-ssa-alias.c (count_uses_and_derefs): Same. + * cfgexpand.c (discover_nonconstant_array_refs_r): Same. + * tree-nested.c (convert_nonlocal_reference_stmt): Make first + argument a GSI. + (convert_local_reference_op): Same. + (convert_nl_goto_reference): Same. + (convert_tramp_reference_stmt): Same. + (convert_gimple_call): Same. + * tree-inline.c (inline_forbidden_p_stmt): Same. + * tree-ssa.c (execute_early_warn_uninitialized): Change + walk_gimple_stmt call to walk_gimple_op. + * gimple.c (walk_gimple_seq): Pass GSI to walk_gimple_stmt. + (walk_gimple_stmt): Move operand walking code to... + (walk_gimple_op): ...here. + (walk_gimple_stmt): First argument is now a GSI. + * gimple.h: Change walk_stmt_fn argument to a GSI. + (walk_gimple_stmt): Make first argument is a GSI. + (walk_gimple_op): New prototype. + * tree-cfg.c (verify_stmt): Change argument to a GSI. Adjust + accordingly. + +2008-02-29 Zdenek Dvorak + + * tree-ssa-alias.c (is_escape_site): Detect pure/const functions + correctly. + +2008-02-28 Zdenek Dvorak + + * tree-ssa-loop-im.c: Tuplify. + * tree-ssa-loop-manip.c (add_exit_phis_edge, find_uses_to_rename_stmt, + find_uses_to_rename_bb, check_loop_closed_ssa_use, + check_loop_closed_ssa_stmt, verify_loop_closed_ssa): Ditto. + * gimple-dummy.c (rewrite_into_loop_closed_ssa, tree_ssa_lim, + verify_loop_closed_ssa, replace_exp): Removed. + * tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_done): Comment + out scev initialization and finalization. + * gimple-iterator.c (gsi_remove): Rename remove_eh_info to + remove_permanently. Do not free operands if remove_permanently + is false. + (gimple_find_edge_insert_loc): Use gsi_last_bb. + * tree-eh.c (operation_could_trap_p): Factored out of ... + (tree_could_trap_p): ... here. + * tree-ssa-copy.c (replace_exp): Enable. + * tree-flow.h (movement_possibility): Declaration changed. + (operation_could_trap_p): Declare. + * Makefile.in (tree-ssa-loop-im.o): Add pointer-set.h dependency. + (gimple.o): Add FLAGS_H dependency. + * gimple.c: Include flags.h. + (gimple_could_trap_p): New function. + * gimple.h (gimple_could_trap_p): Declare. + * tree-cfg.c (replace_uses_by): Check that op is not null. + * passes.c (init_optimization_passes): Enable pass_lim. + +2008-02-28 Rafael Espindola + + * tree-outof-ssa.c (insert_backedge_copies): Don't build + uninitialized assignment. + +2008-02-28 Rafael Espindola + + * tree-dfa.c (dump_dfa_stats): cast dfa_stats.max_num_phi_args to long. + +2008-02-26 Diego Novillo + + * tree-ssa-copyrename.c (rename_ssa_copies): Do not mix + declarations with code. + * tree-ssa-coalesce.c (create_outofssa_var_map): Likewise. + * tree-dfa.c (dump_dfa_stats): Use %ld for + dfa_stats.max_num_phi_args. + +2008-02-26 Bill Maddox + + * tree-ssa-ccp.c (maybe_fold_stmt_addition): + Reinstated this function for tuples as-is. + (valid_gimple_rhs_p): New function. Mostly lifted from + valid_gimple_epxression_p, which is likely obsolete. + (fold_stmt_r): Reinstated commented-out cases for + tuples. Replaced call to obsolete function set_rhs. + (get_maxval_strlen): Convert to tuples. + (ccp_fold_builtin): Partial conversion to tuples. + (fold_gimple_assign): New function. + (fold_gimple_cond): New function. + (fold_gimple_call): New function. + (fold_stmt): Convert to tuples. + (fold_stmt_inplace): Convert to tuples. + * tree-ssa-propagate.c (substitute_and_fold): + Update call to fold_stmt for revised argument signature. + * gimple-dummy.c (fold_stmt): Removed dummy definition. + * gimplify.c (gimplify_call_expr): Removed obsolete + manipulation of TREE_NOTHROW flag. + * cfgexpand.c (gimple_to_tree): Set nothrow flag + of call expression based on call statement flags. + Handle GIMPLE_NOP statement. + * tree-flow.h (notice_special_calls, fold_stmt): + Update prototypes for tuples. + * gimple.c (gimple_cond_set_condition_from_tree): + New function. + (gimple_seq_has_side_effects): New function. + * gimple.h (gimple_cond_set_condition_from_tree, + gimple_seq_has_side_effects): New prototypes. + (gimple_call_nothrow_p): New function. + (gsi_stmt_ptr): Add comment regarding usage of this + function vs. gsi_replace. + * tree-cfg.c (struct rus_data): Convert to tuples. + (remove_useless_stmts_1, remove_useless_stmts_warn_notreached, + remove_useless_stmts_cond, remove_useless_stmts_tf, + remove_useless_stmts_tc, remove_useless_stmts_goto, + remove_useless_stmts_label, notice_special_calls, + remove_useless_stmts): Convert to tuples. + (update_call_expr_flags): Removed. + * passes.c (init_optimization_passes): Enable + pass_remove_useless_stmts. + +2008-02-25 Bill Maddox + + * tree-into-ssa.c (rewrite_initialize_block): + Avoid declaration following statement in block. + * tree-nrv.c (tree_nrv): + Avoid declaration following statement in block. + * tree-eh.c (collect_finally_tree): Fix typo in comment. + Avoid cast to union type. + (replace_goto_queue_cond_clause, replace_goto_queue_1, + maybe_record_in_goto_queue, verify_norecord_switch_expr, + lower_try_finally_fallthru_label): Avoid cast to union type. + * fortran/Make-lang.in: Add -Wno-missing-format-attribute + to fortran-warn options to avoid conflict with -Wno-format. + * gimplify.c (gimplify_switch_expr): Change assignment + to initialiation. + (gimplify_case_label_expr): Avoid declaration following + statement in block. + * tree-ssa-coalesce.c (create_outofssa_var_map): Avoid + declaration following statement in block. + * tree-ssa.c (ssa_redirect_edge, flush_pending_stmts): + Avoid declaration following statements in block. + * Makefile.in: Add -Wno-missing-format-attribute + to builtins.o-warn and expr.o-warn options to avoid conflict + with -Wno-format. Removed fortran/*-warn options, -Wno-format + and -Wno-uninitialized, which belong in fortran/Make-lang.in, + and are applied to all fortran files there. + +2008-02-25 Oleg Ryjkov + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01236.html + + * tree-ssa-copyrename.c: Include gimple.h + Tuplify. + * tree-ssa.c (warn_uninit): Pass &LOCUS to warning(). + * passes.c (init_optimization_passes): Enable + pass_early_warn_uninitialized, pass_rebuild_cgraph_edges + and pass_early_inline. + +2008-02-25 Diego Novillo + + * Makefile.in (tree-ssa-copyrename.o): Add dependency on + gimple.h. + +2008-02-25 Diego Novillo + + * tree-cfgcleanup.c (tree_forwarder_block_p): Revert + previous change. + +2008-02-25 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01217.html + + * tree-ssa-alias-warnings.c: Tuplify. + * cgraphunit.c (cgraph_process_new_functions): Remove + calls to gimple_unreachable. + (cgraph_expand_function): Likewise. + * omp-low.c (execute_expand_omp): Return 0 after call to + gimple_unreachable. + * tree-scalar-evolution.c (scev_const_prop): Likewise. + (execute_lower_omp): Likewise. + * tree-ssa-dse.c (execute_simple_dse): Likewise. + * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. + (eliminate_degenerate_phis): Likewise. + * tree-ssa-propagate.c (get_rhs): Likewise. + (valid_gimple_expression_p): Likewise. + (set_rhs): Likewise. + (fold_predicate_in): Likewise. + * tree-nrv.c (execute_return_slot_opt): Likewise. + * predict.c (tree_estimate_probability): Likewise. + * tree-parloops.c (parallelize_loops): Likewise. + * tree-if-conv.c (main_tree_if_conversion): Likewise. + * tree-ssa-phiopt.c (tree_ssa_phiopt): Likewise. + (tree_ssa_cs_elim): Likewise. + * tree-sra.c (tree_sra): Likewise. + (tree_sra_early): Likewise. + * tree-predcom.c (tree_predictive_commoning): Likewise. + * tree-ssa-copy.c (execute_copy_prop): Likewise. + * lambda-code.c (gcc_loop_to_lambda_loop): Likewise. + (perfect_nest_p): Likewise. + (can_convert_to_perfect_nest): Likewise. + (perfect_nestify): Likewise. + * tree-optimize.c (execute_fixup_cfg): Likewise. + * tree-object-size.c (compute_object_sizes): Likewise. + * tree-cfg.c (remove_useless_stmts): Likewise. + (gimple_duplicate_sese_tail): Likewise. + (move_sese_region_to_fn): Likewise. + (gimple_purge_dead_abnormal_call_edges): Likewise. + (execute_warn_function_return): Likewise. + * value-prof.c (gimple_histogram_value): Remove calls to + gimple_unreachable. + (gimple_stringop_fixed_value): Likewise. + * tree-flow-inline.h (op_iter_next_use): Likewise. + * tree-dfa.c (dump_variable): Likewise. + * tree-ssa-copy.c (may_propagate_copy): Likewise. + (may_propagate_copy_into_asm): Likewise. + (merge_alias_info): Likewise. + (replace_exp_1): Likewise. + * tree-ssa.c (delete_tree_ssa): Likewise. + * tree-cfg.c (make_edges): Likewise. + (remove_useless_stmts): Likewise. + (gimple_duplicate_sese_tail): Likewise. + (move_sese_region_to_fn): Likewise. + (gimple_purge_dead_abnormal_call_edges): Likewise. + (execute_warn_function_return): Likewise. + * passes.c (finish_optimization_passes): Likewise. + (init_optimization_passes): Likewise. + * tree-ssa-operands.c (add_call_clobber_ops): Likewise. + * tree-eh.c (lookup_expr_eh_region): New. + (tree_can_throw_external): Return false after call to + gimple_unreachable. + (maybe_clean_or_replace_eh_stmt): Re-enable. + Call stmt_could_throw_p. + * expr.c (expand_expr_real): Call lookup_expr_eh_region. + * profile.c: Tuplify. + * calls.c: Include tree-flow.h. + (emit_call_1): Call lookup_expr_eh_region. + (expand_call): Likewise. + * cfgexpand.c (gimple_to_tree): Call SET_EXPR_LOCATION on + generated expression tree T. + Set EH region number on T's annotation. + * common.opt (fgimple-conversion=): Add RejectNegative + and Joined attributes. + * tree-inline.c (unsave_r): Abort if *TP is a + STATEMENT_LIST. + (unsave_expr_now): Re-enable. + * tree-flow.h (struct tree_ann_common_d): Add field RN. + * Makefile.in (builtins.o-warn): Add -Wno-format. + (expr.o-warn): Likewise. + (fortran/check.o-warn): Likewise. + (fortran/interface.o-warn): Likewise. + (fortran/resolve.o-warn): Likewise. + (fortran/simplify.o-warn): Likewise. + (fortran/target-memory.o-warn): Likewise. + (calls.o): Add dependency on tree-flow.h + * gimple.c (gimple_build_asm_1): Call ggc_alloc_string to + copy STRING. + * gimple.h (gimple_filename): New. + (gimple_lineno): New. + * passes.c (init_optimization_passes): Disable + pass_remove_useless_stmts pass_mudflap_1, + pass_warn_function_return and pass_lower_omp. + * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Tuplify. + (rs6000_alloc_sdmode_stack_slot): Likewise. + * tree-cfgcleanup.c (tree_forwarder_block_p): Fix test + for PHI_WANTED. + +2008-02-25 Rafael Espindola + + * tree-cfgcleanup.c (tree_forwarder_block_p): fix thinko. + +2008-02-24 Rafael Espindola + + * gimple-iterator.c (gsi_split_seq_before): Don't abort if at the + beginning. + +2008-02-23 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01025.html + + * gimplify.c (gimplify_one_sizepos): Call gimplify_expr with + STMT_P. + +2008-02-22 Zdenek Dvorak + + * gimple.c (gimple_assign_copy_p): Do not consider unary operations + to be copies. + +2008-02-22 Diego Novillo + + * Makefile.in (fortran/parse.o-warn, + fortran/simplify.o-warn): New. + +2008-02-22 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00961.html + + Revert + + 2008-02-20 Zdenek Dvorak + + * tree-tailcall.c: Tuplify. + * gimplify.c (force_gimple_operand): Remove ATTRIBUTE_UNUSED. + * gimple.c (gimple_assign_copy_p): Do not + consider unary operations to be copies. + (copy_or_nop_cast_stmt_rhs): New. + * gimple.h (copy_or_nop_cast_stmt_rhs): Declare. + +2008-02-21 Rafael Espindola + + * gimple.h (gimple_cond_true_p): Define. + (gimple_cond_false_p): Define. + (gimple_cond_single_var_p): Define. + +2008-02-21 Rafael Espindola + + * tree-tailcall.c (adjust_accumulator_values): Check that a phi was + found. + +2008-02-21 Rafael Espindola + + * tree-tailcall.c (adjust_accumulator_values): Initialize phi. + +2008-02-20 Zdenek Dvorak + + * tree-tailcall.c: Tuplify. + * gimplify.c (force_gimple_operand): Remove ATTRIBUTE_UNUSED. + * gimple.c (gimple_assign_copy_p): Do not consider unary operations + to be copies. + (copy_or_nop_cast_stmt_rhs): New. + * gimple.h (copy_or_nop_cast_stmt_rhs): Declare. + +2008-02-20 Oleg Ryjkov + + * gimplify.c (gimplify_expr): Save locus into the right + sequence. + +2008-02-20 Rafael Espindola + + * passes.c (init_optimization_passes): Enable pass_mark_used_blocks + and pass_cleanup_cfg_post_optimizing. + * tree-optimize.c (execute_cleanup_cfg_post_optimizing): call cleanup_tree_cfg. + +2008-02-20 Rafael Espindola + + * passes.c (init_optimization_passes): Enable pass_nrv. + * tree-nrv.c (finalize_nrv_r): data is now a walk_stmt_info. + (tree_nrv): port to gimple. + +2008-02-19 Oleg Ryjkov + + * gimple-pretty-print.c: Introduce support for TDF_RAW + flag. + (dump_gimple_fmt): New function. + (dump_gimple_assign, dump_gimple_return): Update to print + RAW gimple. + (dump_gimple_call_args): New function. + (dump_gimple_call, dump_gimple_switch, dump_gimple_cond, + dump_gimple_label, dump_gimple_bind, dump_gimple_try): + Update to print RAW gimple. + (dump_gimple_catch, dump_gimple_eh_filter, + dump_gimple_resx): New functions. + (dump_gimple_omp_for, dump_gimple_asm, dump_gimple_phi): + Update to print RAW gimple. + (dump_gimple_omp_parallel, dump_gimple_omp_atomic_load, + dump_gimple_omp_atomic_store): New, code moved from + dump_gimple_stmt, then added support to print RAW gimple. + (gimple_dump_stmt): Some code refactored into helper + subroutines. + * tree-cfg.c(dump_function_to_file): Print RAW gimple when + TDF_RAW is set. + +2008-02-19 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00793.html + + * tree-complex.c (expand_complex_div_wide): Call gsi_bb. + * tree.h (std_gimplify_va_arg_expr): Change gimple_seq + arguments to gimple_seq *. + Update all users. + (gimplify_parameters): Change return type to gimple_seq. + Update all users. + * target.h (struct gcc_target): + Change gimple_seq arguments to gimple_seq *. + Update all users. + * tree-phinodes.c (free_phinodes): Convert to VEC. + Update all users. + * omp-low.c (lower_rec_input_clauses): Change gimple_seq + arguments to gimple_seq *. Update all users. + (lower_reduction_clauses): Convert sub_list to + gimple_seq. + (lower_regimplify): Convert PRE to gimple_seq. + (lower_regimplify): Call gimple_seq_insert_before instead + of tsi_link_before. + * tree-gimple.h (get_initialized_tmp_var, + get_formal_tmp_var, gimplify_expr, gimplify_type_sizes, + gimplify_one_sizepos, gimplify_stmt, gimplify_and_add, + gimplify_va_arg_expr): Change gimple_seq arguments to + gimple_seq *. Update all users. + * gimple-iterator.c: Include value-prof.h. + (gsi_link_seq_before): Remove. Update all users. + (gsi_link_seq_after): Remove. Update all users. + (gsi_link_after): Remove. Update all users. + (gsi_link_before): Remove. Update all users. + (update_bb_for_stmts): New. + (gsi_insert_seq_nodes_before): New. + (gsi_insert_seq_nodes_after): New. + (gsi_insert_seq_before): Re-write. Call + gsi_insert_seq_nodes_before. + (gsi_insert_seq_after): Re-write. Call + gsi_insert_seq_nodes_after. + (gsi_replace): Re-enable EH updating. + (update_modified_stmt): Move earlier in the file. + (gsi_insert_after): Re-write. Call + gsi_insert_seq_nodes_after. + (gsi_insert_before): Re-write. Call + gsi_insert_seq_nodes_before. + (gsi_remove): Move from gimple.h. Re-write. + * langhooks.h (struct lang_hooks): Change gimple_seq + arguments for gimplify_expr to gimple_seq *. + Update all users. + * coretypes.h (struct gimple_seq_d): Rename from struct + gimple_sequence. Update all users. + (struct gimple_seq_node_d): New. + (gimple_seq_node): New. + (const_gimple_seq_node): New. + * tree-flow.h (force_gimple_operand): Change gimple_seq + argument to gimple_seq *. Update all users. + * c-common.h (c_gimplify_expr): Change gimple_seq + argument to gimple_seq *. Update all users. + * Makefile.in (build): + * gimple.c (gimple_seq_cache): New. + (gimple_seq_alloc): Take sequences from gimple_seq_cache, + if possible. + (gimple_seq_free): New. + (gimple_seq_add_stmt): Rename from gimple_seq_add. + Change gimple_seq argument to gimple_seq *. Update all users. + (gimple_seq_add_seq): Rename from gimple_seq_append. + Update all users. + (gimple_remove): Remove. Update all users. + (gimple_seq_reverse): Remove unused function. + (gimple_set_bb): Only update block-to-labels map if + CFUN->CFG exists. + * gimple.h (struct gimple_seq_node_d): New. + (struct gimple_seq_d): Change fields 'first' and 'last' + to type gimple_seq_node. Update all users. + Add field 'next_free'. + (gimple_seq_first): Change return type to + gimple_seq_node. Update all users. + (gimple_seq_first_stmt): New. + (gimple_seq_last): Change return type to gimple_seq_node. + Update all users. + (gimple_seq_last_stmt): New. + (gimple_seq_set_first): Change second argument to type + gimple_seq_node. Update all users. + (gimple_seq_set_last): Change second argument to type + gimple_seq_node. Update all users. + (gimple_seq_init): Remove. Update all users. + (struct gimple_statement_base): Remove field 'next' and + 'prev'. Update all users. + (struct gimple_statement_omp): Change fields of type + struct gimple_sequence to type gimple_seq. Update all + users. + (struct gimple_statement_bind): Likewise. + (struct gimple_statement_catch): Likewise. + (struct gimple_statement_eh_filter): Likewise. + (struct gimple_statement_try): Likewise. + (struct gimple_statement_wce): Likewise. + (struct gimple_statement_omp_for): Likewise. + (gimple_set_prev): Remove. Update all users. + (gimple_set_next): Remove. Update all users. + (gimple_next): Remove. Update all users. + (gimple_prev): Remove. Update all users. + (gimple_seq_bb): New. + (gimple_catch_handler_ptr): New. + (gimple_stmt_iterator): Remove field 'stmt'. + Add field 'ptr'. Update all users. + (gsi_remove): Move to gimple-iterator.c + * tree-cfg.c (pass_build_cfg): Re-enable PROP_gimple_leh. + * Makefile.in (builtins.o-warn, expr.o-warn, dse.o-warn, + ebitmap.o-warn, lower-subreg.o-warn, tree-chrec.o-warn): + Change -Wno-error to -Wno-uninitialized. + +2008-02-19 Rafael Espindola + + * tree-eh.c (collect_finally_tree): handle GIMPLE_SWITCH. + +2008-02-19 Aldy Hernandez + + * gimple.h (gimple_cond_invert): Remove prototype. + (update_stmt_if_modified): Fix typo in comment. + * gimple.c (walk_gimple_asm): Fix typo in comment. + +2008-02-13 Bill Maddox + + * tree-inline.c (estimate_operator_cost): + Removed operators superseded by tuplified statement forms. + Small cosmetic reordering of a few switch cases. + +2008-02-13 Oleg Ryjkov + + * tree.h: New function declaration. + * gimple-dummy.c (tree_inlinable_function_p): Removed. + * ipa-inline.c (compute_inline_parameters): Removed + gcc_unreachable (). + * calls.c (gimple_alloca_call_p): New function. + * tree-inline.c (inline_forbidden_p_1): Split in two and removed. + (inline_forbidden_p_op, inline_forbidden_p_stmt): New functions. + (inline_forbidden_p): Tuplified. + (estimate_operator_cost): Added missing cases. + * passes.c (init_optimization_passes): Enabled pass_inline_parameters, + pass_ipa_function_and_variable_visibility, pass_ipa_early_inline, + pass_inline_parameters, pass_rebuild_cgraph_edges passes. + +2008-02-13 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00459.html + + * gimple.def (GIMPLE_TRY): Tidy comment. + * gimple-pretty-print.c (dump_gimple_stmt): Handle TDF_VOPS and + TDF_MEMSYMS. + +2008-02-13 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00455.html + + * tree-complex.c (update_complex_components): Handle + GIMPLE_CALL and GIMPLE_ASSIGN. + (expand_complex_libcall): Set SSA_NAME_DEF_STMT on LHS. + * tree-ssa-operands.c (maybe_add_call_clobbered_vops): + Rename from get_call_expr_operands. Update all users. + Convert to handle GIMPLE_CALL instead of CALL_EXPR. + (get_modify_stmt_operands): Remove. Update all users. + (get_expr_operands): Do not handle CALL_EXPR, COND_EXPR, + VEC_COND_EXPR, GIMPLE_MODIFY_STMT, BLOCK, EXC_PTR_EXPR + and FILTER_EXPR. + (parse_ssa_operands): Call maybe_add_call_clobbered_vops + after parsing operands if STMT is a GIMPLE_CALL. + +2008-02-12 Zdenek Dvorak + Bill Maddox + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00429.html + + * tree-inline.h (estimate_num_insns_fn): Declare. + * cgraphunit.c (cgraph_process_new_functions): + Use estimate_num_insns_fn. + * ipa-inline.c (compute_inline_parameters): Ditto. + * gimple-dummy.c (estimate_move_cost, estimate_num_insns): + Removed. + * tree-inline.c (struct eni_data, estimate_num_insns_1): + Removed. + (estimate_num_insns): Rewritten. + (operation_cost, estimate_num_insns_fn): New functions. + * gimple.c (gimple_copy): Unshare operands. Update + operand caches. + * gimple.h (gimple_set_no_warning): New. + (gimple_cond_set_true_label, gimple_cond_set_false_label): + Allow setting the label to NULL. + * tree-ssa-operands.c (copy_virtual_operands): Handle statements + without virtual operands. + +2008-02-12 Zdenek Dvorak + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00429.html + + * tree-into-ssa.c (update_ssa): Remove ATTRIBUTE_UNUSED. + * tree-ssa-loop-ch.c: Tuplified. + * gimple-iterator.c (gsi_commit_one_edge_insert): Ditto. + * tree-cfg.c (gimple_redirect_edge_and_branch, + gimple_try_redirect_by_replacing_jump, gimple_merge_blocks, + gimple_block_label, gimple_redirect_edge_and_branch_force, + gimple_duplicate_bb): Ditto. + (make_cond_expr_edges): Remove the labels. + (cleanup_dead_labels): Handle conditions without labels. + (gimple_make_forwarder_block): Do not reverse the list + of phi nodes. + (gimple_duplicate_sese_region): Enable ssa updates. + (gimple_cfg_hooks): Enable edge redirection and bb duplication. + * gimple-pretty-print.c (dump_gimple_cond): Do not dump + branches if labels are null. + (dump_implicit_edges): Dump implicit GIMPLE_COND edges. + +2008-02-12 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00429.html + + * tree-vrp.c (range_includes_zero_p): Partially re-enable. + (ssa_name_nonnegative_p): Partially re-enable. + (ssa_name_nonzero_p): Likewise. + * gimple-dummy.c (ssa_name_nonzero_p): Remove. + (ssa_name_nonnegative_p): Remove. + * tree-cfg.c (gimple_split_block): Convert to tuples. + +2008-02-12 Aldy Hernandez + + Merge with mainline @132177 + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2008-02-08 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00273.html + + * gimplify.c (gimplify_call_expr): Remove code to set + TREE_SIDE_EFFECTS. + * gimple.c (gimple_has_side_effects): New. + * gimple.h (gimple_has_side_effects): Declare. + * tree-cfg.c (stmt_can_make_abnormal_goto): Call. + +2008-02-07 Diego Novillo + + * gimple.h (gimple_call_num_args): Rename from + gimple_call_nargs. Update all users. + +2008-02-07 Aldy Hernandez + + * gimplify.c: Remove various FIXMEs that have been resolved. + +2008-02-06 Aldy Hernandez + + * gimple.def: Add GIMPLE_OMP_ATOMIC_{LOAD,STORE} entires. + * gsstruct.def: Add GSS_OMP_ATOMIC_{LOAD,STORE} entries. + * gimple-pretty-print.c (dump_gimple_stmt): Add case for + GIMPLE_OMP_ATOMIC_{LOAD,STORE}. + * gimplify.c (gimplify_omp_atomic): Enable and convert to tuples. + * tree.def: Add FIXME notes. + * gimple.c (gss_for_code): Add cases for + GIMPLE_OMP_ATOMIC_{LOAD,STORE}. + (gimple_size): Same. + (gimple_build_omp_atomic_load): New. + (gimple_build_omp_atomic_store): New. + * gimple.h (struct gimple_statement_omp_atomic_{load,store}): New. + (union gimple_statement_d): Add gimple_omp_atomic_{load,store}. + (gimple_omp_atomic_store_set_val): New. + (gimple_omp_atomic_store_val): New. + (gimple_omp_atomic_load_set_lhs): New. + (gimple_omp_atomic_load_lhs): New. + (gimple_omp_atomic_load_set_rhs): New. + (gimple_omp_atomic_load_rhs): New. + * tree-cfg.c (verify_types_in_gimple_seq_2): Add cases for + GIMPLE_OMP_ATOMIC_{LOAD,STORE}. + +2008-02-05 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00161.html + + * gimple-iterator.c (gsi_split_seq_after): Change + argument type to gimple_stmt_iterator. Update all users. + (gsi_for_stmt): Return gimple_stmt_iterator. Update all users. + (gimple_find_edge_insert_loc): Change GSI argument to + gimple_stmt_iterator. Update all users. + * gimple.c (gimple_seq_deep_copy): Change argument to gimple_seq. + Update all users. + * gimple.h (gsi_alloc): Remove. Update all users. + (gsi_start): Return gimple_stmt_iterator. Update all users. + (gsi_start_bb): Likewise. + (gsi_last): Likewise. + (gsi_last_bb): Likewise. + (gsi_end_p): Change argument to gimple_stmt_iterator. + Update all users. + (gsi_one_before_end_p): Likewise. + (gsi_stmt): Likewise. + (gsi_bb): Likewise. + (gsi_seq): Likewise. + (gsi_split_seq_after): Likewise. + (gsi_for_stmt): Likewise. + (gsi_after_labels): Return gimple_stmt_iterator. Update all users. + +2008-02-05 Aldy Hernandez + + * gimple-pretty-print.c (dump_gimple_stmt): Print clauses for + GIMPLE_OMP_PARALLEL. + Handle GIMPLE_OMP_FOR. + (dump_gimple_omp_for): New. + * tree-pretty-print.c (dump_omp_clauses): Remove static. + * diagnostic.h (dump_omp_clauses): Add prototype. + * gimplify.c (gimplify_omp_for): Convert to tuples and enable. + (gimplify_omp_workshare): Same. + (gimplify_expr) [OMP_MASTER, OMP_ORDERED, OMP_CRITICAL]: Same. + +2008-02-04 Oleg Ryjkov + + * tree-gimple.c (get_gimple_rhs_class): Handle + FILTER_EXPR. + * tree-eh.c (union treemple): Declare. + Convert to tuples. + * except.c: + * except.h (lang_protect_cleanup_actions): Change return + type to 'gimple'. Update all users. + * tree-inline.c (count_insns_seq): New. + * tree-inline.h (count_insns_seq): Declare. + * gimple.c (gimple_seq_deep_copy): New. + * gimple.h (gimple_seq_deep_copy): Declare. + (gimple_singleton_p): New. + * passes.c (init_optimization_passes): Enable + pass_lower_eh. + +2008-02-02 Aldy Hernandez + + * tree.h (OMP_CLAUSE_REDUCTION_GIMPLE_INIT): New. + (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE): New. + (struct tree_omp_clause): Add gimple_reduction_{init,merge} fields. + * gimplify.c (gimplify_scan_omp_clauses): Gimplify reduction + init/merge fields into separate sequences. + (gimplify_and_add): Use gimplify_expr directly. + * omp-low.c (lower_rec_input_clauses): Extract reduction info from + gimple tuples in structure. + (lower_reduction_clauses): Same. + +2008-02-01 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00036.html + + * tree-complex.c (expand_complex_comparison): Set the RHS + of the new comparison to boolean_true_node. + * gimplify.c (gimplify_call_expr): Fix creation of new + GIMPLE_CALL. Create the vector of arguments in the same + order as the original expression. + +2008-02-01 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00032.html + + * tree-pas.h (struct tree_opt_pass): Remove field + WORKS_WITH_TUPLES_P. Adjust all users. + * opts.c (decode_options): Force -O0. + * cfgexpand.c (gimple_to_tree): Handle GIMPLE_RETURN, + GIMPLE_ASM, GIMPLE_CALL and GIMPLE_SWITCH. + Show unrecognized tuple when failing. + (expand_gimple_basic_block): Do not use + gimple_stmt_iterator to go through the statements in BB. + Handle GIMPLE_CALL instead of CALL_EXPR. + (gimple_expand_cfg): Rename from tree_expand_cfg. Update + all users. + Remove PROP_gimple_leh. + * gimple.c (walk_gimple_seq): Guard against WI == NULL. + * tree-cfg.c (execute_warn_function_return): Move #if 0 + markers. + * passes.c (init_optimization_passes): Adjust #if 0 + markers to execute pass_expand. + Guard more passes under #if 0. + +2008-02-01 Rafael Espindola + + * passes.c (init_optimization_passes): Enable pass_del_ssa. + + * tree-outof-ssa.c (insert_copy_on_edge): Port to tuples. + (eliminate_build): Likewise. + (eliminate_virtual_phis): Likewise. + (rewrite_trees): Likewise. Remove stmt_ann_t ann. + (stmt_list): Changed from tree to gimple_seq. + (identical_copies_p): Port to tuples. + (identical_stmt_lists_p): Likewise. + (init_analyze_edges_for_bb): Likewise. + (fini_analyze_edges_for_bb): Likewise. + (process_single_block_loop_latch): Likewise. + (analyze_edges_for_bb): LIkewise. + (remove_ssa_form): Likewise. + (insert_backedge_copies): + (rewrite_out_of_ssa):Likewise. + (pass_del_ssa): flip works_with_tuples_p. Don't require PROP_alias. + + * tree-ssa-coalesce.c (build_ssa_conflict_graph): Port to tuples. + (abnormal_corrupt): Port to tuples. + (fail_abnormal_edge_coalesce): Port to tuples. + (create_outofssa_var_map):Port to tuples. + (coalesce_partitions): Port to tuples. + +2008-02-01 Rafael Espindola + + * tree-ssa-operands.c (free_stmt_operands): Only free + with_ops.addresses_taken if stmt has ops. + +2008-01-31 Rafael Espindola + + * tree-optimize.c (pass_free_cfg_annotations): Flip + works_with_tuples_p. + * passes.c (init_optimization_passes): Enable + pass_free_cfg_annotations. + +2008-01-30 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01461.html + + * tree-into-ssa.c (compute_global_livein): Initialize + PHI with call to gsi_stmt. + (rewrite_update_init_block): Likewise. + * tree-complex.c (expand_complex_comparison): Initialize + TYPE. + (expand_complex_operations_1): Initialize BR and BI. + * ebitmap.h (ebitmap_iter_init): Initialize OURN. + * Makefile.in (dse.o-warn, ebitmap.o-warn, + lower-subreg.o-warn, tree-chrec.o-warn, varasm.o-warn): + New. + +2008-01-30 Rafael Espindola + + * gimplify.c (gimplify_scan_omp_clauses): Comment out + pop_gimplify_context calls + +2008-01-30 Rafael Espindola + + * gimple.h (gsi_after_labels): Add. + +2008-01-30 Rafael Espindola + + * Makefile.in (tree-complex.o): Uncomment gt-tree-vect-generic.h. + (GTFILES): Add tree-vect-generic.c. + * passes.c (init_optimization_passes): Enable pass_lower_vector. + * tree-vect-generic.c: uncomment all the file. + (elem_op_func): Use gimple_stmt_iterator instead of + block_stmt_iterator. + (tree_vec_extract): Likewise. Rename bsi to gsi. + (do_unop): Likewise. + (do_binop): Likewise. + (do_plus_minus): Likewise. + (do_negate): Likewise. + (expand_vector_piecewise): Likewise. + (expand_vector_parallel): Likewise. + (expand_vector_addition): Likewise. + (expand_vector_operation): Likewise. Remove "tree rhs" param. Add + "gimple assign" param. Use gimple_assign_rhs1|2 instead of + TREE_OPERAND. + (expand_vector_operations_1): Use gimple_stmt_iterator instead of + block_stmt_iterator. Rename bsi to gsi. Use gsi_stmt instead of + bsi_stmt. Use gimple_assign_* instead of GIMPLE_STMT_OPERAND. Use + gimple_assign_set_rhs_from_tree instead of setting *p_rhs. + (gate_expand_vector_operations): Use gimple_stmt_iterator instead + of block_stmt_iterator. Use gsi_* instead of bsi_* + (pass_lower_vector): flip works_with_tuples_p + (pass_lower_vector_ssa) flip works_with_tuples_ + +2008-01-29 Rafael Espindola + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01434.html + + * gimple.c (gimple_assign_set_rhs_with_ops): Fix + allocation of operand vector. + +2008-01-29 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01434.html + + * tree-into-ssa.c (prepare_block_for_update): Initialize + PHI. + * tree.c (build_gimple_modify_stmt): Fix documentation. + + * tree-complex.c: Convert to tuples. + (pass_lower_complex_O0): Re-enable. + + * ipa-cp.c (constant_val_insert): Disable. + * tree-gimple.c (get_gimple_rhs_class): Handle SSA_NAME. + + * tree-ssa-propagate.c: Fix documentation to refer to + prop_simulate_again_p. + (add_ssa_edge): Call prop_simulate_again_p. + (simulate_stmt): Likewise. + (simulate_block): Fix loop iterating over PHI nodes. + * tree-ssa-propagate.h (prop_set_simulate_again): New. + (prop_simulate_again_p): New. + * gimple-iterator.c (gsi_insert_seq_after): Re-write to + avoid use of gimple_stmt_iterator. + (gimple_find_edge_insert_loc): Move from tree-cfg.c. + Re-enable. + (gsi_commit_edge_inserts): Likewise. + (gsi_commit_one_edge_insert): Likewise. + (gsi_insert_on_edge): Likewise. + (gsi_insert_on_edge_immediate): Likewise. + (gsi_insert_seq_on_edge): New. + * gimplify.c (gimplify_cond_expr): Call + gimple_cond_get_ops_from_tree. + * tree-optimize.c (pass_all_optimizations): Enable. + * gimple.c (gimple_cond_get_ops_from_tree): New. + (gimple_build_cond_from_tree): New. + * basic-block.h (struct edge_def): Replace field + edge_def_insns.t with gimple_seq edge_def_insns.g. + Update all users. + * gimple.h (gimple_stmt_iterator): + * tree-cfg.c (change_bb_for_stmt): + * passes.c (init_optimization_passes): Move #if0 around + to disable passes in groups instead of individually. + (execute_function_todo): Re-enable call to update_ssa. + +2008-01-25 Aldy Hernandez + + * gimple-pretty-print.c (dump_gimple_stmt): Handle + GIMPLE_OMP_PARALLEL. + * gimplify.c (pop_gimplify_context): Add comment. + (gimplify_and_return_first): New. + (gimplify_scan_omp_clauses): Remove unused 'gs'. + Remove #if 0. + (gimplify_omp_parallel): Convert to tuples. + (gimplify_omp_workshare): Remove redundant retval. + (gimplify_expr): Adapt to lack of retval for gimplify_omp_variable and + gimplify_omp_workshare. + Abort on OMP_ATOMIC_{LOAD,STORE} case. + +2008-01-21 Diego Novillo + + Merge with mainline @131695 + + * configure.ac (ACX_PKGVERSION): Update revision merge + string. + * configure: Regenerate. + +2008-01-15 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00674.html + + * tree-into-ssa.c (mark_def_sites): Force operand scan. + * gimple.def (GIMPLE_ASSIGN): Move into section of + statements with memory operands. + * gimple-dummy.c (remove_unused_locals): Remove. + * tree-flow-inline.h (noreturn_call_p, + mark_stmt_modified, update_stmt, update_stmt_if_modified, + stmt_modified_p): Remove. + * tree-ssa-live.c: Convert to tuples. + * gimple.c (gimple_set_modified): Replace + mark_stmt_modified. Update all callers. + (gimple_remove): Call free_stmt_operands. + * gimple.h: Include tree-ssa-operands.h + Move extern function declarations earlier in the file. + (GIMPLE_CHECK2): Remove. + (GIMPLE_RANGE_CHECK): Remove. + (struct gimple_statement_with_ops): Fix GTY markers. + (struct gimple_statement_with_memory_ops): Likewise. + (gimple_modified_p): Replace stmt_modifed_p. Update all + users. + (update_stmt): Move from tree-flow-inline.h. Update all + users. + (update_stmt_if_modified): Likewise. + (gimple_has_ops): Use range GIMPLE_COND ... GIMPLE_RETURN + (gimple_has_mem_ops): Use range GIMPLE_ASSIGN ... GIMPLE_RETURN + (gimple_num_ops): Call gimple_has_ops. + (gimple_ops): Likewise. + (gimple_op): Likewise. + (gimple_op_ptr): Likewise. + (gimple_set_op): Likewise. + (gimple_set_addresses_taken): Remove. Update all users. + (gimple_add_to_addresses_taken): Likewise. + (gimple_call_noreturn_p): Replace noreturn_call_p. + Update all users. + (gimple_phi_arg): Assert that INDEX is smaller than + CAPACITY. + * passes.c (init_optimization_passes): Enable + pass_referenced_vars, pass_reset_cc_flags and pass_build_ssa. + * tree-ssa-operands.c (gimple_set_stored_syms): Do not + free the STORES field if SYMS is empty. + (gimple_set_loaded_syms): Likewise. + (finalize_ssa_stmt_operands): Only call + finalize_ssa_vdefs and finalize_ssa_vuses if STMT has + memory operands. + (get_expr_operands): Handle CASE_LABEL_EXPR. + (free_stmt_operands): Free bitmaps ADDRESSES_TAKEN, + STORES and LOADS. + (gimple_add_to_addresses_taken): Rename from + add_to_addressable_set. + +2008-01-14 Aldy Hernandez + + * tree-dfa.c (dump_dfa_stats): Add %z modifier to size_t argument. + +2008-01-11 Andrew MacLeod + Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00493.html + + * tree.h (struct ssa_use_operand_d): Replace field STMT + with a union field LOC containing the fields STMT and + SSA_NAME. + Update all users. + * tree-flow.h (struct immediate_use_iterator_d): Document + how immediate use iteration works. + +2008-01-10 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00444.html + + * Makefile.in (tree-complex.o): Remove gt-tree-vect-generic.h + +2008-01-10 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00436.html + + * tree-ssa-operands.h (PHI_RESULT_PTR): Call + gimple_phi_result_ptr. + (PHI_ARG_DEF_PTR): Call gimple_phi_arg_imm_use_ptr. + (free_ssa_operands): Remove. + (copy_virtual_operands, create_ssa_artificial_load_stmt, + add_to_addressable_set, discard_stmt_changes, + FOR_EACH_PHI_OR_STMT_USE, FOR_EACH_PHI_OR_STMT_DEF): Convert + to use 'gimple'. + * tree-into-ssa.c: Convert to use 'gimple'. + (rewrite_uses_p): New. Use instead of REWRITE_THIS_STMT. + (set_rewrite_uses): New. Use instead of REWRITE_THIS_STMT. + (register_defs_p): New. Use instead of + REGISTER_DEFS_IN_THIS_STMT. + (set_register_defs): New. Use instead of + REGISTER_DEFS_IN_THIS_STMT. + (REWRITE_THIS_STMT): Remove. + (REGISTER_DEFS_IN_THIS_STMT): Remove. + * tree-pretty-print.c (dump_vops): Remove. Update all + users. + (dump_generic_node): Do not handle PHI_NODE. + * tree.c (tree_node_kind): Remove "phi_nodes" entry. + (tree_code_size): Do not handle PHI_NODE. + (tree_size): Likewise. + (make_node_stat): Likewise. + (tree_node_structure): Likewise. + (phi_node_elt_check_failed): Remove. + * tree.h (PHI_NODE_ELT_CHECK): Remove. + (PHI_RESULT_TREE): Remove. + (PHI_ARG_DEF_TREE): Remove. + (PHI_CHAIN): Remove. + (PHI_NUM_ARGS): Remove. + (PHI_ARG_CAPACITY): Remove. + (PHI_ARG_ELT): Remove. + (PHI_ARG_EDGE): Remove. + (PHI_BB): Remove. + (PHI_ARG_IMM_USE_NODE): Remove. + (struct tree_phi_node): Remove. + (union tree_node): Remove field 'phi'. + (release_phi_node): Change argument to gimple. + (duplicate_ssa_name): Change second argument to gimple. + (swap_tree_operands): Remove. + (enum tree_node_kind): Remove phi_kind entry. + * tree-phinodes.c: Convert to use gimple. + * tree-gimple.c (is_gimple_stmt): Do not handle PHI_NODE. + * cgraphunit.c (cgraph_process_new_functions): Call + gimple_unreachable to mark unconverted sections. + (verify_cgraph_node): Do not ICE if THIS_CFUN is NULL. + Convert statement verification to use gimple. + (cgraph_expand_function): Call gimple_unreachable to mark + unconverted sections. + * tree-ssa-propagate.c: Convert to use gimple. + (STMT_IN_SSA_EDGE_WORKLIST): Use flag GF_PLF_1 as marker. + (DONT_SIMULATE_AGAIN): Remove. Use gimple_visited. + * gimple-dummy.c: Remove converted functions. + * tree-ssa-alias.c (may_be_aliased): Re-enable. + * tree-flow-inline.h (gimple_phi_arg_imm_use_ptr): Rename + from get_phi_arg_def_ptr. + (bsi_start, bsi_after_labels, bsi_last, bsi_end_p, + bsi_next, bsi_prev, bsi_stmt, bsi_stmt_ptr): Remove. + * tree.def (PHI_NODE): Remove. Update most users. + * tree-dfa.c: Convert to use gimple. + * common.opt (fgimple-conversion): Default to 0. + * tree-ssa.c: Convert to use gimple. + * tree-optimize.c (pass_early_local_passes, + pass_all_early_optimization, pass_init_datastructures): + Enable. + * tree-flow.h (tree_ann_type): Remove STMT_ANN. Update + all users. + (struct stmt_ann_d): Remove. Update all users. + * Makefile.in (GIMPLE_H): Add tree-ssa-operands.h. + (tree-ssa-copy.o, tree-phi-nodes.o, tree-complex.o): + Re-enable. + * gimple.h (enum plf_mask): Define. + (GF_NO_WARNING): Remove + (bb_seq): Return NULL if BB->il.gimple is NULL. + (struct gimple_statement_base): Add bitfields no_warning, + visited, unused_1, unused_2, unused_3, unused_4 and plf. + (gimple_flags, gimple_set_flags, gimple_add_flag): + Remove. Update all users. + (gimple_set_visited): New. + (gimple_visited_p): New. + (gimple_set_plf): New. + (gimple_plf): New. + (gimple_has_volatile_ops): New. + (gimple_set_has_volatile_ops): New. + (gimple_addresses_taken): New. + (gimple_set_addresses_taken): New. + (gimple_add_to_addresses_taken): New. + (gimple_phi_result_ptr): New. + (gsi_stmt_ptr): New. + (gsi_bb): New. + (gsi_seq): New. + * tree-cfg.c (execute_build_cfg): Do not call + gimple_set_body after building the CFG. + (pass_build_cfg): Do not require PROP_gimple_leh. + (gimplify_val): Convert to gimple. + * passes.c (init_optimization_passes): Disable all of + pass_all_early_optimizations. + * tree-ssanames.c: Convert to gimple. + * tree-ssa-operands.c: Convert to gimple. + (gimple_set_stored_syms): New. + (gimple_set_loaded_syms): New. + +2008-01-03 Diego Novillo + + Merge with mainline @131303 + + * configure.ac (ACX_PKGVERSION): Update revision merge + string. + * configure: Regenerate. + +2007-12-20 Diego Novillo + + * Makefile.in (builtins.o-warn, expr.o-warn): Add + -Wno-error. + +2007-12-05 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00221.html + + * gimple.c (walk_gimple_asm): Guard against WI being + NULL. + (walk_gimple_stmt): Likewise. + +2007-12-05 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00216.html + + * tree.h (gimple_unreachable_1): Declare. + (gimple_unreachable): Define. + Replace calls to gcc_unreachable with gimple_unreachable + in unconverted code. + * gimple-dummy.c (gimple_unreachable_1): New function. + * common.opt (fgimple-only): Remove. + (fgimple-conversion): Define. + * Makefile.in (STRICT_WARN): Add -Wno-return-type. + +2007-11-30 Diego Novillo + + Merge with mainline @130470 + + * configure.ac (ACX_PKGVERSION): Update revision merge + string. + * configure: Regenerate. + * tree-inline.c (copy_decl_no_change, + copy_decl_for_dup_finish): Re-enable. + +2007-11-26 Aldy Hernandez + + * gimple.h (gimple_bind_block): Update comment. + +2007-11-19 Diego Novillo + + Merge with mainline @130291. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-11-19 Diego Novillo + + * tree-flow-inline.h (get_lineno): Call IS_LOCATION_EMPTY + and LOCATION_LINE instead of accessing location fields + directly. + * gimple-low.c (lower_function_body): Use + UNKNOWN_LOCATION instead of unknown_location. + +2007-11-16 Diego Novillo + + * cgraph.c (cgraph_create_edge): Call gimple_body + instead of DECL_SAVED_TREE. + (dump_cgraph_node): Likewise. + * cgraphunit.c (verify_cgraph_node): Likewise. + (cgraph_analyze_functions): Likewise. + (cgraph_mark_functions_to_output): Likewise. + (cgraph_optimize): Likewise. + * tree-eh.c (lower_eh_constructs): Add notes for future + changes to calls to DECL_SAVED_TREE. + (refactor_eh_r): Likewise. + * cfgexpand.c (gimple_to_tree): New function. + (maybe_dump_rtl_for_gimple_stmt): Rename from + maybe_dump_rtl_for_tree_stmt. Convert to tuples. + (label_rtx_for_bb): Convert to tuples. + (expand_gimple_cond): Rename from + expand_gimple_cond_expr. Convert to tuples. + (expand_gimple_tailcall): Convert to tuples. + (expand_gimple_basic_block): Convert to tuples. + (discover_nonconstant_array_refs_r): Convert to tuples. + (discover_nonconstant_array_refs): Convert to tuples. + * tree-mudflap.c (execute_mudflap_function_decls): Add + deprecation comment for DECL_SAVED_TREE call. + * tree-inline.c (copy_generic_body): Call gimple_body + instead of DECL_SAVED_TREE. + (inlinable_function_p): Likewise. + (clone_body): Add deprecation comment for DECL_SAVED_TREE + call. + * tree-cfg.c (remove_useless_stmts_bind): Call + gimple_body instead of DECL_SAVED_TREE. + (remove_useless_stmts): Likewise. + +2007-11-10 Aldy Hernandez + + * tree-cfg.c (verify_types_in_gimple_call): OBJ_TYPE_REF are allowed + as function types. + + [objc] + * objc-act.c (objc_gimplify_expr): Change pre and post to sequences. + * objc-act.h (objc_gimplify_expr): Change prototype accordingly. + + [testsuite] + * lib/objc.exp: Set -I regardless of libobjc. + +2007-11-10 Aldy Hernandez + + * tree-gimple.h (tree_annotate_all_with_locus): New. + * gimple-dummy.c: Add omp_reduction_init and + diagnose_omp_structured_block_errors. + * gimplify.c (tree_should_carry_locus_p): New. + (tree_annotate_one_with_locus): New. + (tree_annotate_all_with_locus): New. + +2007-11-08 Diego Novillo + + Merge with mainline @129982 + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-11-01 Diego Novillo + + * cgraphbuild.c (initialize_inline_failed): Re-enable. + (build_cgraph_edges): Adapt to use tuples. + (pass_build_cgraph): Re-enable. + (rebuild_cgraph_edges): Adapt to use tuples. + * cgraph.c (cgraph_release_function_body): Also NULLify the + gimple body. + (debug_cgraph_node): New. + (debug_cgraph): New. + * cgraph.h (struct cgraph_edge): Change field CALL_STMT to + type gimple. Update all users. + * cgraphunit.c (cgraph_analyze_functions): If DECL does not + have a struct function entry, discard it. + * gimple.h (GF_CALL_CANNOT_INLINE): New. + (gimple_call_lhs_ptr): New. + (gimple_call_mark_uninlinable): New. + (gimple_call_cannot_inline_p): New. + (struct walk_stmt_info): Add field PSET. + +2007-11-01 Diego Novillo + + * tree-optimize.c (tree_rest_of_compilation): Call + gimple_set_body to remove the body if not inlining. + * gimple.c (walk_gimple_stmt): Update documentation. + Pass WI->PSET to every call to walk_tree. + +2007-11-01 Diego Novillo + + * langhooks.h (struct lang_hooks_for_callgraph): Remove third + argument from function pointer ANALYZE_EXPR. Update all + users. + +2007-10-30 Diego Novillo + + * gimple.c (gimple_build_omp_return): Call + gimple_omp_return_set_nowait if needed. + * gimple.h (GIMPLE_CHECK, GIMPLE_CHECK2, GIMPLE_RANGE_CHECK): + Move earlier in the file. + (GF_NO_WARNING): Change to static const unsigned. + (GF_CALL_TAILCALL): New. + (GF_OMP_PARALLEL_COMBINED): Rename from + OMP_PARALLEL_COMBINED_FLAG. Change to static const unsigned. + Update all users. + (GF_OMP_RETURN_NOWAIT): Rename from OMP_RETURN_NOWAIT_FLAG. + Change to static const unsigned. + Update all users. + (GF_OMP_SECTION_LAST): Rename from OMP_SECTION_LAST_FLAG. + Change to static const unsigned. + Update all users. + (gimple_omp_return_set_nowait): New. + (gimple_call_set_tail): New. + (gimple_call_tail_p): New. + +2007-10-30 Aldy Hernandez + + * gimplify.c (get_tmp_var_for): Remove reference to IS_FORMAL in + opening comment. + (gimplify_return_expr): Return GS_ERROR if we have errored. + (gimplify_statement_list): Handle case where voidify_wrapper returns a + temporary. + (gimplify_call_expr): Return gracefully on error. + (gimplify_cond_expr): Same. + * gimple.h (gimple_call_return_type): Do not error on methods. + +2007-10-29 Diego Novillo + Tom Tromey + + * gimple.h (gimple_locus): Update comment. + (gimple_set_locus): Likewise. + (gimple_locus_empty_p): Add support for mapped locations. + +2007-10-29 Diego Novillo + + * tree-optimize.c (execute_cleanup_cfg_pre_ipa): Re-enable. + * gimple.c (walk_gimple_asm): Tidy comment. + +2007-10-29 Aldy Hernandez + + * tree-gimple.h (build_gimple_eh_filter_tree): Remove. + * gimplify.c (build_gimple_eh_filter_tree): Move from here... + * cp/cp-gimplify.c: ...to here. + (cp_gimplify_init_expr): Convert to tuples. + (gimplify_must_not_throw_expr): Make function return a + gimplify_status and convert to tuples. + (cp_gimplify_expr): Convert MUST_NOT_THROW_EXPR, INIT_EXPR, and + USING_STMT to tuples. + +2007-10-28 Aldy Hernandez + + * gimplify.c (gimplify_body): Make work when body contains more than + a GIMPLE_BIND statement. + +2007-10-26 Diego Novillo + + Merge with mainline @129659. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-10-26 Diego Novillo + + * gimple-low.c (lower_builtin_setjmp): Pass ARG to first + call to gimple_build_call. + +2007-10-17 Aldy Hernandez + + * tree-gimple.c (get_gimple_rhs_class): Add case for EXC_PTR_EXPR. + * gimplify.c (gimple_conditional_context): Enable. + (gimplify_cleanup_point_expr): Enable. Adjust for tuples. + (gimple_push_cleanup): Enable. + (gimplify_target_expr): Do not gimplify TARGET_EXPR_CLEANUP before + calling gimple_push_cleanup. + (gimplify_expr): Rename `try' to `try_'. + Enable CLEANUP_POINT_EXPR case. + Gimplify CATCH_EXPR and EH_FILTER_EXPR cases correctly. + +2007-10-17 Aldy Hernandez + + * gimple.c (gimple_size): Handle GIMPLE_WITH_CLEANUP_EXPR. + * gimple.h (struct gimple_statement_catch): Make handler a structure, + not a pointer. + (struct gimple_statement_eh_filter): Make failure a structure, not a + pointer. + document EH_FILTER_MUST_NOT_THROW subcode flag. + (gimple_catch_handler): Handler is now a struct. + (gimple_catch_set_handler): Same. + (gimple_eh_filter_failure): Failure is now a struct. + (gimple_eh_filter_set_failure): Same. + (gimple_eh_filter_must_not_throw): New. + (gimple_eh_filter_set_must_not_throw): New. + (gsi_next): Update comment. + (gsi_prev): Same. + * tree-cfg.c (verify_types_in_gimple_seq_2): Handle GIMPLE_EH_FILTER. + +2007-10-18 Diego Novillo + + * gimple-iterator.c (gsi_delink): Remove. + * gimple.h (gsi_delink): Remove. + +2007-10-17 Diego Novillo + + * coretypes.h (const_gimple_seq): New typedef. + * gimple.h (gimple_seq_first): Constify argument. + (gimple_seq_last): Likewise. + (gimple_seq_copy): Likewise. + (gimple_seq_empty_p): Likewise. + (gimple_set_prev): Rename from set_gimple_prev. + Update all users. + (gimple_set_next): Rename from set_gimple_next. + Update all users. + (gimple_set_flags): Rename from set_gimple_flags. + Update all users. + (gimple_add_flag): Rename from add_gimple_flag. + Update all users. + (gimple_set_subcode): Rename from set_gimple_subcode. + Update all users. + (gimple_set_block): Rename from set_gimple_block. + Update all users. + (gimple_set_locus): Rename from set_gimple_locus. + Update all users. + (gimple_locus_empty_p): Constify argument. + (gimple_has_ops): Likewise. + (gimple_has_mem_ops): Likewise. + (gimple_def_ops): Likewise. + (gimple_set_def_ops): Rename from set_gimple_def_ops. + Update all users. + (gimple_use_ops): Constify argument. + (gimple_set_use_ops): Rename from set_gimple_use_ops. + Update all users. + (gimple_vuse_ops): Constify argument. + (gimple_set_vuse_ops): Rename from set_gimple_vuse_ops. + Update all users. + (gimple_vdef_ops): Constify argument. + (gimple_set_vdef_ops): Rename from set_gimple_vdef_ops. + Update all users. + (gimple_loaded_syms): Constify argument. + (gimple_stored_syms): Constify argument. + (gimple_modified): Constify argument. + (gimple_set_modified): Rename from set_gimple_modified. + Update all users. + (gimple_omp_return_nowait_p): Constify argument. + (gimple_omp_section_last_p): Constify argument. + (gimple_omp_parallel_combined_p): Constify argument. + (gimple_build_return): Rename from build_gimple_return. + Update all users. + (gimple_build_assign): Rename from build_gimple_assign. + Update all users. + (gimple_build_assign_with_ops): Rename from + build_gimple_assign_with_ops. + Update all users. + (gimple_build_call_vec): Rename from build_gimple_call_vec. + Update all users. + (gimple_build_call): Rename from build_gimple_call. + Update all users. + (gimple_build_cond): Rename from build_gimple_cond. + Update all users. + (gimple_build_label): Rename from build_gimple_label. + Update all users. + (gimple_build_goto): Rename from build_gimple_goto. + Update all users. + (gimple_build_nop): Rename from build_gimple_nop. + Update all users. + (gimple_build_asm): Rename from build_gimple_asm. + Update all users. + (gimple_build_asm_vec): Rename from build_gimple_asm_vec. + Update all users. + (gimple_build_catch): Rename from build_gimple_catch. + Update all users. + (gimple_build_eh_filter): Rename from build_gimple_eh_filter. + Update all users. + (gimple_build_try): Rename from build_gimple_try. + Update all users. + (gimple_build_wce): Rename from build_gimple_wce. + Update all users. + (gimple_build_resx): Rename from build_gimple_resx. + Update all users. + (gimple_build_switch): Rename from build_gimple_switch. + Update all users. + (gimple_build_switch_vec): Rename from + build_gimple_switch_vec. Update all users. + (gimple_build_omp_parallel): Rename from + build_gimple_omp_parallel. Update all users. + (gimple_build_omp_for): Rename from build_gimple_omp_for. + Update all users. + (gimple_build_omp_critical): Rename from + build_gimple_omp_critical. + Update all users. + (gimple_build_omp_section): Rename from + build_gimple_omp_section. Update all users. + (gimple_build_omp_continue): Rename from + build_gimple_omp_continue. Update all users. + (gimple_build_omp_master): Rename from + build_gimple_omp_master. Update all users. + (gimple_build_omp_ordered): Rename from + build_gimple_omp_ordered. Update all users. + (gimple_build_omp_sections): Rename from + build_gimple_omp_sections. Update all users. + (gimple_build_omp_single): Rename from + build_gimple_omp_single. Update all users. + (gimple_set_body): Rename from set_gimple_body. Update all + users. + (gimple_set_bb): Rename from set_gimple_bb. Update all users. + (is_gimple_operand): Constify argument. + (gimple_ops): Likewise. + (gimple_op_ptr): Likewise. + (gimple_call_lhs): Likewise. + (gimple_call_return_type): Likewise. + (gimple_call_chain): Likewise. + (gimple_call_arg_ptr): Likewise. + (gimple_cond_true_label): Likewise. + (gimple_bind_vars): Likewise. + (gimple_bind_set_body): Likewise. + (gimple_bind_block): Likewise. + (gimple_asm_ninputs): Likewise. + (gimple_asm_noutputs): Likewise. + (gimple_asm_nclobbers): Likewise. + (gimple_asm_input_op): Likewise. + (gimple_asm_output_op): Likewise. + (gimple_asm_clobber_op): Likewise. + (gimple_asm_string): Likewise. + (gimple_asm_volatile_p): Likewise. + (gimple_catch_types): Likewise. + (gimple_catch_handler): Likewise. + (gimple_eh_filter_types): Likewise. + (gimple_eh_filter_failure): Likewise. + (gimple_try_kind): Likewise. + (gimple_try_set_eval): Likewise. + (gimple_try_set_cleanup): Likewise. + (gimple_wce_set_cleanup): Likewise. + (gimple_wce_cleanup_eh_only): Likewise. + (gimple_phi_capacity): Likewise. + (gimple_phi_num_args): Likewise. + (gimple_phi_result): Likewise. + (gimple_resx_region): Likewise. + (gimple_switch_num_labels): Likewise. + (gimple_switch_label): Likewise. + (gimple_switch_default_label): Likewise. + (gimple_omp_set_body): Likewise. + (gimple_omp_critical_name): Likewise. + (gimple_omp_for_clauses): Likewise. + (gimple_omp_for_index): Likewise. + (gimple_omp_for_initial): Likewise. + (gimple_omp_for_final): Likewise. + (gimple_omp_for_incr): Likewise. + (gimple_omp_for_set_pre_body): Likewise. + (gimple_omp_parallel_clauses): Likewise. + (gimple_omp_parallel_child_fn): Likewise. + (gimple_omp_parallel_data_arg): Likewise. + (gimple_omp_single_clauses): Likewise. + (gimple_omp_sections_clauses): Likewise. + (gimple_omp_for_cond): Likewise. + (gimple_return_retval): Likewise. + (is_gimple_omp): Likewise. + (gimple_nop_p): Likewise. + (gimple_expr_type): Likewise. + +2007-10-17 Diego Novillo + + * tree-ssa-loop-manip.c (gimple_duplicate_loop_to_header_edge): Rename + from tree_duplicate_loop_to_header_edge. + Update all users. + * value-prof.c: Convert and enable all functions in the file. + (gimple_divmod_fixed_value): Rename from + tree_divmod_fixed_value. + (gimple_mod_pow2): Rename from tree_mod_pow2. + (gimple_mod_subtract): Rename from tree_mod_subtract. + (gimple_divmod_fixed_value_transform): Rename from + tree_divmod_fixed_value_transform. + (gimple_mod_pow2_value_transform): Rename from + tree_mod_pow2_value_transform. + (gimple_mod_subtract_transform): Rename from + tree_mod_subtract_transform. + (gimple_stringops_transform): Rename from tree_stringops_transform. + (gimple_ic_transform): Rename from tree_ic_transform. + Update all users. + * value-prof.h (gimple_register_value_prof_hooks): Rename from + tree_register_value_prof_hooks. Update all users. + * tree.h (OMP_DIRECTIVE_P): Remove. Update all users. + (validate_arglist): Move to gimple.h. + * builtins.c: (validate_arglist): Change first argument to + const_gimple. Disable most callers. + * gimple.def: Document all GIMPLE codes. + * tree-gimple.c (is_gimple_operand): New. + (get_gimple_rhs_class): Accept as a + GIMPLE_SINGLE_RHS. + : Likewise. + (get_gimple_rhs_num_ops): New. + (is_gimple_call_addr): Tidy. + * tree-gimple.h (get_gimple_rhs_num_ops): Declare. + * gimple-dummy.c (free_histograms, stringop_block_profile): + Remove. + * gimple-low.c (lower_function_body): Tidy. + * predict.c (gimple_predicted_by_p): Rename from + tree_predicted_by_p. Update all users. + (gimple_predict_edge): Rename from tree_predict_edge. Update + all users. + * gimple-iterator.c (gsi_link_seq_after): Update documentation. + (gsi_link_after): Likewise. + * tree-eh.c (stmt_could_throw_1_p): New. + (stmt_could_throw_p): New. + * gimple-pretty-print.c (dump_unary_rhs): Print ADDR_EXPR as + a single operand. + (dump_gimple_switch): Support NULL case labels. + (dump_gimple_asm): Dump outputs first. + * gimplify.c (compare_case_labels): Make the default label + sort first. + (sort_case_labels): Do not special case the default label. + (gimplify_init_ctor_eval): Gimplify initializer expressions. + (gimplify_modify_expr): Unshare the operands before setting + them on the new GIMPLE_ASSIGN statement. + (gimplify_asm_expr): NULLify the chain on operands before + putting them on the input/output vectors. + * tree-cfgcleanup.c: Convert and enable CFG cleanup functions. + (cleanup_control_expr_graph): Call gimple_fold. + * tree-flow.h (gimple_block_label): Rename from + tree_block_label. Update all users. + (gimple_duplicate_sese_region): Rename from + tree_duplicate_sese_region. Update all users. + (gimple_duplicate_sese_tail): Rename from + tree_duplicate_sese_tail. Update all users. + (gimple_purge_dead_abnormal_call_edges): Rename from + tree_purge_dead_abnormal_call_edges. Update all users. + (gimple_purge_all_dead_eh_edges): Rename from + tree_purge_all_dead_eh_edges. Update all users. + (stmt_could_throw_p): Declare. + (add_stmt_to_eh_region_fn): Move from except.h. + (remove_stmt_from_eh_region_fn): Likewise. + (lookup_stmt_eh_region_fn): Likewise. + (lookup_stmt_eh_region): Likewise. + (verify_eh_edges): Likewise. + * Makefile.in (GIMPLE_H): Add dependencies on GGC_H, TM_H and + TARGET_H. + (ipa-inline.o): Add dependency on TREE_FLOW_H. + (out_object_file): Add dependency on TREE_GIMPLE_H. + * gimple.c (gimple_set_code): Rename from set_gimple_code. + (gimple_size): New. + (gimple_alloc): New. + (gimple_alloc_ops): New. + (build_gimple_with_ops): Call them. + (build_gimple_return): Only call gimple_return_set_retval if + RETVAL is not NULL. + (build_gimple_call): Validate argument FN. + (extract_ops_from_tree): New. + (build_gimple_assign_with_ops): New. + (build_gimple_assign): Call them. + (build_gimple_nop): Call gimple_alloc. + (build_gimple_bind): Likewise. + (build_gimple_asm_1): Tidy. + (build_gimple_asm_vec): Tidy. + (build_gimple_asm): Tidy. + (build_gimple_catch): Call gimple_alloc. + (build_gimple_eh_filter): Likewise. + (build_gimple_try): Likewise. + (build_gimple_wce): Likewise. + (build_gimple_phi): Remove. + (build_gimple_resx): Call gimple_alloc. + (build_gimple_switch_1): Tidy. + (build_gimple_switch): Tidy. + (build_gimple_omp_critical): Call gimple_alloc. + (build_gimple_omp_for): Likewise. + (build_gimple_omp_parallel): Likewise. + (build_gimple_omp_section): Likewise. + (build_gimple_omp_master): Likewise. + (build_gimple_omp_continue): Likewise. + (build_gimple_omp_ordered): Likewise. + (build_gimple_omp_return): Likewise. + (build_gimple_omp_sections): Likewise. + (build_gimple_omp_single): Likewise. + (gimple_check_failed): Change GS to const_gimple. Update all + users. + (gimple_range_check_failed): Likewise. + (walk_gimple_seq): Change return type to tree. Update all + users. + If the call to walk_gimple_stmt returns non-NULL, + return it immediately. + (walk_gimple_asm): Change return type to tree. Update all + users. + If the call to walk_tree returns non-NULL, return it. + (walk_gimple_stmt): Likewise. + (gimple_fold): New. + (gimple_assign_set_rhs_from_tree): New. + (gimple_assign_set_rhs_with_ops): New. + (gimple_copy): New. + * basic-block.h (gimple_predicted_by_p): Rename from + tree_predicted_by_p. Update all users. + (gimple_predict_edge): Rename from tree_predict_edge. Update + all users. + * gimple.h: Add documentation to all inline functions. + (gimple_seq_first): Return NULL if S is NULL. + (gimple_seq_last): Likewise. + (GF_ASM_VOLATILE): Define. + (GF_NO_WARNING): Rename from GIMPLE_NO_WARNING. Update all + users. + (build_gimple_assign_with_ops): Declare. + (build_gimple_asm): Change unsigned arguments to size_t. + Update all users. + (build_gimple_switch): Likewise. + (build_gimple_phi): Remove. + (validate_arglist): Declare. + (gimple_fold): Declare. + (gimple_assign_set_rhs_from_tree): Declare. + (gimple_assign_set_rhs_with_ops): Declare. + (gimple_copy): Declare. + (is_gimple_operand): Declare. + (gimple_num_ops): Change argument to const_gimple. + Return 0 if GS is not one of the statements that has tree + operands. + (gimple_ops): New. + (gimple_op): Change argument to const_gimple. + If GS is not a statement that has tree operands, return NULL. + (gimple_op_ptr): Likewise. + (gimple_assign_subcode): Change argument to const_gimple. + (gimple_assign_operand): Remove. Update all users. + (gimple_assign_set_operand): Remove. Update all users. + (gimple_assign_lhs): Change argument type to const_gimple. + (gimple_assign_rhs1): Likewise. + (gimple_assign_rhs2): Likewise. + (gimple_assign_set_rhs1): Assert that RHS is a valid operand. + (gimple_assign_set_rhs2): Likewise. + (gimple_call_lhs): Call gimple_op. + (gimple_call_set_lhs): Assert that LHS is a valid operand. + Call gimple_set_op. + (gimple_call_set_fn): New. + (gimple_call_fndecl): Change argument type to const_gimple. + Call gimple_call_fn. + (gimple_call_chain): Call gimple_op. + (gimple_call_set_chain): Assert that CHAIN is valid. + Call gimple_set_op. + (gimple_call_nargs): Change argument to const_gimple. + Call gimple_op. + (gimple_call_arg_ptr): Call gimple_op_ptr. + (gimple_call_set_arg): Assert that ARG is valid. + Call gimple_set_op. + (gimple_cond_code): Change argument to const_gimple. + (gimple_cond_lhs): Change argument to const_gimple. + (gimple_cond_set_lhs): Assert that the operand is valid. + Call gimple_set_op. + (gimple_cond_rhs): Change argument to const_gimple. + Call gimple_op. + (gimple_cond_true_label): Call gimple_op. + (gimple_cond_false_label): Likewise. + (gimple_label_label): Likewise. + (gimple_cond_set_true_label): Assert that the operand is + valid. + Call gimple_set_op. + (gimple_cond_set_false_label): Likewise. + (gimple_goto_dest): Change argument to const_gimple. + Call gimple_set_op. + (gimple_goto_set_dest): Assert that the operand is valid. + Call gimple_set_op. + (gimple_asm_ninputs): Change return type to size_t. Update + all users. + (gimple_asm_noutputs): Likewise. + (gimple_asm_nclobbers): Rename from gimple_asm_nclobbered. + Change return type to size_t. + Update all users. + (gimple_asm_set_input_op): Assert that the argument is + valid. + (gimple_asm_set_output_op): Likewise. + (gimple_asm_set_clobber_op): Likewise. + (gimple_asm_volatile_p): New. + (gimple_asm_set_volatile): New. + (gimple_asm_clear_volatile): New. + (gimple_phi_set_capacity): Remove. + (gimple_phi_set_nargs): Remove. + (gimple_expr_type): New. + (struct walk_stmt_info): Remove fields want_bind_expr and + want_return_expr. Update all users. + * tree-cfg.c: Convert all functions for CFG cleanup and + verification. + (gimple_redirect_edge_and_branch): Rename from + tree_redirect_edge_and_branch. + (gimple_try_redirect_by_replacing_jump): Rename from + tree_try_redirect_by_replacing_jump. + (gimple_verify_flow_info): Rename from tree_verify_flow_info. + (gimple_make_forwarder_block): Rename from + tree_make_forwarder_block. + (gimple_cfg2vcg): Rename from tree_cfg2vcg. + (gimple_merge_blocks): Rename from tree_merge_blocks. + (gimple_can_merge_blocks_p): Rename from tree_merge_blocks_p. + (gimple_can_remove_branch_p): Rename from tree_can_remove_branch_p. + (gimple_redirect_edge_and_branch): Rename from + tree_redirect_edge_and_branch. + (gimple_move_block_after): Rename from tree_move_block_after. + (gimple_predict_edge): Rename from tree_predict_edge. + (gimple_predicted_by_p): Rename from tree_predicted_by_p. + (gimple_duplicate_bb): Rename from tree_duplicate_bb. + (gimple_can_duplicate_bb_p): Rename from tree_can_duplicate_bb_p. + (gimple_split_edge): Rename from tree_split_edge. + (gimple_make_forwarder_block): Rename from tree_make_forwarder_block. + (gimple_block_ends_with_call_p): Rename from + tree_block_ends_with_call_p. + (gimple_block_ends_with_condjump_p): Rename from + tree_block_ends_with_condjump_p. + (gimple_flow_call_edges_add): Rename from + tree_flow_call_edges_add. + (gimple_execute_on_growing_pred): Rename from + tree_execute_on_growing_pred. + (gimple_execute_on_shrinking_pred): Rename from + tree_execute_on_shrinking_pred. + (gimple_duplicate_loop_to_header_edge): Rename from + tree_duplicate_loop_to_header_edge. + (gimple_lv_add_condition_to_bb): Rename from + tree_lv_add_condition_to_bb. + (gimple_lv_adjust_loop_header_phi): Rename from + tree_lv_adjust_loop_header_phi. + (struct pass_build_cfg): Enable TODO_verify_stmts and + TODO_cleanup_cfg. + * passes.c (execute_function_todo): Enable call to + cleanup_tree_cfg. + +2007-10-17 Aldy Hernandez + + * gimple.def: Add GIMPLE_WITH_CLEANUP_EXPR. + * gsstruct.def: Add GSS_WCE. + * gimple-iterator.c (gsi_delink): New. + (gsi_split_seq_*): Update comment. + * gimple.c (gss_for_code): Handle GIMPLE_WCE. Adjust whitespace. + (build_gimple_wce): New. + * gimple.h (struct gimple_statement_wce): New. + (union gimple_statement_d): Add gimple_wce. + (build_gimple_wce): Protoize. + (gimple_wce_cleanup): New. + (gimple_wce_set_cleanup): New. + (gimple_wce_cleanup_eh_only): New. + (gimple_wce_set_cleanup_eh_only): New. + (gsi_delink): Protoize. + +2007-10-12 Aldy Hernandez + + * Makefile.in (GIMPLE_H): Depend on TARGET_H. + * gimple.h (gsi_alloc): New. + (_ALLOC_GSI): Remove. + Replace _ALLOC_GSI uses by gsi_alloc. + +2007-10-12 Aldy Hernandez + + * gimple.h (_ALLOC_GSI): New. + Use it throughout when allocating a new gimple_stmt_iterator. + +2007-10-11 Aldy Hernandez + + Merge with mainline @129233. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-10-11 Aldy Hernandez + + * cfg.c: Include tree-flow.h. + (remove_edge_raw): Call redirect_edge_var_map_clear. + (redirect_edge_succ_nodup): Call redirect_edge_var_map_dup. + * tree-flow-inline.h (redirect_edge_var_map_def): New. + (redirect_edge_var_map_result): New. + * tree-cfgcleanup.c (remove_forwarder_block_with_phi): Replace + PENDING_STMT use with redirect_edge_var_map_*. + * tree-ssa.c (edge_var_maps): New definition. + (redirect_edge_var_map_add): New. + (redirect_edge_var_map_clear): New. + (redirect_edge_var_map_dup): New. + (redirect_edge_var_map_vector): New. + (redirect_edge_var_map_destroy): New. + (ssa_redirect_edge): Replace PENDING_STMT use with + redirect_edge_var_map_*. + (flush_pending_stmts): Same. + (delete_tree_ssa): Destroy edge var map. + * tree-flow.h (struct _edge_var_map): New. + Define edge_var_map vector type. + Declare redirect_edge_var_map_* prototypes. + * Makefile.in (cfg.o): Depend on TREE_FLOW_H. + * tree-cfg.c (reinstall_phi_args): Replace + PENDING_STMT use with redirect_edge_var_map_*. + +2007-10-02 Diego Novillo + + Merge with mainline @128957. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-09-24 Diego Novillo + + Merge with mainline @128708. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-09-24 Diego Novillo + + * gimple.h (gimple_code): Change argument type to + const_gimple. + (gimple_flags): Likewise. + (gimple_subcode): Likewise. + (gimple_next): Likewise. + (gimple_prev): Likewise. + (gimple_bb): Likewise. + (gimple_block): Likewise. + (gimple_locus): Likewise. + +2007-09-15 Diego Novillo + + * gimple-iterator.c (gsi_replace): Call gsi_insert_before and + gsi_remove to do the replacement. + (gsi_insert_before): Take the basic block from the iterator. + (gsi_insert_after): Likewise. + * gimple-iterator.h: Move inside gimple.h. + * tree-eh.c (make_eh_edge, make_eh_edges): Enable. + * gimple-pretty-print.c (dump_gimple_seq, dump_gimple_cond, + dump_gimple_bind, dump_gimple_try): Do not handle TDF_DETAILS. + (dump_gimple_switch): Fix display of case labels. + (dump_gimple_stmt): Handle TDF_DIAGNOSTIC. + (pp_cfg_jump): New. + (dump_implicit_edges): New. + (gimple_dump_bb_buff): Call it. + * domwalk.c (walk_dominator_tree): + * gimplify.c (gimplify_switch_expr): Fix generation of + GIMPLE_SWITCH labels. + (gimplify_case_label_expr): Emit a label for CASE_LABEL + instead of the CASE_LABEL_EXPR. + * Makefile.in (GIMPLE_H): Add dependency on BASIC_BLOCK_H. + * gimple.c (walk_gimple_stmt): Reverse meaning of return value + of CALLBACK_STMT. Update all users. + Walk sub-statements of statements with bodies. + * gimple.h (GCC_GIMPLE_H): Rename from GCC_GIMPLE_IR_H. + Include vec.h, tm.h, hard-reg-set.h and basic-block.h. + (bb_seq, set_bb_seq): Move from tree-flow-inline.h + (gimple_label_set_label): Do not allow CASE_LABEL_EXPR. + (gsi_start_bb): New. Update all users that were calling + gsi_start (bb_seq ()). + (struct gimple_stmt_iterator): Add field 'bb'. + * tree-cfg.c (build_gimple_cfg): Enable. + (create_bb): Create a new sequence if the given one is NULL. + (make_gimple_switch_edges): Rename from make_switch_expr_edges. + Update all users. + (cleanup_dead_labels): Fix handling of GIMPLE_SWITCH. + (group_case_labels): Likewise. + (verify_types_in_gimple_stmt): Do not allow CASE_LABEL_EXPR in + a GIMPLE_LABEL. + +2007-09-13 Diego Novillo + + * tree-pretty-print.c (dump_symbols, dump_generic_bb, + dump_bb_header, dump_bb_end, dump_phi_nodes, pp_cfg_jump, + dump_implicit_edges, dump_generic_bb_buff): Remove. + * value-prof.c (histogram_eq): Enable. + (dump_histograms_for_stmt): Adapt to tuples. + * value-prof.h (struct): + * cfghooks.h (struct cfg_hooks): Add int argument. + Update all users. + * gimple-dummy.c (gimple_remove_stmt_histograms, + remove_stmt_from_eh_region): Remove. + * gimple-iterator.h (gsi_start): Support NULL sequences. + * tree-eh.c (add_stmt_to_eh_region): Enable. + (remove_stmt_from_eh_region): Enable. + (lookup_stmt_eh_region): Enable. + (tree_could_throw_p): Enable. + (stmt_can_throw_internal): Enable. + * gimple-pretty-print.c: Include value-prof.h + (dump_gimple_cond): Do not insert a newline initially. + (dump_gimple_bind): Likewise. + (dump_gimple_try): Likewise. + (dump_gimple_asm): Likewise. + (dump_symbols): Move from tree-pretty-print.c + (dump_gimple_phi): New. + (dump_gimple_stmt): Call it.. + (dump_bb_header): Move from tree-pretty-print.c + (dump_bb_end): Likewise. + (dump_phi_nodes): Likewise. + (gimple_dump_bb_buff): New. + (gimple_dump_bb): New. + * Makefile.in (gimple-pretty-print.o): Add dependency + value-prof.h + * tree-cfg.c (fold_cond_expr_cond): Handle cases where + fold_binary returns NULL. + (make_cond_expr_edges): Take locus from the first statement of + the destination blocks. + (tree_dump_bb): Remove. + (gimple_debug_bb): Rename from debug_tree_bb. + Update all users. + (gimple_debug_bb_n): Rename from debug_tree_bb_n. + Update all users. + (gimple_debug_cfg): Rename from debug_tree_cfg. + Update all users. + (gimple_dump_cfg): Rename from dump_tree_cfg. + Update all users. + (is_ctrl_altering_stmt): Call gimple_call_flags to determine + whether the function is const/pure. + * tree-ssa-operands.c (stmt_references_memory_p): Enable. + +2007-09-11 Diego Novillo + + * tree.h (struct tree_ssa_name): Add field def_stmt. + (SSA_NAME_DEF_STMT): Return it. + * tree-phinodes.c (create_phi_node): Return gimple. + Update all callers. + (add_phi_args): Change PHI argument to gimple. Update all + callers. + (remove_phi_node): Call gimple_remove. + (phi_reverse): Remove. Update all users. + * tree-ssa-alias-warnings.c: Disable. + * input.h (IS_LOCATION_EMPTY): Fix comparison of LOCATION_LINE. + * fold-const.c: Include gimple.h. + (fold_undefer_overflow_warnings): Change type of argument STMT to + gimple. Update all users. + * cfghooks.h (struct cfg_hooks): Change + arguments to basic_block. Update all users. + * tree-gimple.c (get_gimple_rhs_class): Change argument to + enum tree_code. Update all users. Move calls to + is_gimple_lvalue and is gimple_val... + (is_gimple_formal_tmp_rhs): ... here. + * tree-ssa-ccp.c (fold_stmt_r): Enable. + (fold_stmt): Enable. + (fold_stmt_inplace): Enable. Adapt to tuples. + * ipa-pure-const.c (analyze_function): Disable. + * tree-ssa-propagate.c (get_rhs): Adapt to tuples. Update all + users. + * gimple-dummy.c (ssa_operands_active): Remove dummy function. + (remove_stmt_from_eh_region, create_phi_node, add_phi_arg, + substitute_in_loop_info, release_defs, push_stmt_changes, + pop_stmt_changes, replace_exp): Add dummy functions. + * predict.c: Disable. + * gimple-iterator.c: Include tm.h and tree-flow.h + (gsi_delink): Remove. Update all users. + (update_modified_stmt): Move from tree-cfg.c. + (gsi_insert_before): New. + (gsi_insert_seq_before): New. + (gsi_insert_after): New. + (gsi_insert_seq_after): New. + (gsi_for_stmt): New. + (gsi_move_after): New. + (gsi_move_before): New. + (gsi_move_to_bb_end): New. + * gimple-iterator.h (gsi_remove): New. + * tree-eh.c (add_stmt_to_eh_region_fn): Add comment + (add_stmt_to_eh_region): Likewise. + (remove_stmt_from_eh_region_fn): Likewise. + (remove_stmt_from_eh_region): Likewise. + (lookup_stmt_eh_region_fn): Likewise. + (lookup_stmt_eh_region): Likewise. + (tree_could_throw_p): Likewise. + (stmt_can_throw_internal): Likewise. + (tree_can_throw_external): Likewise. + * gimple-pretty-print.c (op_gimple_cond): Remove. Update all + users. + * tree-affine.c (tree_to_aff_combination_expand): Disable. + * tree-flow-inline.h (op_iter_init_vdef): Call gimple_code + instead of TREE_CODE. + * gimplify.c (gimplify_cond_expr): Use enum tree_code instead + of enum gimple_cond as the subcode for GIMPLE_COND. + Do not switch around the conditional when the then clause is empty. + (tree_to_gimple_tuple): Remove. Update all users. + (gimplify_omp_for): + (force_gimple_operand_gsi): Rename from force_gimple_operand_bsi. Update all users. + * tree-dfa.c (find_referenced_vars): Disable. + (collect_dfa_stats): Likewise. + (collect_dfa_stats_r): Likewise. + * cfgexpand.c: Disable. + * tree-mudflap.c: Disable. + * print-tree.c: Include diagnostic.h. + (print_node): Call print_gimple_stmt when printing SSA_NAMEs. + * lambda-code.c: Disable. + * tree-profile.c (tree_init_edge_profiler): Disable. + (tree_gen_edge_profiler): Disable. + * tree-flow.h (block_stmt_iterator): Remove. Update all users. + (const_block_stmt_iterator): Likewise. + * Makefile.in (print-tree.o): Add dependency on $(DIAGNOSTIC_H). + (gimple-iterator.o): Add dependency on $(TREE_FLOW_H) and + value-prof.h. + (gimple.o): Likewise. + (fold-const.o): Add dependency on $(GIMPLE_H). + * gimple.c: Include tm.h, hard-reg-set.h, basic-block.h, + tree-flow.h and value-prof.h. + (build_gimple_with_ops): Do not allocate operands if NUM_OPS == 0. + (build_gimple_return): Remove argument RESULT_DECL_P. Update + all users. + (build_gimple_cond): Use enum tree_code instead of enum + gimple_cond as the subcode. Update all users. + (gimple_cond_invert): Remove. Update all users. + (walk_gimple_seq): Add arguments CALLBACK_STMT and + CALLBACK_OP. Update all users. + (walk_gimple_asm): Likewise. + (walk_gimple_stmt): Likewise. + (gimple_remove): New. + (gimple_seq_reverse): New. + (set_gimple_bb): New. + * gimple.h (gimple_statement_base): Split field 'flags' into + fields 'subcode' and 'flags'. Update all users. + (gimple_statement_with_ops): Rename field 'base' to + 'gsbase'. Update all users. + (gimple_statement_omp): Likewise. + (gimple_statement_bind): Likewise. + (gimple_statement_catch): Likewise. + (gimple_statement_eh_filter): Likewise. + (gimple_statement_phi): Likewise. + (gimple_statement_resx): Likewise. + (gimple_statement_try): Likewise. + (gimple_statement_omp_parallel): Likewise. + (enum gimple_cond): Remove. Update all users. + (GIMPLE_NO_WARNING): Define. + (set_gimple_flags): Assert that FLAGS fits in 8 bits. + (add_gimple_flag): Likewise. + (set_gimple_subcode): New. Use instead of set_gimple_flags + everywhere. + (gimple_subcode): New. Use instead of gimple_flags + everywhere. + (gimple_no_warning_p): New. + (gimple_cond_set_code): New. + (gimple_cond_make_false): New. + (gimple_cond_make_true): New. + (gimple_phi_num_args): Rename from gimple_phi_nargs. Update + all users. + * tree-cfg.c (build_gimple_cfg): Return immediately. + (set_bb_for_stmt): Remove. Move functionality to + set_gimple_bb. Update all users. + (factor_computed_gotos): + (bsi_for_stmt): Remove. + (bsi_insert_before): Remove. + (bsi_insert_seq_before): Remove. + (bsi_insert_after): Remove. + (bsi_insert_seq_after): Remove. + (bsi_remove): Remove. + (bsi_move_after): Remove. + (bsi_move_before): Remove. + (bsi_move_to_bb_end): Remove. + (bsi_replace): Remove. + (tree_verify_flow_info): Adapt to tuples. + (tree_make_forwarder_block): Likewise. + (tree_try_redirect_by_replacing_jump): Likewise. + (tree_redirect_edge_and_branch): Likewise. + (tree_purge_dead_eh_edges): Likewise. + (gimple_cfg_hooks): Enable some hooks. + * tree-ssanames.c (make_ssa_name): Change type of STMT to + gimple. Update all users. + * tree-ssa-operands.c (ssa_operands_active): Enable. + +2007-08-31 Diego Novillo + + * tree-gimple.c (is_gimple_addressable): Tidy. + * Makefile.in (tree-ssa-structalias.o): Disable dependency on + GTY header file. + (tree-ssa-propagate.o): Likewise. + (tree-phinodes.o): Likewise. + (tree-scalar-evolution.o): Likewise. + (tree-vect-generic.o): Likewise. + * gimple.h (struct gimple_statement_phi): Change type of + fields 'capacity' and 'nargs' to size_t. + Update all users. + * tree-cfg.c (verify_gimple_unary_expr): Remove. Update all + users. + (verify_gimple_binary_expr): Remove. Update all users. + (verify_types_in_gimple_min_lval): Rename from + verify_gimple_min_lval. + (verify_types_in_gimple_reference): Rename from + verify_gimple_reference. + (verify_gimple_tree_expr): Remove. + Move checks to verify_types_in_gimple_assign. + (verify_types_in_gimple_call): Rename from verify_gimple_call. + (verify_types_in_gimple_cond): Rename from verify_gimple_cond. + (verify_types_in_gimple_assign): Rename from verify_gimple_assign. + (verify_types_in_gimple_switch): Rename from verify_gimple_switch. + (verify_types_in_gimple_phi): New. + verify_types_in_gimple_return): Rename from + verify_gimple_return. + (verify_types_in_gimple_stmt): Rename from verify_gimple_stmt. + (verify_types_in_gimple_seq): Rename from verify_gimple_seq. + +2007-08-30 Chris Matthews + Diego Novillo + + * gimplify.c (gimplify_body): Call verify_gimple_seq if + ENABLE_TYPES_CHECKING is set. + * gimple.h (is_gimple_omp): New. + * tree-cfg.c (verify_gimple_tree_expr): Rename from + verify_gimple_expr. + Verify tree nodes that should disappear after conversion to + GIMPLE. + Do not handle COND_EXPR, CALL_EXPR. + (verify_gimple_modify_stmt): Remove. + (verify_gimple_call): New. + (verify_gimple_cond): New. + (verify_gimple_assign): New. + (verify_gimple_return): New. + (verify_gimple_switch): New. + (verify_gimple_stmt): Change input argument to type gimple. + Call new verifiers. + (verify_gimple_seq): Rename from verify_gimple_1. + +2007-08-30 Diego Novillo + + * gimple-low.c (gimple_try_catch_may_fallthru): Call + gimple_code instead of gimple_flags. + * gimple.c (set_gimple_body): Use gimple_seq instead of gimple + when accessing vector gimple_bodies_vec. + (gimple_body): Likewise. + (gimple_assign_copy_p): New. + * gimple.h (enum gimple_try_kind): New. + (GIMPLE_TRY_CATCH): Move inside enum gimple_try_kind. + (GIMPLE_TRY_FINALLY): Likewise. + (gimple_assign_copy_p): Declare. + (gimple_assign_rhs_code): New. + Update callers that used to call gimple_flags. + (gimple_cond_code): New. + Update callers that used to call gimple_flags. + (gimple_try_kind): New. + (gimple_nop_p): Tidy comment. + * gimple-pretty-print.c (dump_unary_rhs): New. + (dump_gimple_assign): Call it. + +2007-08-30 Diego Novillo + + * gimplify.c (gimplify_cond_expr): When gimplifying a ?: call + gimplify_stmt with the expression just built instead of the + original expression. + Use the correct labels when calling build_gimple_cond. + + +2007-08-30 Diego Novillo + + * tree-vrp.c: Disable. + * tree-loop-linear.c: Disable. + * tree-into-ssa.c: Disable. + * tree-ssa-loop-im.c: Disable. + * tree-complex.c: Disable. + * cgraphbuild.c: Disable most functions. + * tree-ssa-threadupdate.c: Disable. + * tree-ssa-loop-niter.c: Disable. + * tree-pretty-print.c: Disable. + * tree-ssa-loop-unswitch.c: Disable. + * tree-ssa-loop-manip.c: Disable. + * value-prof.c: Disable. + * tree-tailcall.c: Disable. + * tree-ssa-loop-ch.c: Disable. + * tree-scalar-evolution.c: Disable. + * tree-phinodes.c: Disable. + * omp-low.c: Disable. + * tree-ssa-dse.c: Disable. + * ipa-reference.c: Disable. + * tree-ssa-uncprop.c: Disable. + * tree-ssa-sccvn.c: Disable. + * cgraphunit.c (verify_cgraph_node): Disable basic block traversal. + * tree-ssa-copyrename.c: Disable. + * tree-ssa-ccp.c: Disable most functions. + * tree-ssa-loop-ivopts.c: Disable. + * tree-stdarg.c: Disable. + * tree-ssa-math-opts.c: Disable. + * tree-ssa-dom.c: Disable most functions. + * tree-nrv.c: Disable. + * tree-ssa-propagate.c: Disable. + * gimple-dummy.c: New file. + * tree-ssa-alias.c: Disable most functions. + * tree-ssa-sink.c: Disable. + * expr.c (expand_expr_real): Disable call to + lookup_stmt_eh_region. + * tree-ssa-loop-ivcanon.c: Disable. + * predict.c (strip_builtin_expect): Disable. + (tree_predict_by_opcode): Disable. + (return_prediction): Disable. + (apply_return_prediction): Disable. + (tree_bb_level_predictions): Disable. + (tree_estimate_probability): Disable. + (predict_paths_leading_to): Disable. + * gimple-iterator.c (gsi_replace): Mark unused arguments with + ATTRIBUTE_UNUSED. + * tree-ssa-ifcombine.c: Disable. + * matrix-reorg.c: Disable. + * c-decl.c (c_gimple_diagnostics_recursively): Disable call to + diagnose_omp_structured_block_errors. + * tree-eh.c: Disable most functions. + * tree-vectorizer.c: Disable. + * tree-vectorizer.h (nested_in_vect_loop_p): Disable. + * ipa-type-escape.c: Disable. + * tree-if-conv.c: Disable. + * profile.c: Disable. + * tree-data-ref.c: Disable. + * tree-flow-inline.h (bsi_start): Set bsi.gsi to NULL if the + block is invalid. + (bsi_last): Likewise. + (op_iter_next_use): Disable call to PHI_ARG_DEF_PTR. + * tree-vect-analyze.c: Disable. + * gimplify.c (gimple_conditional_context): Disable. + (gimple_push_cleanup): Disable. + (gimplify_omp_parallel): Disable calls to + push_gimplify_context and pop_gimplify_context. + * tree-ssa-phiopt.c: Disable. + * calls.c (emit_call_1): Disable calls to lookup_stmt_eh_region. + (expand_call): Likewise. + (emit_library_call_value_1): Initialize low_to_save and + high_to_save. + * tree-ssa-coalesce.c: Disable. + * tree-dfa.c (make_rename_temp): Disable call to + mark_sym_for_renaming. + (find_new_referenced_vars_1): Likewise. + (collect_dfa_stats): Disable CFG iteration. + (collect_dfa_stats_r): Disable. + (mark_symbols_for_renaming): Disable. + * cfgexpand.c (maybe_dump_rtl_for_tree_stmt): Disable. + (label_rtx_for_bb): Disable. + (expand_gimple_cond_expr): Disable. + (expand_gimple_tailcall): Disable. + (expand_gimple_basic_block): Disable. + * tree-cfgcleanup.c: Disable. + * tree-ssa-pre.c: Disable. + * tree-ssa-live.c: Disable. + * tree-sra.c: Disable most functions.. + * tree-predcom.c: Disable. + * tree-mudflap.c: Disable. + * ipa-prop.c: Disable. + * tree-ssa-copy.c (may_propagate_copy): Disable. + (propagate_value): Disable. + (execute_copy_prop): Disable. + (do_copy_prop): Disable. + (store_copy_prop): Disable. + * tree-ssa-forwprop.c: Disable. + * tree-ssa-dce.c: Disable. + * tree-vect-patterns.c: Disable. + * tree-ssa-ter.c: Disable. + * tree-ssa.c: Disable. + * lambda-code.c: Disable. + * tree-ssa-loop-prefetch.c: Disable. + * tree-inline.c: Disable most functions. + * tree-optimize.c (execute_fixup_cfg_pre_ipa): Disable. + (execute_fixup_cfg): Disable. + (execute_cleanup_cfg_post_optimizing): Disable. + (execute_fixup_cfg): Disable. + * tree-vect-transform.c: Disable. + * tree-object-size.c: Disable. + * tree-outof-ssa.c: Disable. + * cfgloop.c (find_subloop_latch_edge_by_profile): Disable. + (find_subloop_latch_edge_by_ivs): Disable. + * tree-profile.c: Disable most functions. + * c-gimplify.c (add_block_to_enclosing): Disable. + * tree-vect-generic.c: Disable. + * tree-flow.h (struct function_ann_d): Disable field + reference_vars_info. + * Makefile.in: Force -Werror even during stage 1. + (OBJS-common): Add gimple-dummy.o. + (GTFILES): Remove tree-scalar-evolution.c, + tree-ssa-propagate.c, tree-vect-generic.c, + tree-ssa-structalias.h, tree-ssa-structalias.c, + ipa-reference.h, omp-low.c, tree-phinodes.c, ipa-reference.c + * tree-ssa-structalias.c: Disable. + * tree-cfg.c: Disable most functions. + * passes.c (finish_optimization_passes): Disable call to + end_branch_prob. + (init_optimization_passes): Disable the registration of + several passes. + (execute_function_todo): Disable calls to update_ssa and + need_ssa_update_p. + * tree-ssa-reassoc.c: Disable. + * tree-ssanames.c: Disable. + * tree-ssa-threadedge.c: Disable. + * tree-ssa-operands.c: Disable. + +2007-08-29 Aldy Hernandez + + * tree-ssa-operands.h (pop_stmt_changes, push_stmt_changes): + Argument is gimple. + (struct ssa_operand_iterator_d): Member phi_stmt is gimple. + * value-prof.c (gimple_add_histogram_value): Adjust for tuples. + (gimple_duplicate_stmt_histograms): Same. + * value-prof.h (gimple_add_histogram_value): Same. + (gimple_duplicate_stmt_histograms): Same. + * tree-flow-inline.h (clear_and_done_ssa_iter): Same. + (op_iter_init): Same. + (op_iter_init_phiuse): Same. + * tree-flow.h (stmt_references_memory_p): Same. + * tree-cfg.c (tree_can_merge_blocks_p): Same. + (remove_bb): Same. + (find_taken_edge): Same. + (tree_cfg2vcg): Same. + (first_stmt): Same. + (last_stmt): Same. + (bsi_move_after): Same. + (bsi_move_before): Same. + (tree_find_edge_insert_loc): Same. + Remove code handling a GIMPLE_MODIFY_STMT inside a RETURN_EXPR. + (delete_tree_cfg_annotations): Remove code to remove annotations. + * tree-ssa-operands.c (struct scb_d): Stmt_p is a gimple *. + (push_stmt_changes): Adjust for tuples. + (mark_difference_for_renaming): Same. + (pop_stmt_changes): Same. + (stmt_references_memory_p): Same. + +2007-08-29 Aldy Hernandez + + * tree-ssa-operands.h: Remove DEF_OPS, USE_OPS, VUSE_OPS, + VDEF_OPS, LOADED_SYMS, STORED_SYMS. + * tree-pretty-print.c (dump_generic_node): Adjust accordingly. + (dump_vops): use gimple_v*_ops. Adjust accordingly. + * gimple.def: Add to comment. + * tree-ssa-alias.c (create_structure_vars): Adjust for tuples. + * tree-flow-inline.h (op_iter_init): Make stmt gimple. Use + gimple_*_ops functions. + (op_iter_init_use): Make stmt gimple. + (op_iter_init_def): Same. + (op_iter_init_vdef): Same. + (single_ssa_tree_operand): Same. + (single_ssa_use_operand): Same. + (single_ssa_def_operand): Same. + (zero_ssa_operands): Same. + (num_ssa_operands): Same. + (compare_ssa_operands_equal): Make stmt[12] gimple. + (link_use_stmts_after): Adjust for tuples. + * tree-ssa-structalias.c (update_alias_info): Use + gimple_stored_syms and gimple_loaded_syms. + * gimple.h (gimple_has_mem_ops): New. + (gimple_def_ops): New. + (set_gimple_def_ops): New. + (gimple_use_ops): New. + (set_gimple_use_ops): New. + (gimple_vuse_ops): New. + (set_gimple_vuse_ops): New. + (gimple_vdef_ops): New. + (set_gimple_vdef_ops): New. + (gimple_loaded_syms): New. + (gimple_stored_syms): New. + * tree-ssa-operands.c (finalize_ssa_defs): Adjust for tuples. + (copy_virtual_operands): Same. + (swap_tree_operands): Same. + +2007-08-28 Aldy Hernandez + + * Revert the parts of Kaveh's constification patch.that duplicate + API calls. + +2007-08-27 Diego Novillo + + Merge with mainline @127831. + + * configure.ac (ACX_PKGVERSION): Update revision merge string. + * configure: Regenerate. + +2007-08-25 Diego Novillo + + * tree.c (build_gimple_modify_stmt_stat): Add depecrate note. + * omp-low.c (scan_omp_1): Disable. + (scan_omp): Likewise. + (lower_omp_for): Likewise. + (lower_omp_parallel): Likewise. + (lower_omp_1): Likewise. + (lower_omp): Likewise. + (diagnose_sb_1): Likewise. + (diagnose_sb_2): Likewise. + (diagnose_omp_structured_block_errors): Likewise. + * tree-gimple.h (_TREE_GIMPLE_H): Rename from _TREE_SIMPLE_H. + (gimplify_body): Return the new GIMPLE body. + (struct walk_stmt_info): Move to gimple.h. + * gimple-low.c (lower_function_body): Assert that the function + body is a single GIMPLE_BIND statement. + Create a new gimple sequence to lower the existing body. + Replace the function body with the new lowered sequence. + (pass_lower_cf): Enable GIMPLE lowering. + (lower_omp_directive): Disable. + (lower_stmt): Do not call lower_omp_directive. + (gimple_stmt_may_fallthru): Factor out of ... + (gimple_seq_may_fallthru): ... here. + * gimple-iterator.c (gsi_replace): New. + * gimple-iterator.h (gsi_replace): Declare. + * gimple-pretty-print.c: Do not include gimple-iterator.h + * gimplify.c (gimplify_asm_expr): Tidy. + Store the whole TREE_LIST node in the inputs and outputs vectors. + (gimple_push_cleanup): Disable completely. + (gimplify_body): Return a GIMPLE_BIND holding the gimplified + body. + Update all users. + (gimplify_function_tree): Create a GIMPLE sequence to hold + the gimplified body. + * tree-flow.h (gimple_stmt_may_fallthru): Declare. + * Makefile.in (GIMPLE_H): Add gimple-iterator.h. + +2007-08-25 Diego Novillo + + * tree-nested.c: Re-implement to use GIMPLE tuples. + (init_tmp_var_with_call): New. + (init_tmp_var): Adapt to GIMPLE tuples. + (save_tmp_var): Likewise. + (convert_nl_goto_receiver): Likewise. + (finalize_nesting_tree_1): Likewise. + (gsi_gimplify_val): Likewise. + Rename from tsi_gimplify_val. Update all users. + (walk_asm_expr): Remove. + (walk_stmts): Remove. + (walk_body): Call walk_gimple_seq. + Add new argument callback_op. Update all users. + (walk_function): Add argument callback_op. Update all users. + (convert_nonlocal_reference_op): Rename from + convert_nonlocal_omp_reference. Update all users. + (convert_nonlocal_reference_stmt): New. Handle GIMPLE + statements that used to be tree nodes. + (convert_local_reference_op): Rename from + convert_local_reference. Update all users. + (convert_local_reference_stmt): New. Handle GIMPLE statements + that used to be tree nodes. + (convert_nl_goto_reference): Convert to walk_stmt_fn callback. + Update all users. + (convert_tramp_reference_op): Rename from + convert_tramp_reference. Update all users. + (convert_tramp_reference_stmt): New. Handle GIMPLE statements + that used to be tree nodes. + (convert_gimple_call): Rename from convert_call_expr. Convert + to be a walk_stmt_fn callback. + * gimple.c (gimple_seq_add): Rename from gimple_add. Update + all users. + (walk_gimple_seq): Rename from walk_seq_ops. Update all + users. + (walk_gimple_stmt): Rename from walk_tuple_ops. Update all + users. + Use two callback functions one for statements and another for + operands. If either is NULL do not invoke it. + Allow callbacks to replace operands. + (WALKIT): Remove. + (walk_gimple_asm): New. + * gimple.h: Include ggc.h + (gimple_seq_alloc): New. Use everywhere a GIMPLE sequence is + allocated. + (gimple_op_ptr): New. + (gimple_call_arg_ptr): New. + (gimple_catch_types_ptr): New. + (gimple_eh_filter_types_ptr): New. + (gimple_omp_critical_name_ptr): New. + (gimple_omp_for_clauses_ptr): New. + (gimple_omp_for_index_ptr): New. + (gimple_omp_for_initial_ptr): New. + (gimple_omp_for_final_ptr): New. + (gimple_omp_for_incr_ptr): New. + (gimple_omp_parallel_clauses_ptr): New. + (gimple_omp_parallel_child_fn_ptr): New. + (gimple_omp_parallel_data_arg_ptr): New. + (gimple_omp_single_clauses_ptr): New. + (gimple_omp_sections_clauses_ptr): New. + (walk_stmt_fn): New type. + (struct walk_stmt_info): Move from tree-gimple.h. + Rename field callback to callback_op. + Add new field callback_stmt. + Replace field tsi with gsi of type gimple_stmt_iterator. + (walk_gimple_seq): Declare. + (walk_gimple_stmt): Declare. + * tree-cfg.c (execute_build_cfg): Do not call + build_gimple_cfg. + (pass_build_cfg): Enable. + Disable TODO_verify_stmts and TODO_cleanup_cfg. + +2007-08-22 Aldy Hernandez + + * tree-phinodes.c (reserve_phi_args_for_new_edge): Comment out + call to phi_nodes_ptr. + (remove_phi_node): Same. + * tree-flow-inline.h (get_lineno): Work with empty statements or + empty locations. + (phi_nodes_ptr): Remove. + (phi_arg_index_from_use): Adjust for tuples. + (bsi_stmt_ptr): Add ATTRIBUTE_UNUSED. + (op_iter_init): Remove assertion. + (next_imm_use_stmt): Change NULL_TREE to NULL. + * tree-dfa.c (mark_symbols_for_renaming): Adjust for tuples. + * tree-flow.h: Remove bb_for_stmt prototype. + (mark_symbols_for_renaming): Make argument gimple. + +2007-08-22 Aldy Hernandez + + Change all instances of bb_for_stmt to gimple_bb throughout. + + * gimple.h (gimple_omp_parallel_combined_p): New. + * tree-ssa-operands.h (update_stmt_operands): Argument is now + gimple. + * tree-ssa-threadupdate.c (rederiction_block_p): Use gimple_nop_p + instead of IS_EMPTY_STMT. + * tree-ssa-loop-niter.c: Disable use of COND_EXPR_COND. + * tree-pretty-print.c (dump_bb_header): Adjust for tuples. + * cgraph.c (cgraph_add_new_function): Rename + tree_register_cfg_hooks to gimple_register_cfg_hooks. + * value-prof.c (set_histogram_value): Stmt type is now gimple. + (gimple_histogram_value): Same. + (gimple_remove_histogram_value): Same. + (gimple_remove_stmt_histograms): Same. + * tree.h (struct ssa_use_operand_d): Same. + * value-prof.h (struct histogram_value_t): Same. + Change gimple_*histogram* prototypes to use gimple instead of + tree. + * ipa-cp.c (ipcp_insert_stage): Rename tree_register_cfg_hooks to + gimple_register_cfg_hooks. + * cfghooks.c (gimple_register_cfg_hooks): Rename from + tree_register_cfg_hooks. Initialize cfg_hooks to gimple_cfg_hooks. + (current_ir_type): Rename tree_cfg_hooks to gimple_cfg_hooks. + * input.h (IS_LOCATION_EMPTY): New. + * cfghooks.h: Rename tree_cfg_hooks to gimple_cfg_hooks. Rename + tree_register_cfg_hooks to gimple_register_cfg_hooks. + * omp-low.c (determine_parallel_type): Adjust for tuples. + (expand_omp_parallel): Rename bb_stmt_list to bb_seq. + (expand_omp_for_generic): Call gimple_omp_return_nowait_p. + (expand_omp_for_static_nochunk): Same. + (expand_omp_sections): Call gimple_omp_section_last_p. + (expand_omp_single): Comment out call to find_omp_clause. + Call gimple_omp_return_nowait_p. + * cgraphunit.c: Rename tree_register_cfg_hooks to + gimple_register_cfg_hooks. + * tree-ssa-propagate.c: Comment out non working code. + * matrix-reorg.c (matrix_reorg): Rename tree_register_cfg_hooks to + gimple_register_cfg_hooks. + * tree-eh.c (add_stmt_to_eh_region_fn): Change `t' type to gimple. + Adjust accordingly. + (add_stmt_to_eh_region): Same. + (remove_stmt_from_eh_region_fn): Same. + (remove_stmt_from_eh_region): Same. + (lookup_stmt_eh_region_fn): Same. + (lookup_stmt_eh_region): Same. + (make_eh_edges): Adjust for tuples. + (stmt_can_throw_internal): Rename from tree_can_throw_internal. + Adjust for tuples. + (maybe_clean_or_replace_eh_stmt): Arg types are now gimple. + * tree-vectorizer.c: Rename tree_register_cfg_hooks to + gimple_register_cfg_hooks. + * tree-if-conv.c (combine_blocks): Adjust for tuples. + * profile.c (branch_prob): Same. + * tree-flow-inline.h (bb_for_stmt): Remove. + (get_lineno): Adjust for tuples. + (noreturn_call_p): Same. + (mark_stmt_modified): Same. + (update_stmt): Same. + (update_stmt_if_modified): Same. + (stmt_modified_p): Same. + (link_imm_use_stmt): Same. + (relink_imm_use_stmt): Same. + (single_imm_use): Same. + (gimple_phi_arg_def): New. + (gimple_phi_arg_edge): New. + (phi_nodes): Adjust for tuples. + (phi_nodes_ptr): Same. + (set_phi_nodes): Same. + (bb_seq): Rename from bb_stmt_list and adjust for tuples. + (set_bb_seq): Rename from set_bb_stmt_list and adjust for tuples. + (bsi_start): Adjust for tuples. + (bsi_after_labels): Adjust for tuples. + (bsi_last): Same. + (bsi_next): Same. + (bsi_prev): Same. + (bsi_stmt): Same. + (bsi_stmt_ptr): Same. + (loop_containing_stmt): Same. + (delink_stmt_imm_use): Same. + (first_imm_use_stmt): Same. + (next_imm_use_stmt): Same. + * gimplify.c (force_gimple_operand_bsi): Same. + * coretypes.h (const_gimple): New. + * tree-ssa-phiopt.c (empty_block_p): Call gimple_nop_p. + (conditional_replacement): Comment out COND_EXPR_COND. + (value_replacement): Comment out COND_EXPR_COND. + (minmax_replacement): Same. + (abs_replacement): Same. + * except.h (*eh_region*): Change trees to gimple. + (struct throw_stmt_node): Change stmt type to gimple. + * cfgexpand.c (label_rtx_for_bb): Adjust for tuples. + (expand_gimple_cond_expr): Same. + (expand_gimple_basic_block): Same. + * tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Same. + * tree-ssa-pre.c (realify_fake_stores): Comment out non working + code. + * tree-ssa-forwprop.c (propagate_with_phi): Rename + tree_can_throw_internal stmt_can_throw_internal. + * tree-inline.c (copy_edges_for_bb): Rename + tree_can_throw_internal to stmt_can_throw_internal. + (initialize_cfun): Same. + (copy_cfg_body): Same. + (gimple_expand_calls_inline): Same. + (make_nonlocal_label_edges): Rename tree_can_make_abnormal_goto to + stmt_can_make_abnormal_goto. + * tree-optimize.c (tree_lowering_passes): Rename + tree_register_cfg_hooks to gimple_register_cfg_hooks. + (tree_rest_of_compilation): Same. + * tree-flow.h (struct gimple_df): Make modified_noreturn_calls a + vector of gimple types. + Adjust prototypes for tuples. + (struct block_stmt_iterator): Make iterator a gimple iterator. + (enum bsi_iterator_update): Remove BSI_CHAIN_START and + BSI_CHAIN_END. + * Makefile.in (tree-cfg.o): Depend on GIMPLE_H. + (GTFILES): Move gimple.[hc] entries before tree-flow.h. + * basic-block.h (struct edge_def): Make goto_locus of type + location_t. + (union basic_block_il_dependent): Adjust for tuples. + (gimple_bb_info): Rename from tree_bb_info. Adjust for tuples. + * tree-cfg.c: Include gimple.h. + Adjust prototypes for tuples. + (build_gimple_cfg): Rename from build_tree_cfg. Adjust for + tuples. + (execute_build_cfg): Rename build_tree_cfg call to + build_gimple_cfg. + (factor_computed_gotos): Adjust for tuples. + (make_blocks): Same. + (create_bb): Same. + (fold_cond_expr_cond): Same. + (make_edges): Same. + (make_cond_expr_edges): Same. + (make_switch_expr_edges): Same. + (make_goto_expr_edges): Same. + (cleanup_dead_labels): Same. + (group_case_labels): Same. + (tree_can_merge_blocks_p): Same. + (replace_uses_by): Same. + (tree_merge_blocks): Same. + (is_ctrl): Same. + (is_ctrl_altering_stmt): Same. + (computed_goto_p): Same. + (simple_goto_p): Same. + (stmt_can_make_abnormal_goto): Rename from + tree_can_make_abnormal_goto. + Adjust for tuples. + (stmt_starts_bb_p): Adjust for tuples. + (stmt_ends_bb_p): Same. + (first_stmt): Same. + (last_stmt): Same. + (last_and_only_stmt): Same. + (set_bb_for_stmt): Same. + (change_bb_for_stmt): Same. + (bsi_for_stmt): Same. + (update_modified_stmt): Rename from update_modified_stmts. + Adjust for tuples. + Handle only one statement. + (bsi_insert_before): Adjust for tuples. + (bsi_insert_after): Same. + (bsi_insert_seq_before): New. + (bsi_insert_seq_after): New. + (bsi_remove): Ajust for tuples. + (bsi_replace): Same. + (verify_stmt): Same. + (gimple_split_block): Rename from tree_split_block. + Adjust for tuples. + (tree_purge_dead_abnormal_call_edges): Adjust for tuples. + (tree_cfg_hooks): Same. + * tree-ssa-operands.c (update_stmt_operands): Same. + +2007-08-22 Aldy Hernandez + + * Makefile.in (TREE_GIMPLE_H): Depend on GIMPLE_H. + * gimple-iterator.h: Do not include gimple.h. + * gimple.h (OMP_SECTION_LAST_FLAG): New. + (gimple_omp_return_nowait_p): New. + (gimple_omp_section_last_p): New. + (gimple_switch_set_num_labels): New. + (gimple_nop_p): New. + +2007-08-17 Aldy Hernandez + + Revert this change: + + 2007-08-14 Aldy Hernandez + + * gimple.c (gimple_call_flags): Make sure this is a GIMPLE_CALL. + +2007-08-14 Aldy Hernandez + + * gimple-iterator.c (gsi_split_seq_after): New. + (gsi_split_seq_before): New. + * gimple-iterator.h: Prototype above two functions. + +2007-08-14 Aldy Hernandez + + * gimple.h (gimple_has_ops): New. + (gimple_modified): New. + (set_gimple_modified): New. + (gimple_switch_default_label): Call gimple_switch_label. + (gimple_switch_set_default_label): Call gimple_switch_set_label. + +2007-08-14 Aldy Hernandez + + * gimple.c (gimple_call_flags): Make sure this is a GIMPLE_CALL. + +2007-08-14 Diego Novillo + + Merge with mainline @127480. + + * version.c (VERSUFFIX): Update. + +2007-08-09 Diego Novillo + + * gimple-low.c: Document conversion to Low GIMPLE. + * Makefile.in (gimple.o): Add dependency on gt-gimple.h + (GTFILES): Add gimple.c. + * gimple.c (gimple_bodies_vec): New. + (gimple_bodies_map): Rename from gimple_bodies. + (gss_for_code): Return GSS_ASM for GIMPLE_ASM. + (walk_tuple_ops): Handle GSS_ASM like GSS_WITH_OPS. + (set_gimple_body): Push body into gimple_bodies_vec and create + a mapping to array index in gimple_bodies_map. + (gimple_body): Corresponding changes to use gimple_bodies_map + and gimple_bodies_vec. + * gimple.h: Create VEC templates for gimple_seq. + +2007-08-08 Aldy Hernandez + + * gimple-low.c (struct return_statements_t): Declare. + (struct lower_data): Make return_statements a vector. + (lower_function_body): Adjust for tuples. + (pass_lower_cf): Add PROP_gimple_any to properties_required. + (lower_sequence): Rename from lower_stmt_body. + Adjust for tuples. + (lower_omp_directive): Adjust for tuples. + (lower_stmt): Same. + (lower_gimple_bind): Rename from lower_bind_expr. + Adjust for tuples. + (gimple_try_catch_may_fallthru): New. + (gimple_seq_may_fallthru): New. + (lower_gimple_return): Rename from lower_return_expr and adjust + for tuples. + (lower_builtin_setjmp): Adjust for tuples. + * gimple-iterator.c: New. + * gimple-iterator.h: Include gimple.h. + (enum gsi_iterator_update): Declare. + (gsi_link_seq_before): New prototype. + (gsi_link_before): Same. + (gsi_link_seq_after): Same. + (gsi_link_after): Same. + (gsi_delink): Same. + * gimplify.c (gimplify_body): Comment out verify_gimple_1 call. + * tree-flow.h (gimple_seq_may_fallthru): New prototype. + * Makefile.in (OBJS-common): Add gimple-iterator.o. + (gimple-iterator.o): New. + (gimple-pretty-print.o): Do not depend on gimple-iterator.h. + * gimple.c (set_gimple_prev): Move to gimple.h. + (set_gimple_next): Same. + (gimple_call_flags): New. + * gimple.h (struct gimple_sequence): Add GTY marker. + (struct gimple_statement_bind): Add block field. + (set_gimple_prev): New. + (set_gimple_next): New. + (gimple_call_flags): Protoize. + (gimple_call_fndecl): New. + (gimple_bind_block): New. + (gimple_bind_set_block): New. + + +2007-08-08 Diego Novillo + + * gimple.h (GIMPLE_CHECK, GIMPLE_CHECK2, GIMPLE_RANGE_CHECK): + Do not return the checked statement. Update all users. + Enable on compilers other than GCC. + +2007-08-07 Chris Matthews + + * gimple_iterator.h (gsi_start): Changed to produce a pointer instead of + struct. Updated clients. + (gsi_last): Same. + (gsi_end_p): Changed to operate on a pointer instead of struct. Updated + clients. + (gsi_one_before_end_p): Same. + (gsi_next): Same. + (gsi_prev): Same. + (gsi_stmt): Same. + +2007-08-07 Diego Novillo + + Merge with mainline @127277. + + * version.c (VERSUFFIX): Update. + +2007-08-07 Diego Novillo + + * gimple.h (gimple_call_return): New. + * gimplify.c (get_tmp_var_for): Call it. + +2007-08-02 Chris Matthews + + * gimplify.c (gimplify_asm_expr): Created new gimple tuple. + * gimple-pretty-printer.c (dump_gimple_asm): Added function to dump a + GIMPLE_ASM statement. + (dump_gimple_stmt): Updated to use the dump_gimple_asm function. + * gimple.c (gss_for_code): Made asm statements return as with_mem_ops. + (build_gimple_with_ops): Asm statements are added as a specal case for + allocation because they have extra fields that are not + allocated correctly in the current generic op allocator. + (build_gimple_asm_1): Added a helper function to setup the basics of a + GIMPLE_ASM tuple. + (build_gimple_asm_vec): Create a GIMPLE_ASM tuple from vector arguments. + (build_gimple_asm): Changed to call the new helper function. + +2007-08-03 Diego Novillo + + * gimple-pretty-print.c (INDENT): Tidy. + (dump_binary_rhs): New. + (dump_gimple_assign): Call it. + * gimplify.c (gimplify_modify_expr_complex_part): If the value + is not interesting, nullify *EXPR_P. + (gimplify_body): Do not add the sequence to the GIMPLE_BIND more + than once. + +2007-08-01 Diego Novillo + + * gimplify.c (gimplify_switch_expr): Remove switch_body_seq_. + Change switch_body_seq to struct gimple_sequence. + Adjust all uses. + Call gimplify_stmt instead of gimplify_statement_list + (gimplify_to_stmt_list): Remove. + Update all users. + * tree-mudflap.c: Include gimple.h + (mf_decl_cache_locals): Convert to emit GIMPLE. + (mf_build_check_statement_for): Add FIXME and unreachable + markers to convert to GIMPLE. + * Makefile.in (tree-mudflap.o): Depend on $(GIMPLE_H). + * config/i386/i386.c (ix86_gimplify_va_arg): Adapt to emit + GIMPLE. + +2007-08-01 Diego Novillo + + * gimplify.c (gimplify_switch_expr): Do not call sort_case_labels + if there are no labels other than 'default'. + * gimple.h (gimple_num_ops, gimple_op, gimple_set_op): Use + result of GIMPLE_RANGE_CHECK call. + +2007-08-01 Diego Novillo + + * DEV-PHASE: Revert to mainline version. + * version.c (VERSUFFIX): Add branch name and revision number + of latest mainline merge. + +2007-07-31 Diego Novillo + + Mainline merge (@127100). + * DEV-PHASE: Updated. + +2007-07-31 Diego Novillo + + * dominance.c (free_dominance_info): If there is no CFG, + do nothing. + * cfg.c (compact_blocks): Likewise. + +2007-07-30 Diego Novillo + + * gimplify.c (get_tmp_var_for): When creating a new temporary + for a GIMPLE_CALL, use the type returned by the function call + instead of the type of the function decl. + * gimple.c (build_gimple_return): Accept NULL and RESULT_DECL + return values. + +2007-07-30 Diego Novillo + + * gimplify.c (gimplify_init_constructor): If both sides + of the constructor are in GIMPLE form but the assignment + has not been emitted, emit it. + +2007-07-28 Diego Novillo + + * gimplify.c (gimplify_return_expr): Do not create a MODIFY_EXPR + as return argument + * gimple.c (build_gimple_return): Assert that the returned value + is a GIMPLE value. + +2007-07-27 Diego Novillo + + * tree-gimple.c (get_gimple_rhs_class): New. + (is_gimple_formal_tmp_rhs): Call it. + * tree-gimple.h (enum gimple_rhs_class): New. + * gimple-iterator.h (gsi_next): Assert that there is nothing + beyond the end of the sequence. + (gsi_prev): Assert that there is nothing before the start of + the sequence. + * gimplify.c (gimplify_switch_expr): Tidy creation of default label. + (gimplify_expr): Fix concatenation of internal sequences to PRE_P. + * gimple.c (get_num_ops_for): Remove. Update users. + (build_gimple_assign): Call get_gimple_rhs_class to determine + how many operands to allocate. + (gimple_add): Assert that GS does not have previous or next + statements. + (gimple_seq_append): Move from gimple.h. + +2007-07-27 Aldy Hernandez + + * cgraph.c: Fix line wrap. + * cgraph.h: Same. + * tree-pass.h (struct tree_opt_pass): Add works_with_tuples_p + field. + * cgraphunit.c (cgraph_analyze_functions): Remove check for + DECL_SAVED_TREE. + (cgraph_expand_function): Comment out TREE_ASM_WRITTEN assertion. + * tree-optimize.c (tree_lowering_passes): Comment out call to + compact_blocks. + * passes.c (execute_one_pass): Return if pass has not been + converted to tuples. + * tree-vrp.c, regrename.c, fwprop.c, tree-into-ssa.c, + tree-complex.c, see.c, cgraphbuild.c, tracer.c, cgraph.c, + postreload-gcse.c, postreload.c, tree-ssa-loop-ch.c, + tree-tailcall.c, tree-pass.h, ipa-cp.c, final.c, omp-low.c, + tree-ssa-dse.c, ipa-reference.c, tree-ssa-uncprop.c, + auto-inc-dec.c, reorg.c, tree-ssa-copyrename.c, tree-ssa-ccp.c, + df-core.c, mode-switching.c, tree-nomudflap.c, modulo-sched.c, + ipa-pure-const.c, cse.c, web.c, tree-stdarg.c, + tree-ssa-math-opts.c, tree-ssa-dom.c, tree-nrv.c, + tree-ssa-alias.c, loop-init.c, gimple-low.c, tree-ssa-sink.c, + ipa-inline.c, global.c, jump.c, ifcvt.c, predict.c, + tree-ssa-loop.c, recog.c, dse.c, tree-ssa-ifcombine.c, + matrix-reorg.c, c-decl.c, tree-eh.c, regmove.c, local-alloc.c, + function.c, tree-vectorizer.c, gcse.c, ipa-type-escape.c, + tree-if-conv.c, init-regs.c, ipa.c, tree-ssa-phiopt.c, + rtl-factoring.c, lower-subreg.c, bt-load.c, tree-dfa.c except.c, + emit-rtl.c, cfgexpand.c, tree-cfgcleanup.c, cfgcleanup.c, + tree-ssa-pre.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, + cfglayout.c, tree-ssa-forwprop.c, tree-ssa-dce.c, tree-ssa.c, + regclass.c, integrate.c, tree-optimize.c, tree-object-size.c, + combine.c, tree-outof-ssa.c, bb-reorder.c, stack-ptr-mod.c, + var-tracking.c, tree-profile.c, tree-vect-generic.c, reg-stack.c, + sched-rgn.c, tree-ssa-structalias.c, tree-cfg.c, passes.c, + tree-ssa-reassoc.c, combine-stack-adj.c, cfgrtl.c, dce.c, + tree-ssanames.c: Set works_with_tuples_p field to 0. + +2007-07-25 Diego Novillo + + * gimple.c: Use ENABLE_GIMPLE_CHECKING instead of + ENABLE_TREE_CHECKING. + (set_gimple_code): New. + (set_gimple_prev): New. + (set_gimple_next): New. + * gimple.h: Use ENABLE_GIMPLE_CHECKING instead of + ENABLE_TREE_CHECKING. + (gimple_code): Inline function replacement for GIMPLE_CODE. + (gimple_flags): Inline function replacement for GIMPLE_SUBCODE_FLAGS. + (gimple_next): Inline function replacement for GIMPLE_NEXT. + (gimple_prev): Inline function replacement for GIMPLE_PREV. + (gimple_locus): Inline function replacement for GIMPLE_LOCUS. + (gimple_locus_empty_p): Inline function replacement for + GIMPLE_LOCUS_EMPTY_P. + (struct gimple_statement_base): Rename field 'subcode_flags' + to 'flags'. + (set_gimple_flags): New. + (gimple_bb): New. + (set_gimple_bb): New. + (set_gimple_block): New. + (set_gimple_locus): New. + (add_gimple_flag): Rename from gimple_add_subcode_flag. + +2007-07-25 Diego Novillo + + * tree-gimple.h (build_gimple_eh_filter_tree): Rename from + gimple_build_eh_filter_tree. + * gimple.h (build_gimple_return): Rename from gimple_build_return. + (build_gimple_assign): Rename from gimple_build_assign. + (build_gimple_call_vec): Rename from gimple_build_call_vec. + (build_gimple_call): Rename from gimple_build_call. + (build_gimple_label): Rename from gimple_build_label. + (build_gimple_goto): Rename from gimple_build_goto. + (build_gimple_nop): Rename from gimple_build_nop. + (build_gimple_bind): Rename from gimple_build_bind. + (build_gimple_asm): Rename from gimple_build_asm. + (build_gimple_catch): Rename from gimple_build_catch. + (build_gimple_eh_filter): Rename from gimple_build_eh_filter. + (build_gimple_try): Rename from gimple_build_try. + (build_gimple_phi): Rename from gimple_build_phi. + (build_gimple_resx): Rename from gimple_build_resx. + (build_gimple_switch): Rename from gimple_build_switch. + (build_gimple_switch_vec): Rename from gimple_build_switch_vec. + (build_gimple_omp_parallel): Rename from gimple_build_omp_parallel. + (build_gimple_omp_for): Rename from gimple_build_omp_for. + (build_gimple_omp_critical): Rename from gimple_build_omp_critical. + (build_gimple_omp_section): Rename from gimple_build_omp_section. + (build_gimple_omp_continue): Rename from gimple_build_omp_continue. + (build_gimple_omp_master): Rename from gimple_build_omp_master. + (build_gimple_omp_return): Rename from gimple_build_omp_return. + (build_gimple_omp_ordered): Rename from gimple_build_omp_ordered. + (build_gimple_omp_sections): Rename from gimple_build_omp_sections. + (build_gimple_omp_single): Rename from gimple_build_omp_single. + Update all users. + +2007-07-24 Chris Matthews + + * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the + --enable-checking=gimple flag. + * config.in: Same. + * configure: Regenerated. + * gimplify.c (cpt_same_type): Same. + (gimple_push_condition): Same. + (gimplify_addr_expr): Same. + (gimplify_expr): Same. + (gimplify_body): Same. + (check_pointer_types_r): Same. + +2007-07-24 Diego Novillo + + * gimple.def: Re-organize codes that take tree operands so + they are consecutive. + * gsstruct.def (GSS_LABEL, GSS_ASSIGN_BINARY, GSS_ASSIGN_UNARY_REG, + GSS_ASSIGN_UNARY_MEM, GSS_COND, GSS_GOTO, GSS_SWITCH, GSS_CALL, + GSS_RETURN): Remove. Update al users. + * gimple.c (gss_for_code): New. + (gimple_statement_structure): Call it. + (get_num_ops_for): New. + (gimple_build_with_ops): New. + (gimple_build_return, gimple_build_call_1, gimple_build_assign, + gimple_build_cond, gimple_build_label, gimple_build_goto, + gimple_build_switch_1, ): Call it. + (gss_for_assign): Remove. Update all users. + (gimple_check_failed): Do not assume that subcode is a valid tree + code. + (gimple_range_check_failed): New. + (walk_tuple_ops): Implement in terms of gimple_num_ops and + gimple_op when dealing with GSS_WITH_OPS and GSS_WITH_MEM_OPS + statements. + * gimple.h (struct gimple_statement_with_ops): Add fields 'num_ops' + and 'op'. + (struct gimple_statement_label, gimple_statement_assign_binary, + gimple_statement_assign_unary_reg, gimple_statement_assign_unary_mem, + gimple_statement_cond, gimple_statement_goto, gimple_statement_switch, + gimple_statement_call, gimple_statement_return): Remove. + Update all users. + (gimple_range_check_failed): Declare. + (GIMPLE_RANGE_CHECK): Define. + (gimple_num_ops): New. + (gimple_op): New. + (gimple_set_op): New. + (gimple_assign_rhs1): Rename from gimple_assign_binary_rhs1. + (gimple_assign_set_rhs1): Rename from gimple_assign_binary_set_rhs1. + (gimple_assign_rhs2): Rename from gimple_assign_binary_rhs2. + (gimple_assign_set_rhs2): Rename from gimple_assign_binary_set_rhs2. + (gimple_assign_unary_rhs): Remove. Update all users. + (gimple_assign_unary_set_rhs): Likewise. + (gimple_switch_num_labels): Rename from gimple_switch_nlabels. + (gimple_call_fn, gimple_call_lhs, gimple_call_chain, + gimple_call_set_chain, gimple_call_nargs, gimple_call_arg, + gimple_call_set_arg, gimple_cond_lhs, gimple_cond_set_lhs, + gimple_cond_rhs, gimple_cond_set_rhs, gimple_cond_true_label, + gimple_cond_false_label, gimple_cond_set_true_label, + gimple_cond_set_false_label, gimple_label_label, + gimple_label_set_label, gimple_goto_dest, + gimple_goto_set_dest, gimple_asm_input_op, + gimple_asm_set_input_op, gimple_asm_output_op, + gimple_asm_set_output_op, gimple_asm_clobber_op, + gimple_asm_set_clobber_op, gimple_switch_num_labels, + gimple_switch_index, gimple_switch_set_index, + gimple_switch_default_label, gimple_switch_set_default_label, + gimple_switch_label, gimple_switch_set_label, + gimple_return_retval, gimple_return_set_retval): Implement + using the array of operands in field 'with_ops'. + (gimple_asm_set_ninputs, gimple_asm_set_noutputs, + gimple_asm_set_nclobbered, gimple_asm_set_string): Remove. + Update all users. + + +2007-07-24 Aldy Hernandez + + * tree.c (get_callee_fndecl): Revert previous change. + * gimplify.c (gimplify_call_expr): Use result from + get_callee_fndecl if available. + * c-common.c (c_warn_unused_result): Do not use + get_callee_fndecl. + Add assertion. + +2007-07-24 Diego Novillo + + Merge with mainline (@126872) + +2007-07-23 Aldy Hernandez + + * tree.c (get_callee_fndecl): Work when only the CALL_EXPR_FN has + been passed. + * c-common.c (c_warn_unused_result): Use get_callee_fndecl. + +2007-07-23 Aldy Hernandez + + * c-decl.c: Include gimple.h. + (c_gimple_diagnostics_recursively): Call c_warn_unused_result with + tuplified body. + Exit if -fgimple-only. + * gimplify.c (gimplify_call_expr): Call gimple_build_call_vec with + the correct callee. + * c-gimplify.c (c_genericize): Remove exit. + * c-common.c: Include gimple.h. + (c_warn_unused_result): Tuplify. + * c-common.h (c_warn_unused_result): Protoize. + * Makefile.in (c-decl.o): Depend on GIMPLE_H. + (c-common.o): Same. + * gimple.c (gimple_build_catch): Handler is a sequence. + Adjust accordingly. + (gimple_build_eh_filter): Failure is a sequence. + Adjust accordingly. + (walk_tuple_ops): case GIMPLE_CATCH: Walk handler as a sequence. + case GIMPLE_EH_FILTER: Walkder failure as a sequence. + * gimple.h (gimple_statement_catch): Make handler a sequence. + (gimple_statement_eh_filter): Make failure a sequence. + (gimple_build_catch): Make second argument a sequence. + (gimple_build_eh_filter): Same. + (gimple_catch_handler): Return a sequence. + (gimple_catch_set_handler): Make second argument a sequence. + (gimple_eh_filter_failure): Return a sequence. + (gimple_eh_filter_set_failture): Make second argument a sequence. + +2007-07-20 Aldy Hernandez + + * gimplify.c (gimplify_return_expr): Handle an empty ret_expr + gracefully. + +2007-07-19 Aldy Hernandez + + * testsuite/gcc.dg/gimple/instrument.c: New. + * gimplify.c (gimplify_function_tree): Generate tuples for function + instrumentation. + +2007-07-18 Aldy Hernandez + + * gimplify.c (gimple_add_tmp_var): Remove abort. Add comment. + +2007-07-18 Aldy Hernandez + + * gimplify.c (gimple_add_tmp_var): Remove abort. Add comment. + +2007-07-18 Aldy Hernandez + + * gimplify.c (gimplify_and_add): Remove unecessary temporary sequence. + Remove fixme. Add comment. + (gimplify_loop_expr): Tuplefy. + (gimplify_bind_expr): Streamline GIMPLE_TRY_FINALLY tuple. + (gimplify_expr): Tuplefy TRY_*_EXPR cases. + * gimple.c: Fix some spacing. + (gimple_build_try, gimple_omp_build_*): Handle empty sequences. + (gimple_push): Remove. + * gimple.h (gimple_push): Remove. + +2007-07-18 Aldy Hernandez + + * tree-gimple.h (declare_vars): Update arguments. + * gimplify.c (pop_gimplify_context): Enable call to declare_vars. + (declare_vars): Convert to use tuples. + (gimple_add_tmp_var): Same. + * gimple.h (GIMPLE_BLOCK): New. + +2007-07-17 Chris Matthews + + * gimplify.c (gs_build_eh_filter): Renamed to gs_build_eh_filter_tree + to avoid name conflict. + * gimple-pretty-print.c: Renamed to debug_gs_* to debug_gimple_*. + Updated all users. + * gimple.h: Renamed all functions with GS and gs prefixes to GIMPLE and + gimple, and updated users. + Renamed gs_seq_* functions to gimple_seq_*. Updated all users. + * gimple.def: Definitions changed to from GS_* to GIMPLE_*. + +2007-07-16 Chris Matthews + + * gimple.c (gs_build_switch): Changed nlabels to represent total number + of labels including the default. + (gs_build_switch_1): Same. + (walk_tuple_ops): Same. + * gimple-pretty-print.c (dump_gs_switch): Same. + +2007-07-16 Aldy Hernandez + + * gimplify.c (gimplify_ctx): Rename current_bind_expr_seq to + bind_expr_stack and make it a vector. + (push_gimplify_context): Adjust bind_expr_stack for vectors. + (pop_gimplify_context): Same. + (gimple_push_bind_expr): Same. + (gimple_pop_bind_expr): Same. + (gimple_current_bind_expr): Same. + (get_tmp_var_for): Use ``code''. + (gimplify_bind_expr): Remove comment. + (gimplify_case_label_expr): Add whitespace. + * gimple.c (gs_pop): Remove. + * gimple.h: Define vectors of a gimple type. + (gs_pop): Remove prototype. + * Makefile.in (GIMPLE_H): Add vec.h. + +2007-07-15 Diego Novillo + + * gimple.c: Rename from gimple-ir.c. + Update all users. + * gimple.h: Rename from gimple-ir.h. + Update all users. + +2007-07-15 Diego Novillo + + * gimple-ir.c (gimple_statement_structure): Remove code + after gcc_unreachable call. + * gimplify.c (get_tmp_var_for): New. + (gimplify_call_expr): Call it. + +2007-07-14 Aldy Hernandez + + * testsuite/gcc.dg/gimple/with_size_expr.c: Check for GS_TRY. + * Makefile.in (gimple-ir.o): Add diagnostic.h dependency. + * gimple-pretty-print.c (dump_gs_call): Dump LHS if available. + (dump_gs_try): New. + (dump_gimple_stmt): Add case for GS_TRY. + * gimple-ir.c. Include diagnostic.h. + (gs_build_try): Cleanup and eval are sequences. + Remove catch_p and finally_p arguments. Add catch_finally argument. + (gs_omp_build_critical): Body is a gs_seq. + (gs_omp_build_parallel): Same. + (gs_omp_build_section): Same. + (gs_omp_build_master): Same. + (gs_omp_build_continue): Same. + (gs_omp_build_ordered): Same. + (gs_omp_build_sections): Same. + (gs_omp_build_single): Same. + (gs_omp_build_for): Body and pre_body is a gs_seq. + (gs_push): New. + (gs_pop): New. + (walk_tuple_ops): Walk GS_TRY tuples eval and cleanups correctly. + Dump tuple before we ICE. + * gimple-ir.h (gs_seq_copy): New. + (struct gimple_statement_try): Eval and cleanups are gs_seq's. + (gs_bind_set_body): Use gs_seq_copy. + (gs_try_eval): Return address of eval. + (gs_try_cleanup): Return address of cleanup. + (gs_try_set_eval): Use gs_seq_copy. + (gs_try_set_cleanup): Same. + (gs_omp_set_body): Same. + (gs_omp_for_set_pre_body): Same. + * gimplify.c (struct gimplify_ctx): Rename current_bind_expr to + current_bind_expr_seq, and make it a sequence. + (pop_gimplify_context): Adjust for current_bind_expr_seq. + (gimple_push_bind_expr): Same. + (gimple_pop_bind_expr): Same. + (gimple_current_bind_expr): Same. + (build_stack_save_restore): Generate tuples. + (gimplify_bind_expr): Same. + +2007-07-13 Diego Novillo + + * gimple-ir.c (gs_add): Swap arguments. + Update all users. + * gimple-ir.h (gs_seq_append): Likewise. + +2007-07-12 Diego Novillo + + * tree.c (create_artificial_label): Move from gimplify.c + (get_name): Likewise. + * tree.h (create_artificial_label, get_name): Move + declarations earlier in the file. + * diagnostic.h (dump_gimple_stmt, print_gimple_stmt, + dump_gimple_seq): Rearrange. + * tree-gimple.h (gimplify_function_tree): Move from tree.h. + * gimple-pretty-print.c (do_niy): Tidy. + (maybe_init_pretty_print): Add comment. + (newline_and_indent): Likewise. + Remove "gimpleir: " prefix. + (debug_gimple_stmt): Add comment. + (dump_gs_seq): Remove. + (dump_gimple_seq): Add argument SPC. + Update all users. + If FLAGS contains TDF_DETAILS, emit "gimpleir:" prefix. + (dump_gs_cond): If FLAGS contains TDF_DETAILS, emit + "gimpleir:" prefix. + (dump_gs_bind): Likewise. + * function.h (struct function): Remove field 'gimplified'. + * gimple-ir.c (gimple_bodies): New private variable. + (set_gimple_body): New. + (gimple_body): New. + * gimple-ir.h: Include pointer-set.h. + Add comment before data structure definitons. + (set_gimple_body): Declare. + (gimple_body): Declare. + * gimplify.c (create_artificial_label): Move to tree.c + (get_name): Likewise. + (gimplify_function_tree): Change return type to void. + Call set_gimple_body after gimplification and nullify + DECL_SAVED_TREE. + Update all callers. + * common.opt (fgimple-only): New option. + * tree-optimize.c (tree_rest_of_compilation): Do not nullify + DECL_SAVED_TREE. + * c-gimplify.c (c_genericize): Restore gimplification logic to + mainline version. + If -fgimple-only was given, exit. + * Makefile.in (GIMPLE_IR_H): Add pointer-set.h + * tree-cfg.c (execute_build_cfg): Nullify GIMPLE body after + building the CFG. + (dump_function_to_file): If DECL_SAVED_TREE is NULL dump the + GIMPLE body of the function. + +2007-07-12 Diego Novillo + + * omp-low.c (lower_regimplify): Use a local GIMPLE sequence to + hold the result from gimplification. + * tree-gimple.c (is_gimple_min_val): Reformat. + * tree-gimple.h (enum fallback_t): Document values. + (gimplify_expr): Remove IS_STATEMENT argument. + Update all users. + * langhooks.c (lhd_gimplify_expr): Likewise. + * gimplify.c (gimplify_statement_list): If a temporary + was returned from voidify_wrapper_expr abort to mark the failure. + (gimplify_expr): Remove argument IS_STATEMENT. + Update all users. + Assert that FALLBACK is used with the appropriate GIMPLE_TEST_F + Restore logic to use internal queue. + Do not abort if on return from gimplify_call_expr, *EXPR_P has + a CALL_EXPR. + +2007-07-12 Aldy Hernandez + + * gimple-ir.c (gs_build_switch_1): Allocate one less tree. + (gs_build_switch_1): Offset labels by one. + (gs_switch_label): Same. + (gs_switch_set_label): Same. + +2007-07-12 Aldy Hernandez + + * gimple-ir.c (walk_seq_ops): Rename from walk_tree_seq. + (walk_tuple_ops): Rename from walk_tree_tuple. + * gimple-ir.h, gimplify.c, gimple-ir.c: Rename all calls to + walk_tree_seq and walk_tree_tuple accordingly. + +2007-07-12 Aldy Hernandez + + * gimple-ir.c (gs_build_switch_1): Fix spacing. + Allocate one more tree. + (gs_build_switch): Set labels starting at 1. + (walk_tree_seq): New. + (walk_tree_tuple): New. + * gimple-ir.h: Add prototypes for walk_tree_tuple and walk_tree_seq. + * gimplify.c (check_pointer_types_r): Uncomment. + (gimplify_body): Walk gimple sequence with check_pointer_types_r. + +2007-07-11 Chris Matthews + + * tree-pretty-print.c (dump_generic_node): Removed space before default + label colon. + * tree.h (sort_case_labels): Moved to gimple-ir.h. + * gimplify.c (sort_case_labels): Changed to a vector instead of tree + vector. + (gimplify_switch_expr): Initial implementation with tuples. + (gimplify_expr): Changed gimplify_case_label_expr parameter. + (gimplify_case_label_expr): Added a gs_seq parameter, and put cases in + that. + (dump_gimple_stmt): Removed semicolon. + (dump_gs_label): Refactored from dump_gimple_expr. + (dump_gs_switch): Added. + (gs_build_switch_vec): Added. + * gimple-ir.c (gs_build_switch_1): Added. + (gs_build_switch): Refactored to use gs_build_switch_1. + (gs_build_switch_vec): Added. + * gs_switch.c: New test case. + * gs_switch1.c: New test case. + * gs_switch2.c: New test case. + +2007-07-05 Aldy Hernandez + + * gimple-pretty-print.c (dump_gimple_stmt): Alphabetize cases. + Add case for GS_NOP. + * gimplify.c (gimplify_body): Handle null bodies. + Use GS_CODE instead of GS_SUBCODE_FLAGS. + +2007-07-05 Aldy Hernandez + + * testsuite/gcc.dg/gimple/with_size_expr.c: Clean up dump. + * testsuite/gcc.dg/gimple/gs_bind.c: Clean up dump. + * gimplify.c (struct gimplify_ctx): Make current_bind_expr a tuple. + (pop_gimplify_context): Accept gimple. + Comment out call to declare_vars. + (gimple_current_bind_expr): Return gimple. + (unshare_all_trees): Remove. + (gimplify_self_mod_expr): Remove comment. + (gimplify_cleanup_point_expr): Correct typo in call to gs_seq_init. + (gimplify_body): Remove body local. + Build GS_BIND tuples when needed. + Do not call unshare_all_trees. + Call pop_gimplify_context with appropriate argument. + Comment out call to walk_tree. + * tree-pretty-print.c (print_declaration): Remove static. + * diagnostic.h (print_declaration): Prototype. + * tree-gimple.h (pop_gimplify_context): Accept gimple tuple. + (gimple_current_bind_expr): Return tuple. + * gimple-pretty-print.c (dump_gs_seq): New. + (dump_gs_bind): New. + (dump_gimple_stmt): Add case for GS_BIND. Print semi-colons after + each statement. + +2007-06-29 Aldy Hernandez + + * gimplify.c (gimple_push_condition): Enable. Call gs_seq_init with + address. + (gimplify_cond_expr): Push and pop conditions. Use other GS_COND + predicates when appropriate + +2007-06-28 Aldy Hernandez + + * testsuite/gcc.dg/gimple/gs_goto.c: New. + * testsuite/gcc.dg/gimple/gs_cond.c: New. + * tree-gimple.h (gimplify_stmt): Return bool. + * gimple-pretty-print.c (INDENT): New. + (newline_and_indent): New. + (op_gs_cond): New. + (dump_gs_cond): New. + (dump_gimple_stmt): New. + * gimple-ir.c (gs_cond_invert): New. + * gimple-ir.h (enum gs_cond): Add comment. + (gs_cond_invert): Protoize. + * gimplify.c (gimplify_cond_expr): Rewrite for tuples. + (gimplify_stmt): Return true if we added a statement to the queue. + (gimplify_expr): Enable gimplify_cond_expr. + Build tuples for GOTO_EXPRs and LABEL_EXPRs. + +2007-06-27 Aldy Hernandez + + * gimple-ir.h (gs_seq_last): Return last statement. + * testsuite/gcc.dg/gimple/compound_expr.c: Add checks. + * testsuite/gcc.dg/gimple/gs_call.c: Same. + * testsuite/gcc.dg/gimple/constructors.c: Same. + * testsuite/gcc.dg/gimple/gs_assign.c: Same. + +2007-06-27 Aldy Hernandez + + Put this patch back in. + + 2007-06-22 Aldy Hernandez + + * gimplify.c (gimplify_modify_expr): Return after a successful + call to gimplify_modify_expr_rhs. + +2007-06-26 Aldy Hernandez + + * testsuite/gcc.dg/gimple/gimple.exp: Pass -fdump-tree-gimple-details + * testsuite/gcc.dg/gimple/compound_expr.c: Add dg-final. + * testsuite/gcc.dg/gimple/gs_return.c: Same. + * tree.h (gimplify_function_tree): Add return value. + * diagnostic.h (debug_c_tree): Move under tree-pretty-print.c section. + (dump_gimple_seq): New. + to tests. + * gimple-pretty-print.c (dump_gimple_seq): New. + * gimplify.c (gimplify_function_tree): Add return value. + Remove debug call and exit. + Comment out non-working code. + * c-gimplify.c (c_genericize): Dump gimple IR. Exit. + +2007-06-26 Diego Novillo + + * gimple-ir.c (gs_build_call_1): Fix formatting. + +2007-06-26 Diego Novillo + + * gimple-pretty-print.c (dump_gs_assign, dump_gs_return, + dump_gs_call): New functions. + (dump_gimple_stmt): Call them. + * gimple-ir.c (gs_build_call_1): Factor out of gs_build_call. + (gs_build_call): Call it. + (gs_build_call_vec): New function. + * gimple-ir.h (struct gimple_statement_call): Change type of + field 'nargs' to size_t. Update all users. + (gs_build_call_vec): Declare. + (gs_call_set_fn): Remove. + (gs_call_set_nargs): Remove. + * gimplify.c: Include "vec.h" + (gimplify_return_expr): Fix formatting + (gimplify_call_expr): Call gs_build_call_vec. + (gimplify_expr): Do not try to test if NULL expressions + are in GIMPLE form. + (gimplify_function_tree): Do not call debug_gimple_seq. + * Makefile.in (gimplify.o): Include vec.h + +2007-06-25 Chris Matthews + + * gimplify.c (gimple_current_bind_expr): Changed to work with gs_seq + accessors + (gimplify_and_add): Same. + (annotate_all_with_locus): Same. + (gimplify_self_mod_expr): Same. + (gimplify_cleanup_point_expr): Same. + (gimplify_expr): Same. + (gimplify_body): Same. + (force_gimple_operand): Same. + (gimplify_init_ctor_eval_range): Added GS_ prefix. + * gimple-iterator.h (gsi_last): Changed to gs_seq accessors. Changed + gimple_stmt_iterator to use a gimple instead of gimple *. + (gsi_one_before_end_p): Same. + (gsi_start): Same. + * gimple-ir.h (gs_cond): Prepended GS_ to names. + (gs_seq_first): Replaced macro. + (gs_seq_last): Same. + (gs_seq_set_first): Same. + (gs_seq_set_last): Same. + (gs_seq_init): Same. + (gs_seq_empty_p): Same. + (gs_assign_operand) Changed opno to be a size_t to match set. + (gs_bind_body): Changed to use gs_seq. + (gs_bind_set_body): Changed to use gs_seq, and gs_seq_set_first, and last. + (gs_asm_ninputs): Renamed. + (gs_asm_noutputs): Renamed. + (gs_asm_nclobbered): Renamed. + (gs_asm_set_ninputs): Renamed. + (gs_asm_set_noutputs): Renamed. + (gs_asm_set_nclobbered): Renamed. + (gs_asm_set_input_op): Renamed. + (gs_asm_input_op): Renamed. + (gs_asm_set_output_op): Renamed. + (gs_asm_output_op): Renamed. + (gs_omp_body): Changed to use gs_seq. + (gs_omp_set_body): Changed to use gs_seq accessors. + (gs_omp_for_pre_body): Changed to use gs_seq. + (gs_omp_for_set_pre_body): Changed to use gs_seq accessors. + (gs_seq_append): Changed to use gs_seq accessors. + * gimple-ir.c (gs_add): Same. + (gs_build_asm): Changed argument names to match accessors, and changed + functions to new accessor names. + (gs_build_cond): Reformatted. + (gs_build_phi): Same. + (gs_build_try): Renamed args to try_p and catch_p. + (gs_build_omp_return): Change to correct arguments, and added a subcode + flag. + * function.c (gimplify-oaraneters): Changed to gs_seq accessors. + +2007-06-22 Aldy Hernandez + + * gimplify.c (gimplify_modify_expr): Return after a successful + call to gimplify_modify_expr_rhs. + +2007-06-21 Aldy Hernandez + + * gimple-ir.h (gs_assign_binary_rhs1): Add assertion for + GSS_ASSIGN_BINARY. + (gs_assign_binary_set_rhs1): Same. + (gs_assign_binary_rhs2): Same. + (gs_assign_binary_set_rhs2): Same. + (gs_assign_unary_rhs): Same. + (gs_assign_unary_set_rhs): Same. + +2007-06-21 Aldy Hernandez + + * gcc.dg/gimple/gimple.exp: New. + * gcc.dg/gimple/compound_expr.c: New. + * gcc.dg/gimple/with_size_expr.c: New. + * gcc.dg/gimple/compound_expr.c: New. + * gcc.dg/gimple/gs_call.c: New. + * gcc.dg/gimple/constructors.c: New. + * gcc.dg/gimple/gs_return.c: New. + * gcc.dg/gimple/gs_assign.c: New. + +2007-06-21 Aldy Hernandez + + * gimple-ir.c (gs_build_cond): Change order of arguments. Make labels + of type tree. + (gs_build_asm): Fix formatting. + * gimple-ir.h (gimple_statement_cond): Make labels of type tree. + (gs_build_cond): Change order and type of arguments. + (gs_build_asm): Fix formatting. + (gs_omp_build_for): Same. + (gs_assign_binary_rhs1): Remove assert. + (gs_assign_binary_set_rhs1): Same. + (gs_assign_binary_rhs2): Same. + (gs_assign_binary_set_rhs2): Same. + (gs_assign_unary_rhs): Same. + (gs_cond_true_label): Return a tree. + (gs_cond_set_true_label): Make label a tree. + (gs_cond_set_false_label): Make label a tree. + (gs_cond_false_label): Return a tree. + * gimplify.c (gimplify_init_ctor_eval_range): Build tuples. + (gimplify_init_ctor_eval): Same. + (gimplify_init_constructor): Enable. Adjust for tuples. + (gimplify_modify_expr_rhs): Uncomment call to + gimplify_init_constructor. + +2007-06-21 Diego Novillo + + * gimple.def: Rename from gs.def. + Adjust all users. + +2007-06-21 Diego Novillo + + * tree-pretty-print.c (pred_symbol_code, do_gs_niy, + debug_gimple_stmt, debug_gimple_seq, print_gimple_stmt, + dump_gimple_stmt): Move to gimple-pretty-print.c + * diagnostic.h: Add comment for functions in gimple-pretty-print.c + * gimple-pretty-print.c: New file. + * gimple-ir.c (gs_build_return): Fix spacing. + (gs_build_assign): Likewise. + * gimple-ir.h: Fix spacing. + (gs_assign_set_operand): Change OPNO to size_t. + Add assertions for OPNO's value. + (gs_assign_lhs): Rename from gs_assign_operand_lhs. + (gs_assign_binary_rhs1): Rename from gs_assign_operand_rhs. + Assert that GS is GSS_ASSIGN_BINARY + (gs_assign_binary_set_rhs1): Rename from gs_assign_set_rhs. + Assert that GS is GSS_ASSIGN_BINARY. + (gs_assign_binary_set_rhs2): Rename from gs_assign_set_rhs2. + Assert that GS is GSS_ASSIGN_BINARY. + (gs_assign_unary_rhs): New. + (gs_assign_unary_set_rhs): New. + (gs_call_fn, gs_call_lhs, gs_call_chain, gs_call_arg, + gs_cond_lhs, gs_cond_rhs, gs_label_label, gs_goto_dest, + gs_bind_vars, gs_asm_in_op, gs_asm_out_op, gs_asm_clobber_op, + gs_catch_types, gs_catch_handler, gs_eh_filter_types, + gs_eh_filter_failure, gs_try_eval, gs_try_cleanup, + gs_phi_result, gs_switch_index, gs_switch_default_label, + gs_switch_label,gs_omp_critical_name, gs_omp_for_clauses, + gs_omp_for_index, gs_omp_for_initial, gs_omp_for_final, + gs_omp_for_incr, gs_omp_parallel_clauses, + gs_omp_parallel_child_fn, gs_omp_parallel_data_arg, + gs_omp_single_clauses, gs_omp_sections_clauses, + gs_return_retval): Change return type to 'tree'. + * Makefile.in (OBJS-common): Add gimple-pretty-print.o. + (gimple-pretty-print.o): New rule. + +2007-06-20 Aldy Hernandez + + * tree-pretty-print.c (dump_gimple_stmt): Change pred_symbol_code + to op_symbol_code. + +2007-06-19 Aldy Hernandez + + * gimplify.c (gimplify_modify_expr_rhs): Enable. Adjust for tuples. + (gimplify_modify_expr): Call gimplify_modify_expr_rhs. + (gimplify_compound_expr): Enable. Adjust for tuples. Remove comment + that no longer applies. + (gimplify_expr): Enable call to gimplify_compound_expr. + +2007-06-18 Chris Matthews + + * Makefile.in (GTFILES): Added gimeple-ir.h. + + * gimple-ir.c (gs_build_return, gs_build_call, gs_build_assign): + Changed to use new accessors. + (gs_build_cond, gs_build_label, gs_build_goto, + gs_build_nop, gs_build_bind gs_build_asm, gs_build_catch, + gs_build_eh_filter, gs_build_try, gs_build_phi, + gs_build_resx, gs_build_switch, gs_omp_build_critical, + gs_omp_build_for, gs_omp_build_parallel, + gs_omp_build_section, gs_omp_build_master, + gs_omp_build_ordered, gs_omp_continue, + gs_omp_build_ordered, gs_omp_build_return, + gs_omp_build_sections, gs_omp_build_single): New + functions. + + * gimple-ir.h (struct gimple_statement_switch): Changed + default label to be in labels[0]. + + (struct gimple_statement_asm): Corrected the allocation + length. + + (enum gs_cond): New enum. + (gs_assign_set_operand): Changed to work with new accessors. + (gs_assign_operand_lhs, gs_assign_operand_rhs, + gs_assign_operand_set_lhs, gs_assign_set_rhs, + gs_assign_operand_rhs2, gs_assign_set_rhs2, gs_call_fn, + gs_call_set_fn, gs_call_lhs, gs_call_set_lhs, + gs_call_chain, gs_call_set_chain, gs_call_nargs, + gs_call_set_nargs, gs_call_arg, gs_call_set_arg, + gs_cond_lhs, gs_cond_set_lhs, gs_cond_rhs, + gs_cond_set_rhs, gs_cond_true_label, + gs_cond_set_true_label, gs_cond_set_false_label, + gs_cond_false_label, gs_label_label, gs_label_set_label, + gs_goto_dest, gs_goto_set_dest, gs_bind_vars, + gs_bind_set_vars, gs_bind_body, gs_bind_set_body, + gs_asm_ni, gs_asm_set_ni, gs_asm_no, gs_asm_set_no, + gs_asm_nc, gs_asm_set_nc, gs_asm_in_op, gs_asm_set_in_op, + gs_asm_out_op, gs_asm_set_out_op, gs_asm_clobber_op, + gs_asm_set_clobber_op, gs_asm_string, gs_asm_set_string, + gs_catch_types, gs_catch_handler, gs_catch_set_types, + gs_catch_set_handler, gs_eh_filter_types, + gs_eh_filter_failure, gs_eh_filter_set_types, + gs_eh_filter_set_failure, gs_try_eval, gs_try_cleanup, + gs_try_set_eval, gs_try_set_cleanup, gs_phi_capacity, + gs_phi_set_capacity, gs_phi_nargs, gs_phi_set_nargs, + gs_phi_result, gs_phi_set_result, gs_phi_arg, + gs_phi_set_arg, gs_resx_region, gs_resx_set_region, + gs_switch_nlabels, gs_switch_set_nlabels, + gs_switch_index, gs_switch_set_index, + gs_switch_default_label, gs_switch_set_default_label, + gs_switch_label, gs_switch_set_label, gs_omp_body, + gs_omp_set_body, gs_omp_critical_name, + gs_omp_critical_set_name, gs_omp_for_clauses, + gs_omp_for_set_clauses, gs_omp_for_index, + gs_omp_for_set_index, gs_omp_for_initial, + gs_omp_for_set_initial, gs_omp_for_final, + gs_omp_for_set_final, gs_omp_for_incr, + gs_omp_for_set_incr, gs_omp_for_pre_body, + gs_omp_for_set_pre_body, gs_omp_parallel_clauses, + gs_omp_parallel_set_clauses, gs_omp_parallel_child_fn, + gs_omp_parallel_set_child_fn, gs_omp_parallel_data_arg, + gs_omp_parallel_set_data_arg, gs_omp_single_clauses, + gs_omp_single_set_clauses, gs_omp_sections_clauses, + gs_omp_sections_set_clauses, gs_assign_omp_for_cond, + gs_omp_for_cond gs_return_set_retval, + gs_add_subcode_flag): New accessor functions. + (gs_return_retval): Renamed gs_return_operand_retval to match accessor + conventions. + +2007-05-31 Aldy Hernandez + + * gimple-ir.c (gs_build_call): New. + * gimple-ir.h (GS_CALL_LHS): New. + (GS_CALL_FN): New. + (GS_CALL_CHAIN): New. + (GS_CALL_NARGS): New. + (GS_CALL_ARG): New. + (gs_call_lhs): New. + (gs_call_fn): New. + (gs_call_chain): New. + (gs_call_nargs): New. + (gs_call_arg): New. + * gimplify.c (gimplify_modify_expr_to_memcpy): Enable and rewrite for + tuples. + (gimplify_modify_expr_to_memset): Same. + (gimplify_statement_list): Same. + (gimplify_expr): Enable STATEMENT_LIST case. + +2007-05-29 Aldy Hernandez + + Merged revisions 124007-125166 from mainline. + +2007-05-23 Aldy Hernandez + + * builtins.c (std_gimplify_va_arg_expr): Add argument to gimplify_expr. + Remove seq argument. + (gimplify_va_arg_expr): Same. + * tree-gimple.h: Same. + * langhooks.c (lhd_gimplify_expr): Change pre_p and post_p types to + sequences. + * langhooks-def.h (lhd_gimplify_expr): Change + * langhooks.h (struct lang_hooks): Remove argument. + * gimplify.c (internal_get_tmp_var): Adjust calls to gimplify_expr + for new arguments. + (gimplify_switch_expr): Same. + (gimplify_var_or_parm_decl): Same. + (gimplify_compound_lval): Same. + (gimplify_self_mod_expr): Same. + (gimplify_arg): Same. + (gimplify_call_expr): Same. + (gimplify_init_ctor_preeval): Same. + (gimplify_init_constructor): Same. + (gimplify_modify_expr_rhs): Same. + (gimplify_modify_expr): Same. + (gimplify_save_expr): Same. + (gimplify_addr_expr): Same. + (gimplify_asm_expr): Same. + (gimplify_target_expr): Same. + (omp_check_private): Same. + (gimplify_scan_omp_clauses): Same. + (gimplify_omp_parallel): Same. + (gimplify_omp_for): Same. + (goa_stabilize_expr): Same. + (gimplify_omp_atomic): Same. + (gimplify_one_sizepos): Same. + (force_gimple_operand): Same. + (gimplify_expr): Remove seq_p argument. Add new is_statement + argument. Adjust accordingly. Make seq_p required. + +2007-05-07 Aldy Hernandez + + * function.c (gimplify_parameters): Use new GS_SEQ_INIT definition. + * gimple-ir.h (GS_SEQ_INIT): Do not use C99 constructs. + * gimplify.c: Disable non working code throughout. + Pass additional call to gimplify_expr throughout. + (gimplify_ctx): Make conditional_cleanups a sequence. + (gimple_push_condition): Use GS_SEQ_EMPTY_P. + (gimple_pop_condition): Adapt for sequences. + (gimplify_and_add): Use gs_seq_append regardless of side effects. + (internal_get_tmp_var): Use sequences. + (get_formal_tmp_var): Same. + (get_initialized_tmp_var): Same. + (annotate_one_with_locus): Change GS_LOCUS to GS_LOCUS_EMPTY_P. + (gimplify_bind_expr): Use sequences. + Change append_to_statement_list to gimplify_and_add. + (gimplify_return_expr): Add gimplified code to pre_p. + (gimplify_decl_expr): New seq_p parameter. + (gimplify_loop_expr): Adapt for sequences. + Use gimplify_and_add instead of append_to_statement_list. + (gimplify_switch_expr): Same. + (gimplify_compound_lval): Use sequences. + (gimplify_self_mod_expr): Same. + Use gs_seq_append instead of append_to_statement_list. + (gimplify_arg): Use sequences. + (gimplify_call_expr): Same. + (gimplify_cond_expr): Use sequences. + (gimplify_init_ctor_preeval): Use sequences. + (gimplify_init_ctor_eval_range): Same. + Use gimplify_and_add instead of append_to_statement_list. + (gimplify_init_ctor_eval): Use sequences. + (gimplify_init_constructor): Same. + Remove one call to append_to_statement_list. + (gimplify_modify_expr_rhs): Use sequences. + (gimplify_modify_expr_complex_part): Use sequences. + Remove call to tree_to_gimple_tuple. + Build GS_ASSIGN tuple. + (gimplify_modify_expr): Use new argument. Use sequences. + Do not call append_to_statement_list. + Build GS_ASSIGN tuple. + Do not call tree_to_gimple_tuple. + Set *expr_p to NULL when we do not want the value. + (gimplify_compound_expr): Use sequences. + (gimplify_save_expr): Same. + (gimplify_addr_expr): Same. + (gimplify_asm_expr): Same. + (gimplify_cleanup_point_expr): Same. + (gimple_push_cleanup): Same. + Build GS_ASSIGN tuples. + (gimplify_target_expr): Use sequences. + (gimplify_scan_omp_clauses): Same. + Add argument to gimplify_stmt calls. + (gimplify_omp_parallel): Same. + (gimplify_omp_for): Use sequences. + (gimplify_omp_workshare): Same. + (goa_stabilize_expr): Same. + (gimplify_omp_atomic_pipeline): Same. + (gimplify_omp_atomic_mutex): Same. + (gimplify_omp_atomic): Same. + (gimplify_expr): Same. + Call GS_SEQ_INIT with argument. + Use new seq_p argument. + Do not call tree_to_gimple_tuple. + Pass additional argument to gimplify_decl_expr. + Do not pass seq_p argument to gimplify_return_expr. + Call gs_seq_append instead of append_to_statement_list. + Check that all statements have been converted to tuples. + Make pre_p and seq_p sequences coexist. + (gimplify_type_sizes): Use sequences. + (gimplify_one_sizepos): Same. + (gimplify_body): Make parm_stmts a sequence. + Add argument to seq_p. + (gimplify_function_tree): Call debug_gimple_seq. + (force_gimple_operand): Use sequences. + (force_gimple_operand_bsi): Use sequences. + +2007-05-04 Aldy Hernandez + + * omp-low.c (build_omp_barrier): Adjust arguments for sequences. + (lower_rec_input_clauses): Disable non working code. + (lower_regimplify): Pass additional argument to gimplify_expr. + * tree-mudflap.c (mx_register_decls): Disable non working code. + * tree-inline.c (copy_bb): Disable non working code. + (setup_one_parameter): Same. + * tree-cfg.c (make_edges): Same. + +2007-05-04 Aldy Hernandez + + * tree-gimple.h (get_initialized_tmp_var): Adjust prototype + for sequences. + (get_formal_tmp_var): Same. + (gimplify_type_sizes): Same. + (gimplify_one_sizepos): Same. + (gimplify_stmt): Same. + (gimplify_and_add): Same. + (gimplify_va_arg_expr): Same. + * langhooks.h (lang_hooks): Same. + * function.c (gimplify_parm_type): Adjust for sequences. + (gimplify_parameters): Same. + * c-gimplify.c (gimplify_compound_literal_expr): Same. + (c_gimplify_expr): Same. + * tree-flow.h (force_gimple_operand): Same. + * c-common.h (c_gimplify_expr): Adjust prototype for sequences. + * config/i386/i386.c (ix86_gimplify_va_arg): Adjust for sequences. + Change call to append_to_statement_list to gimplify_and_add. + Add parameter to gimplify_expr. + +2007-05-04 Aldy Hernandez + + * gimple-ir.c (gs_code_name): Constify. + (gs_build_assign): New. + (gimple_statement_structure): Abstract code out to... + (gss_for_assign): ...here. + (gs_add): Set the last item correctly. + * gimple-ir.h (GS_LOCUS_EMPTY_P): New. + (GS_SEQ_INIT): Add a cast. + (gimple_statement_base): Make code a gs_code enum. + (gimple_statement_with_ops): Remove address_taken. + (GS_ASSIGN_BINARY_LHS): New. + (GS_ASSIGN_BINARY_RHS1): New. + (GS_ASSIGN_BINARY_RHS2): New. + (GS_ASSIGN_UNARY_REG_LHS): New. + (GS_ASSIGN_UNARY_REG_RHS): New. + (GS_ASSIGN_UNARY_MEM_LHS): New. + (GS_ASSIGN_UNARY_MEM_RHS): New. + (gs_seq_append): New. + Move gs_seq typedef to... + * coretypes.h: ...here. + * gimple-iterator.h (gsi_stmt_ptr): Add FIXME note. + +2007-05-04 Aldy Hernandez + + * tree.h (std_gimplify_va_arg_expr): Change tree * to a sequence + in prototype. + (gimplify_parameters): Return a sequence. + * target.h (gimplify_va_arg_expr): Change tree * to a sequence. + * builtins.c (std_gimplify_va_arg_expr): Same. + Pass additional argument to gimplify_expr. + (gimplify_va_arg_expr): Change tree * to a sequence. + Change append_to_statement_list call to gimplify_and_add. + Pass additional argument to gimplify_expr calls. + +2007-05-04 Aldy Hernandez + + * tree-pretty-print.c (do_gs_niy): New. + (debug_gimple_stmt): New. + (debug_gimple_seq): New. + (print_gimple_stmt): New. + (dump_gimple_stmt): New. + * diagnostic.h: Add prototypes for dump_gimple_stmt, + print_gimple_stmt, debug_gimple_stmt, debug_gimple_seq. + +2007-04-26 Aldy Hernandez + + * tree-gimple.h (annotate_all_with_locus): First argument is now a + sequence. + * gimple-ir.h (GS_LOCUS): New. + (gimple_statement_base): Locus is of type location_t. + * gimplify.c (internal_get_tmp_var): Use sequences. + (should_carry_locus_p): Adjust for gimple ir. + (annotate_one_with_locus): Same. + (annotate_all_with_locus): Same. + (gimplify_stmt): Adjust for sequences. + (gimplify_expr): Same. + +2007-04-25 Aldy Hernandez + + * gimple-ir.h (GS_SEQ_EMPTY_P): New. + Move gs_build_return, gs_add, and gimple_statement_structure + prototypes. + (gs_assign_operand): Fix typos in gss. + Include gimple-iterator.h. + * Makefile.in (GIMPLE_IR_H): Add gimple-iterator.h. + (TREE_GIMPLE_H): Same. + +2007-04-25 Aldy Hernandez + + * gimple-iterator.h (gsi_one_before_end_p): Use GS_SEQ_LAST. + +2007-04-25 Aldy Hernandez + + * gimple-iterator.h: New file. + +2007-04-23 Aldy Hernandez + + * gimple-ir.c: New file. + * gimple-ir.h: New file. + * gsstruct.def: New file. + * gs.def: New file. + * gengtype.c (open_base_files): Add gimple-ir.h. + * tree-gimple.h: Include gimple-ir.h. + Add sequence to gimplify_expr and gimplify_body prototypes. + * gimplify.c: Include gimple-ir.h. + (gimplify_and_add): Adjust for gimple IR. + (gimplify_return_expr): Same. + (gimplify_stmt): Add seq_p argument. + (gimplify_expr): Add seq_p sequence and adjust accordingly. + (gimplify_body): Same. + * coretypes.h: Add gimple_statement_d and gimple definitions. + * Makefile.in (GIMPLE_IR_H): New. + (TREE_GIMPLE_H): Add gimple-ir.h. + (OBJS-common): Add gimple-ir.o. + (gimplify.o): Add GIMPLE_IR_H. + (gimple-ir.o): New. + (build/gencheck.o): Add gs.def. + +Local Variables: +mode: change-log +End: diff --git a/gcc/Makefile.in b/gcc/Makefile.in index f73686f0300..3dbaa733fe4 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -798,6 +798,8 @@ TREE_H = tree.h all-tree.def tree.def c-common.def $(lang_tree_files) \ BASIC_BLOCK_H = basic-block.h $(BITMAP_H) sbitmap.h varray.h $(PARTITION_H) \ hard-reg-set.h $(PREDICT_H) vec.h $(FUNCTION_H) \ cfghooks.h $(OBSTACK_H) +GIMPLE_H = gimple.h gimple.def gsstruct.def pointer-set.h vec.h \ + $(GGC_H) $(BASIC_BLOCK_H) $(TM_H) $(TARGET_H) tree-ssa-operands.h GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h COVERAGE_H = coverage.h $(GCOV_IO_H) DEMANGLE_H = $(srcdir)/../include/demangle.h @@ -844,9 +846,8 @@ SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H) CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h $(CPP_ID_DATA_H) TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) tree-pass.h -TREE_GIMPLE_H = tree-gimple.h tree-iterator.h TREE_FLOW_H = tree-flow.h tree-flow-inline.h tree-ssa-operands.h \ - $(BITMAP_H) $(BASIC_BLOCK_H) hard-reg-set.h $(TREE_GIMPLE_H) \ + $(BITMAP_H) $(BASIC_BLOCK_H) hard-reg-set.h $(GIMPLE_H) \ $(HASHTAB_H) $(CGRAPH_H) $(IPA_REFERENCE_H) TREE_SSA_LIVE_H = tree-ssa-live.h $(PARTITION_H) vecprim.h PRETTY_PRINT_H = pretty-print.h $(INPUT_H) $(OBSTACK_H) @@ -1091,7 +1092,10 @@ OBJS-common = \ gcse.o \ genrtl.o \ ggc-common.o \ + gimple.o \ + gimple-iterator.o \ gimple-low.o \ + gimple-pretty-print.o \ gimplify.o \ global.o \ graph.o \ @@ -1182,7 +1186,6 @@ OBJS-common = \ tree-dfa.o \ tree-dump.o \ tree-eh.o \ - tree-gimple.o \ tree-if-conv.o \ tree-into-ssa.o \ tree-iterator.o \ @@ -1794,12 +1797,12 @@ c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(EXPR_H) debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \ opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) $(HASHTAB_H) libfuncs.h \ except.h $(LANGHOOKS_DEF_H) $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) \ - $(DIAGNOSTIC_H) $(INPUT_H) langhooks.h $(TREE_GIMPLE_H) tree-mudflap.h \ - pointer-set.h $(BASIC_BLOCK_H) + $(DIAGNOSTIC_H) $(INPUT_H) langhooks.h $(GIMPLE_H) tree-mudflap.h \ + pointer-set.h $(BASIC_BLOCK_H) $(GIMPLE_H) tree-iterator.h c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) \ $(RTL_H) $(TOPLEV_H) $(TM_P_H) langhooks.h $(GGC_H) $(TREE_FLOW_H) \ - $(TREE_GIMPLE_H) tree-iterator.h + $(GIMPLE_H) tree-iterator.h c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(C_TREE_H) $(DIAGNOSTIC_H) \ $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \ @@ -1860,7 +1863,8 @@ c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(DIAGNOSTIC_H) gt-c-common.h langhooks.h $(VARRAY_H) $(RTL_H) \ $(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h tree-mudflap.h \ intl.h opts.h $(REAL_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \ - $(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) + $(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \ + $(GIMPLE_H) c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \ $(C_TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(REAL_H) \ @@ -1893,8 +1897,8 @@ c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) la c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FLAGS_H) $(TOPLEV_H) output.h $(RTL_H) $(GGC_H) \ $(PREDICT_H) $(TREE_INLINE_H) $(C_COMMON_H) except.h $(FUNCTION_H) \ - langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) $(TREE_GIMPLE_H) \ - $(VARRAY_H) + langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) $(GIMPLE_H) \ + $(VARRAY_H) tree-iterator.h c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(C_TREE_H) $(TREE_DUMP_H) @@ -1907,7 +1911,7 @@ c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \ $< $(OUTPUT_OPTION) c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ - $(FUNCTION_H) $(C_COMMON_H) $(TOPLEV_H) $(TREE_GIMPLE_H) $(BITMAP_H) \ + $(FUNCTION_H) $(C_COMMON_H) $(TOPLEV.H) $(GIMPLE_H) $(BITMAP_H) \ langhooks.h # Language-independent files. @@ -2022,7 +2026,7 @@ double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(TOPLEV_H) $(TREE_INLINE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \ langhooks.h $(TARGET_H) $(LANGHOOKS_DEF_H) $(FLAGS_H) $(GGC_H) $(DIAGNOSTIC_H) \ - intl.h $(TREE_GIMPLE_H) + intl.h $(GIMPLE_H) tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ all-tree.def $(FLAGS_H) $(FUNCTION_H) $(PARAMS_H) \ $(TOPLEV_H) $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \ @@ -2034,11 +2038,12 @@ tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(RTL_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) $(INPUT_H) insn-config.h \ $(VARRAY_H) $(HASHTAB_H) $(TOPLEV_H) langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) \ - intl.h $(FUNCTION_H) $(GGC_H) $(TREE_GIMPLE_H) \ + intl.h $(FUNCTION_H) $(GGC_H) $(GIMPLE_H) \ debug.h $(DIAGNOSTIC_H) except.h $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \ $(IPA_PROP_H) value-prof.h tree-pass.h $(TARGET_H) $(INTEGRATE_H) print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ - $(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h $(TREE_FLOW_H) + $(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h \ + $(DIAGNOSTIC_H) $(TREE_FLOW_H) stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(PARAMS_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) output.h $(RTL_H) \ $(GGC_H) $(TM_P_H) $(TARGET_H) langhooks.h $(REGS_H) gt-stor-layout.h \ @@ -2047,7 +2052,7 @@ tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \ $(SYSTEM_H) $(CONFIG_H) coretypes.h $(TM_H) $(GGC_H) $(OBSTACK_H) $(BITMAP_H) \ $(FLAGS_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) output.h errors.h \ $(DIAGNOSTIC_H) $(TREE_H) $(C_COMMON_H) $(TREE_FLOW_H) $(TREE_INLINE_H) varray.h \ - $(C_TREE_H) $(TREE_GIMPLE_H) $(HASHTAB_H) $(FUNCTION_H) $(CGRAPH_H) tree-pass.h \ + $(C_TREE_H) $(GIMPLE_H) $(HASHTAB_H) $(FUNCTION_H) $(CGRAPH_H) tree-pass.h \ $(TIMEVAR_H) alloc-pool.h $(SPLAY_TREE_H) $(PARAMS_H) gt-tree-ssa-structalias.h \ $(CGRAPH_H) $(ALIAS_H) pointer-set.h tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ @@ -2055,13 +2060,13 @@ tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(TOPLEV_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \ $(TREE_DUMP_H) langhooks.h tree-pass.h $(BASIC_BLOCK_H) $(BITMAP_H) \ $(FLAGS_H) $(GGC_H) hard-reg-set.h $(HASHTAB_H) pointer-set.h \ - $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) + $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \ $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \ langhooks.h domwalk.h tree-pass.h $(GGC_H) $(PARAMS_H) $(BASIC_BLOCK_H) \ $(BITMAP_H) $(CFGLOOP_H) $(FLAGS_H) hard-reg-set.h $(HASHTAB_H) \ - $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) vecprim.h + $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) vecprim.h tree-ssa-ter.o : tree-ssa-ter.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \ $(TREE_SSA_LIVE_H) $(BITMAP_H) @@ -2078,7 +2083,7 @@ tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ tree-ssa-forwprop.o : tree-ssa-forwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \ $(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \ - langhooks.h $(FLAGS_H) + langhooks.h $(FLAGS_H) $(GIMPLE_H) tree-ssa-phiprop.o : tree-ssa-phiprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TM_P_H) $(BASIC_BLOCK_H) \ $(TREE_FLOW_H) tree-pass.h $(TREE_DUMP_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \ @@ -2103,7 +2108,7 @@ tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \ $(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \ $(TREE_DUMP_H) $(BASIC_BLOCK_H) tree-pass.h langhooks.h \ tree-ssa-propagate.h vec.h value-prof.h gt-tree-ssa-propagate.h $(FLAGS_H) \ - $(VARRAY_H) + $(VARRAY_H) $(GIMPLE_H) tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \ $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \ @@ -2127,7 +2132,7 @@ tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(TREE_FLOW_H) tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \ - gt-tree-phinodes.h $(RTL_H) $(TOPLEV_H) + gt-tree-phinodes.h $(RTL_H) $(TOPLEV.H) $(GIMPLE_H) domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) domwalk.h $(GGC_H) tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ @@ -2136,18 +2141,18 @@ tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ tree-ssa-copyrename.o : tree-ssa-copyrename.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) tree-pass.h \ $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H) $(BASIC_BLOCK_H) \ - $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) langhooks.h $(TREE_GIMPLE_H) \ - $(TREE_INLINE_H) + $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) langhooks.h $(GIMPLE_H) \ + $(TREE_INLINE_H) $(GIMPLE_H) tree-ssa-pre.o : tree-ssa-pre.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(FIBHEAP_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) langhooks.h $(CFGLOOP_H) \ - alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) $(HASHTAB_H) $(TREE_GIMPLE_H) \ + alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) $(HASHTAB_H) $(GIMPLE_H) \ $(TREE_INLINE_H) tree-iterator.h tree-ssa-sccvn.h $(PARAMS_H) \ $(DBGCNT_H) tree-ssa-sccvn.o : tree-ssa-sccvn.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(FIBHEAP_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(CFGLOOP_H) \ - alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) langhooks.h $(HASHTAB_H) $(TREE_GIMPLE_H) \ + alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) langhooks.h $(HASHTAB_H) $(GIMPLE_H) \ $(TREE_INLINE_H) tree-iterator.h tree-ssa-propagate.h tree-ssa-sccvn.h \ $(PARAMS_H) tree-vrp.o : tree-vrp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ @@ -2178,10 +2183,10 @@ tree-ssa-sink.o : tree-ssa-sink.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) alloc-pool.h \ $(BASIC_BLOCK_H) $(BITMAP_H) $(CFGLOOP_H) $(FIBHEAP_H) $(HASHTAB_H) \ - langhooks.h $(REAL_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) tree-iterator.h + langhooks.h $(REAL_H) $(GIMPLE_H) $(TREE_INLINE_H) tree-iterator.h tree-nested.o: tree-nested.c $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TREE_H) \ $(RTL_H) $(TM_P_H) $(FUNCTION_H) $(TREE_DUMP_H) $(TREE_INLINE_H) \ - tree-iterator.h $(TREE_GIMPLE_H) $(CGRAPH_H) $(EXPR_H) langhooks.h \ + tree-iterator.h $(GIMPLE_H) $(CGRAPH_H) $(EXPR_H) langhooks.h \ $(GGC_H) gt-tree-nested.h coretypes.h $(TREE_FLOW_H) pointer-set.h tree-if-conv.o: tree-if-conv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FLAGS_H) $(TIMEVAR_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \ @@ -2189,13 +2194,13 @@ tree-if-conv.o: tree-if-conv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(SCEV_H) tree-pass.h $(DIAGNOSTIC_H) $(TARGET_H) $(TREE_DUMP_H) \ $(VARRAY_H) tree-iterator.o : tree-iterator.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ - coretypes.h $(GGC_H) tree-iterator.h $(TREE_GIMPLE_H) gt-tree-iterator.h + coretypes.h $(GGC_H) tree-iterator.h $(GIMPLE_H) gt-tree-iterator.h tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \ $(TREE_INLINE_H) $(HASHTAB_H) pointer-set.h $(FLAGS_H) $(FUNCTION_H) \ $(TIMEVAR_H) convert.h $(TM_H) coretypes.h langhooks.h $(TREE_DUMP_H) \ tree-pass.h $(PARAMS_H) $(CGRAPH_H) $(BASIC_BLOCK_H) hard-reg-set.h \ - $(TREE_GIMPLE_H) + $(GIMPLE_H) tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \ $(FLAGS_H) $(FUNCTION_H) $(TM_H) $(TIMEVAR_H) tree-pass.h $(TOPLEV_H) \ @@ -2250,7 +2255,7 @@ tree-ssa-loop-ivopts.o : tree-ssa-loop-ivopts.c $(TREE_FLOW_H) $(CONFIG_H) \ $(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) hard-reg-set.h \ tree-chrec.h $(VARRAY_H) tree-affine.h pointer-set.h $(TARGET_H) tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) pointer-set.h \ - $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(TREE_GIMPLE_H) \ + $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(GIMPLE_H) \ output.h $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(FLAGS_H) tree-ssa-loop-manip.o : tree-ssa-loop-manip.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) hard-reg-set.h \ @@ -2274,12 +2279,12 @@ tree-ssa-alias.o : tree-ssa-alias.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(TREE_INLINE_H) $(FLAGS_H) \ $(FUNCTION_H) $(TIMEVAR_H) convert.h $(TM_H) coretypes.h langhooks.h \ $(TREE_DUMP_H) tree-pass.h $(PARAMS_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \ - hard-reg-set.h $(TREE_GIMPLE_H) vec.h tree-ssa-structalias.h \ + hard-reg-set.h $(GIMPLE_H) vec.h tree-ssa-structalias.h \ $(IPA_TYPE_ESCAPE_H) vecprim.h pointer-set.h alloc-pool.h tree-ssa-reassoc.o : tree-ssa-reassoc.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) errors.h $(TIMEVAR_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) tree-iterator.h\ - $(BASIC_BLOCK_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) vec.h langhooks.h \ + $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_INLINE_H) vec.h langhooks.h \ alloc-pool.h pointer-set.h $(CFGLOOP_H) tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(EXPR_H) $(GGC_H) output.h \ @@ -2289,25 +2294,28 @@ tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(CFGLOOP_H) except.h c-gimplify.o : c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ - $(C_TREE_H) $(C_COMMON_H) $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(VARRAY_H) \ + $(C_TREE_H) $(C_COMMON_H) $(DIAGNOSTIC_H) $(GIMPLE_H) $(VARRAY_H) \ $(FLAGS_H) langhooks.h $(TOPLEV_H) $(RTL_H) $(TREE_FLOW_H) $(LANGHOOKS_DEF_H) \ $(TM_H) coretypes.h $(C_PRETTY_PRINT_H) $(CGRAPH_H) $(BASIC_BLOCK_H) \ hard-reg-set.h $(TREE_DUMP_H) $(TREE_INLINE_H) -gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ - $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \ +gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \ + $(DIAGNOSTIC_H) $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \ $(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(CGRAPH_H) $(TIMEVAR_H) $(TM_H) \ coretypes.h except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) output.h \ $(GGC_H) gt-gimplify.h $(HASHTAB_H) $(TARGET_H) $(TOPLEV_H) $(OPTABS_H) \ - $(REAL_H) $(SPLAY_TREE_H) + $(REAL_H) $(SPLAY_TREE_H) vec.h tree-iterator.h +gimple-iterator.o : gimple-iterator.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) value-prof.h gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ - $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \ + $(DIAGNOSTIC_H) $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \ $(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(TIMEVAR_H) $(TM_H) coretypes.h \ except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) tree-pass.h \ - $(HASHTAB_H) $(TOPLEV_H) + $(HASHTAB_H) $(TOPLEV.H) tree-iterator.h omp-low.o : omp-low.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ - $(RTL_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_H) \ + $(RTL_H) $(GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_H) \ $(TREE_FLOW_H) $(TIMEVAR_H) $(FLAGS_H) $(EXPR_H) $(TOPLEV_H) tree-pass.h \ - $(GGC_H) except.h $(SPLAY_TREE_H) $(OPTABS_H) $(CFGLOOP_H) + $(GGC_H) except.h $(SPLAY_TREE_H) $(OPTABS_H) $(CFGLOOP_H) \ + tree-iterator.h tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \ $(TM_H) coretypes.h @@ -2365,16 +2373,19 @@ tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ tree-object-size.o: tree-object-size.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(TOPLEV_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \ tree-ssa-propagate.h -tree-gimple.o : tree-gimple.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(EXPR_H) \ - $(RTL_H) $(TREE_GIMPLE_H) $(TM_H) coretypes.h $(BITMAP_H) $(GGC_H) \ - output.h $(TREE_FLOW_H) +gimple.o : gimple.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ + $(GGC_H) $(GIMPLE_H) $(GIMPLE_H) $(DIAGNOSTIC_H) gt-gimple.h \ + $(TREE_FLOW_H) value-prof.h $(FLAGS_H) +gimple-pretty-print.o : gimple-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \ + $(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \ + $(TM_H) coretypes.h tree-pass.h $(GIMPLE_H) value-prof.h tree-mudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \ - $(TREE_GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) langhooks.h tree-mudflap.h \ + $(GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) langhooks.h tree-mudflap.h \ $(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(CGRAPH_H) $(GGC_H) \ gt-tree-mudflap.h $(BASIC_BLOCK_H) $(FLAGS_H) $(FUNCTION_H) hard-reg-set.h \ - $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(TOPLEV_H) + $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(TOPLEV.H) $(GIMPLE_H) tree-iterator.h tree-nomudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \ - $(C_TREE_H) $(C_COMMON_H) $(TREE_GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \ + $(C_TREE_H) $(C_COMMON_H) $(GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \ output.h $(VARRAY_H) langhooks.h tree-mudflap.h $(TM_H) coretypes.h \ $(GGC_H) gt-tree-mudflap.h tree-pass.h $(TOPLEV_H) tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \ @@ -2383,7 +2394,8 @@ tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \ value-prof.h fixed-value.h output.h fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FLAGS_H) $(REAL_H) $(TOPLEV_H) $(HASHTAB_H) $(EXPR_H) $(RTL_H) \ - $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h fixed-value.h $(TARGET_H) + $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h fixed-value.h $(TARGET_H) \ + $(GIMPLE_H) diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) version.h $(TM_P_H) $(FLAGS_H) $(INPUT_H) $(TOPLEV_H) intl.h \ $(DIAGNOSTIC_H) langhooks.h $(LANGHOOKS_DEF_H) diagnostic.def opts.h @@ -2406,7 +2418,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ value-prof.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \ langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) hosthooks.h \ $(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \ - opts.h params.def tree-mudflap.h $(REAL_H) tree-pass.h + opts.h params.def tree-mudflap.h $(REAL_H) tree-pass.h $(GIMPLE_H) $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ -DTARGET_NAME=\"$(target_noncanonical)\" \ -c $(srcdir)/toplev.c $(OUTPUT_OPTION) @@ -2448,7 +2460,7 @@ varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h $(BASIC_BLOCK_H) \ $(CFGLAYOUT_H) $(CGRAPH_H) targhooks.h tree-mudflap.h $(REAL_H) tree-iterator.h function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ - $(TREE_H) $(CFGLAYOUT_H) $(TREE_GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \ + $(TREE_H) $(CFGLAYOUT_H) $(GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \ $(OPTABS_H) libfuncs.h $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \ output.h $(TOPLEV_H) except.h $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \ gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(INTEGRATE_H) $(PREDICT_H) \ @@ -2477,7 +2489,7 @@ dojump.o : dojump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_ $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(OPTABS_H) $(INSN_ATTR_H) insn-config.h \ langhooks.h $(GGC_H) gt-dojump.h vecprim.h builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ - $(TREE_H) $(TREE_GIMPLE_H) $(FLAGS_H) $(TARGET_H) $(FUNCTION_H) $(REGS_H) \ + $(TREE_H) $(GIMPLE_H) $(FLAGS_H) $(TARGET_H) $(FUNCTION_H) $(REGS_H) \ $(EXPR_H) $(OPTABS_H) insn-config.h $(RECOG_H) output.h typeclass.h \ hard-reg-set.h $(TOPLEV_H) hard-reg-set.h except.h $(TM_P_H) $(PREDICT_H) \ libfuncs.h $(REAL_H) langhooks.h $(BASIC_BLOCK_H) tree-mudflap.h \ @@ -2485,7 +2497,7 @@ builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \ libfuncs.h $(REGS_H) $(TOPLEV_H) output.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_P_H) \ - $(CGRAPH_H) except.h sbitmap.h $(DBGCNT_H) + $(CGRAPH_H) except.h sbitmap.h $(DBGCNT_H) $(TREE_FLOW_H) expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) $(REAL_H) \ $(TOPLEV_H) $(TM_P_H) langhooks.h $(DF_H) $(TARGET_H) @@ -2551,16 +2563,16 @@ cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(TREE_INLINE_H) $(VARRAY_H) $(TREE_DUMP_H) $(TREE_FLOW_H) cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) langhooks.h $(TREE_INLINE_H) $(TOPLEV_H) $(FLAGS_H) $(GGC_H) \ - $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(TREE_GIMPLE_H) \ + $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \ $(TREE_FLOW_H) tree-pass.h $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \ $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) $(IPA_PROP_H) \ - gt-cgraphunit.h + gt-cgraphunit.h tree-iterator.h cgraphbuild.o : cgraphbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ - $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(TREE_GIMPLE_H) \ + $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(GIMPLE_H) \ $(TREE_FLOW_H) tree-pass.h varpool.o : varpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(CGRAPH_H) langhooks.h $(DIAGNOSTIC_H) $(HASHTAB_H) \ - $(GGC_H) $(TIMEVAR_H) debug.h $(TARGET_H) output.h $(TREE_GIMPLE_H) \ + $(GGC_H) $(TIMEVAR_H) debug.h $(TARGET_H) output.h $(GIMPLE_H) \ $(TREE_FLOW_H) gt-varpool.h ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \ tree-pass.h $(TIMEVAR_H) @@ -2584,30 +2596,31 @@ ipa-inline.o : ipa-inline.c gt-ipa-inline.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(HASHTAB_H) $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(RTL_H) $(IPA_PROP_H) ipa-utils.o : ipa-utils.c $(IPA_UTILS_H) $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ - pointer-set.h $(GGC_H) $(C_COMMON_H) $(TREE_GIMPLE_H) \ + pointer-set.h $(GGC_H) $(C_COMMON_H) $(GIMPLE_H) \ $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(TIMEVAR_H) $(DIAGNOSTIC_H) ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ pointer-set.h $(GGC_H) $(IPA_REFERENCE_H) $(IPA_UTILS_H) $(C_COMMON_H) \ - $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \ + $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \ $(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(C_COMMON_H) $(TARGET_H) \ - $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(TIMEVAR_H) \ + $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(TIMEVAR_H) \ $(DIAGNOSTIC_H) ipa-type-escape.o : ipa-type-escape.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ pointer-set.h $(GGC_H) $(IPA_TYPE_ESCAPE_H) $(IPA_UTILS_H) $(C_COMMON_H) \ - $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \ + $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h \ $(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) ipa-struct-reorg.o: ipa-struct-reorg.c ipa-struct-reorg.h $(CONFIG_H) $(SYSTEM_H) \ - coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(TREE_GIMPLE_H) tree-inline.h \ + coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(GIMPLE_H) tree-inline.h \ $(TREE_FLOW_H) langhooks.h pointer-set.h $(HASHTAB_H) $(C_TREE_H) $(TOPLEV_H) \ $(FLAGS_H) debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \ $(PARAMS_H) $(FIBHEAP_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) tree-iterator.h \ - tree-pass.h opts.h $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) $(C_COMMON_H) + tree-pass.h opts.h $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) $(C_COMMON_H) \ + $(GIMPLE_H) coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \ @@ -2658,12 +2671,12 @@ mode-switching.o : mode-switching.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ tree-ssa-dce.o : tree-ssa-dce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) \ coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(BASIC_BLOCK_H) \ - $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(TREE_GIMPLE_H) $(CFGLOOP_H) \ + $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(GIMPLE_H) $(CFGLOOP_H) \ tree-scalar-evolution.h tree-call-cdce.o : tree-call-cdce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ $(RTL_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) \ coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(BASIC_BLOCK_H) \ - $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(TREE_GIMPLE_H) + $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(GIMPLE_H) tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \ $(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \ @@ -2671,19 +2684,19 @@ tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \ tree-ssa-propagate.h value-prof.h $(FLAGS_H) $(TARGET_H) $(TOPLEV_H) tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \ $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \ - $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_GIMPLE_H) \ + $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \ langhooks.h tree-pass.h $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) \ $(BITMAP_H) $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(PARAMS_H) $(TARGET_H) tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \ - $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_GIMPLE_H) \ + $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \ tree-pass.h $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h \ $(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H) tree-complex.o : tree-complex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ - $(TM_H) $(RTL_H) $(REAL_H) $(FLAGS_H) $(TREE_FLOW_H) $(TREE_GIMPLE_H) \ + $(TM_H) $(RTL_H) $(REAL_H) $(FLAGS_H) $(TREE_FLOW_H) $(GIMPLE_H) \ tree-iterator.h tree-pass.h tree-ssa-propagate.h $(DIAGNOSTIC_H) tree-vect-generic.o : tree-vect-generic.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ - $(TM_H) $(TREE_FLOW_H) $(TREE_GIMPLE_H) tree-iterator.h tree-pass.h \ + $(TM_H) $(TREE_FLOW_H) $(GIMPLE_H) tree-iterator.h tree-pass.h \ $(FLAGS_H) $(OPTABS_H) $(RTL_H) $(MACHMODE_H) $(EXPR_H) \ langhooks.h $(FLAGS_H) $(DIAGNOSTIC_H) gt-tree-vect-generic.h $(GGC_H) \ coretypes.h insn-codes.h @@ -2953,9 +2966,9 @@ ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(REAL_H) $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h $(TIMEVAR_H) tree-pass.h \ $(DF_H) $(DBGCNT_H) lambda-mat.o : lambda-mat.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ - $(TM_H) coretypes.h $(TREE_H) + $(TM_H) coretypes.h $(TREE_H) $(TREE_FLOW_H) lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ - $(TM_H) coretypes.h $(TARGET_H) $(TREE_H) + $(TM_H) coretypes.h $(TARGET_H) $(TREE_H) $(TREE_FLOW_H) lambda-code.o: lambda-code.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ $(TM_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \ $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ @@ -2978,7 +2991,7 @@ $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \ output.h $(INSN_ATTR_H) $(SYSTEM_H) $(TOPLEV_H) $(TARGET_H) libfuncs.h \ $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \ - langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h + langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h $(GIMPLE_H) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ $(out_file) $(OUTPUT_OPTION) @@ -3203,6 +3216,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \ $(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-inline.c $(srcdir)/matrix-reorg.c \ $(srcdir)/dbxout.c $(srcdir)/ipa-struct-reorg.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \ + $(srcdir)/tree-vect-generic.c \ $(srcdir)/dojump.c \ $(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \ $(srcdir)/function.c $(srcdir)/except.h \ @@ -3211,18 +3225,24 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \ $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \ $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \ - $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h $(srcdir)/tree-scalar-evolution.c \ + $(srcdir)/gimple.h $(srcdir)/gimple.c \ + $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \ $(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \ - $(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \ - $(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \ + $(srcdir)/tree-cfg.c \ + $(srcdir)/tree-dfa.c \ $(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \ - $(srcdir)/tree-chrec.h $(srcdir)/tree-vect-generic.c \ + $(srcdir)/tree-chrec.h \ + $(srcdir)/tree-scalar-evolution.c \ $(srcdir)/tree-ssa-operands.h \ $(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \ - $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \ - $(srcdir)/tree-ssa-structalias.c $(srcdir)/tree-parloops.c \ - $(srcdir)/omp-low.c $(srcdir)/varpool.c \ + $(srcdir)/varpool.c \ + $(srcdir)/tree-parloops.c \ + $(srcdir)/omp-low.c \ $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \ + $(srcdir)/tree-ssa-propagate.c \ + $(srcdir)/tree-phinodes.c \ + $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \ + $(srcdir)/tree-ssa-structalias.c \ @all_gtfiles@ # Compute the list of GT header files from the corresponding C sources, @@ -3301,7 +3321,7 @@ build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H) \ $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h vec.h \ $(HASHTAB_H) gensupport.h build/gencheck.o : gencheck.c tree.def $(BCONFIG_H) $(GTM_H) \ - $(SYSTEM_H) coretypes.h $(lang_tree_files) + $(SYSTEM_H) coretypes.h $(lang_tree_files) gimple.def build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H) build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ coretypes.h $(GTM_H) errors.h gensupport.h diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fb57909e895..a4859fd744e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,40 @@ +2008-07-28 Richard Guenther + + Merge from gimple-tuples-branch. + + 2008-07-22 Olivier Hainque + + * gigi.h (end_subprog_body): New ELAB_P argument, saying if + this is called for an elab proc to be discarded if empty. + * utils.c (end_subprog_body): Honor ELAB_P. + (build_function_stub): Adjust call to end_subprog_body. + * trans.c (Subprogram_Body_to_gnu): Likewise. + (gigi): Reorganize processing of elab procs to prevent + gimplifying twice, using the new end_subprog_body argument. + + 2008-07-19 Richard Guenther + + * Make-lang.in (trans.o): Add tree-iterator.h dependency. + (utils.o): Likewise. + * trans.c: Include tree-iterator.h. + (gnat_gimplify_expr): Adjust prototype. Fix typo. + (gnat_gimplify_stmt): Use SET_EXPR_LOCATION. + (set_expr_location_from_node): Likewise. + (gigi): Tuplify. + * ada-tree.h (union lang_tree_node): Use TREE_CHAIN instead + of GENERIC_NEXT. + * utils.c: Include tree-iterator.h. + * gigi.h (gnat_gimplify_expr): Adjust prototype. + + 2008-07-18 Aldy Hernandez + + * trans.c: Include gimple.h instead of tree-gimple.h. + * utils.c: Same. + + 2008-07-14 Aldy Hernandez + + * trans.c (gnat_gimplify_expr): Use gimplify_assign. + 2008-07-25 Jan Hubicka * utils.c (end_subprog_body): Remove inline trees check. diff --git a/gcc/ada/Make-lang.in b/gcc/ada/Make-lang.in index 4136ebe5dca..268fa7031fc 100644 --- a/gcc/ada/Make-lang.in +++ b/gcc/ada/Make-lang.in @@ -1106,13 +1106,13 @@ ada/trans.o : ada/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(RTL_H) $(EXPR_H) $(FLAGS_H) $(FUNCTION_H) ada/ada.h except.h \ ada/types.h ada/atree.h ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h \ ada/einfo.h ada/namet.h ada/snames.h ada/stringt.h ada/urealp.h ada/fe.h \ - $(ADA_TREE_H) ada/gigi.h gt-ada-trans.h + $(ADA_TREE_H) ada/gigi.h gt-ada-trans.h tree-iterator.h ada/utils.o : ada/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FLAGS_H) $(EXPR_H) convert.h defaults.h langhooks.h \ ada/ada.h ada/types.h ada/atree.h ada/nlists.h ada/elists.h ada/sinfo.h \ ada/einfo.h ada/namet.h ada/stringt.h ada/uintp.h ada/fe.h $(ADA_TREE_H) \ - ada/gigi.h gt-ada-utils.h gtype-ada.h $(TARGET_H) + ada/gigi.h gt-ada-utils.h gtype-ada.h $(TARGET_H) tree-iterator.h ada/utils2.o : ada/utils2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FLAGS_H) ada/ada.h ada/types.h ada/atree.h ada/nlists.h \ diff --git a/gcc/ada/ada-tree.h b/gcc/ada/ada-tree.h index 044cea811b3..9c31e46f267 100644 --- a/gcc/ada/ada-tree.h +++ b/gcc/ada/ada-tree.h @@ -26,7 +26,7 @@ /* Ada uses the lang_decl and lang_type fields to hold a tree. */ union lang_tree_node GTY((desc ("0"), - chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.t)"))) + chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.t)"))) { union tree_node GTY((tag ("0"))) t; }; diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index 86ff090fdb0..aaf5e7f8d8f 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -233,8 +233,8 @@ extern tree gnat_to_gnu (Node_Id gnat_node); extern void gnat_expand_stmt (tree gnu_stmt); /* ??? missing documentation */ -extern int gnat_gimplify_expr (tree *expr_p, tree *pre_p, - tree *post_p ATTRIBUTE_UNUSED); +extern int gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED); /* Do the processing for the declaration of a GNAT_ENTITY, a type. If a separate Freeze node exists, delay the bulk of the processing. Otherwise @@ -668,10 +668,10 @@ extern tree create_label_decl (tree label_name); appearing in the subprogram. */ extern void begin_subprog_body (tree subprog_decl); -/* Finish the definition of the current subprogram and compile it all the way - to assembler language output. BODY is the tree corresponding to - the subprogram. */ -extern void end_subprog_body (tree body); +/* Finish the definition of the current subprogram BODY and compile it all the + way to assembler language output. ELAB_P tells if this is called for an + elaboration routine, to be entirely discarded if empty. */ +extern void end_subprog_body (tree body, bool elab_p); /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE. EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs. diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 89b10c695da..abc71f5e53e 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -40,7 +40,8 @@ #include "except.h" #include "debug.h" #include "output.h" -#include "tree-gimple.h" +#include "tree-iterator.h" +#include "gimple.h" #include "ada.h" #include "types.h" #include "atree.h" @@ -356,7 +357,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, for (info = elab_info_list; info; info = info->next) { tree gnu_body = DECL_SAVED_TREE (info->elab_proc); - tree gnu_stmts; /* Unshare SAVE_EXPRs between subprograms. These are not unshared by the gimplifier for obvious reasons, but it turns out that we need to @@ -368,30 +368,14 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, an upstream bug for which we would not change the outcome. */ walk_tree_without_duplicates (&gnu_body, unshare_save_expr, NULL); - /* Set the current function to be the elaboration procedure and gimplify - what we have. */ - current_function_decl = info->elab_proc; - gimplify_body (&gnu_body, info->elab_proc, true); + /* Process the function as others, but for indicating this is an + elab proc, to be discarded if empty, then propagate the status + up to the GNAT tree node. */ + begin_subprog_body (info->elab_proc); + end_subprog_body (gnu_body, true); - /* We should have a BIND_EXPR, but it may or may not have any statements - in it. If it doesn't have any, we have nothing to do. */ - gnu_stmts = gnu_body; - if (TREE_CODE (gnu_stmts) == BIND_EXPR) - gnu_stmts = BIND_EXPR_BODY (gnu_stmts); - - /* If there are no statements, there is no elaboration code. */ - if (!gnu_stmts || !STATEMENT_LIST_HEAD (gnu_stmts)) - { - Set_Has_No_Elaboration_Code (info->gnat_node, 1); - cgraph_remove_node (cgraph_node (info->elab_proc)); - } - else - { - /* Otherwise, compile the function. Note that we'll be gimplifying - it twice, but that's fine for the nodes we use. */ - begin_subprog_body (info->elab_proc); - end_subprog_body (gnu_body); - } + if (empty_body_p (gimple_body (info->elab_proc))) + Set_Has_No_Elaboration_Code (info->gnat_node, 1); } /* We cannot track the location of errors past this point. */ @@ -2003,7 +1987,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) : Sloc (gnat_node)), &DECL_STRUCT_FUNCTION (gnu_subprog_decl)->function_end_locus); - end_subprog_body (gnu_result); + end_subprog_body (gnu_result, false); /* Disconnect the trees for parameters that we made variables for from the GNAT entities since these are unusable after we end the function. */ @@ -5334,7 +5318,8 @@ pop_stack (tree *gnu_stack_ptr) /* Generate GIMPLE in place for the expression at *EXPR_P. */ int -gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED) +gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED) { tree expr = *expr_p; tree op; @@ -5419,14 +5404,14 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED) && TREE_CODE_CLASS (TREE_CODE (op)) != tcc_constant) { tree new_var = create_tmp_var (TREE_TYPE (op), "A"); - tree mod = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (op), new_var, op); + gimple stmt; TREE_ADDRESSABLE (new_var) = 1; + stmt = gimplify_assign (new_var, op, pre_p); if (EXPR_HAS_LOCATION (op)) - SET_EXPR_LOCUS (mod, EXPR_LOCUS (op)); + gimple_set_location (stmt, *EXPR_LOCUS (op)); - gimplify_and_add (mod, pre_p); TREE_OPERAND (expr, 0) = new_var; recompute_tree_invariant_for_addr_expr (expr); return GS_ALL_DONE; @@ -5494,7 +5479,7 @@ gnat_gimplify_stmt (tree *stmt_p) append_to_statement_list (LOOP_STMT_UPDATE (stmt), stmt_p); t = build1 (GOTO_EXPR, void_type_node, gnu_start_label); - set_expr_location (t, DECL_SOURCE_LOCATION (gnu_end_label)); + SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (gnu_end_label)); append_to_statement_list (t, stmt_p); append_to_statement_list (build1 (LABEL_EXPR, void_type_node, @@ -6913,7 +6898,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node) if (!Sloc_to_locus (Sloc (gnat_node), &locus)) return; - set_expr_location (node, locus); + SET_EXPR_LOCATION (node, locus); } /* Return a colon-separated list of encodings contained in encoded Ada diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 4668fa21c36..cde8d4dd2f3 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -43,7 +43,8 @@ #include "function.h" #include "cgraph.h" #include "tree-inline.h" -#include "tree-gimple.h" +#include "tree-iterator.h" +#include "gimple.h" #include "tree-dump.h" #include "pointer-set.h" #include "langhooks.h" @@ -2199,12 +2200,12 @@ gnat_genericize (tree fndecl) pointer_set_destroy (p_set); } -/* Finish the definition of the current subprogram and compile it all the way - to assembler language output. BODY is the tree corresponding to - the subprogram. */ +/* Finish the definition of the current subprogram BODY and compile it all the + way to assembler language output. ELAB_P tells if this is called for an + elaboration routine, to be entirely discarded if empty. */ void -end_subprog_body (tree body) +end_subprog_body (tree body, bool elab_p) { tree fndecl = current_function_decl; @@ -2246,7 +2247,13 @@ end_subprog_body (tree body) if (!DECL_CONTEXT (fndecl)) { gnat_gimplify_function (fndecl); - cgraph_finalize_function (fndecl, false); + + /* If this is an empty elaboration proc, just discard the node. + Otherwise, compile further. */ + if (elab_p && empty_body_p (gimple_body (fndecl))) + cgraph_remove_node (cgraph_node (fndecl)); + else + cgraph_finalize_function (fndecl, false); } else /* Register this function with cgraph just far enough to get it @@ -3117,7 +3124,7 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) gnat_poplevel (); allocate_struct_function (gnu_stub_decl, false); - end_subprog_body (gnu_body); + end_subprog_body (gnu_body, false); } /* Build a type to be used to represent an aliased object whose nominal diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 4aa864d66cf..ff6d0258191 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -122,7 +122,7 @@ struct edge_def GTY(()) /* Instructions queued on the edge. */ union edge_def_insns { - tree GTY ((tag ("true"))) t; + gimple_seq GTY ((tag ("true"))) g; rtx GTY ((tag ("false"))) r; } GTY ((desc ("current_ir_type () == IR_GIMPLE"))) insns; @@ -231,7 +231,7 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb") struct basic_block_def *next_bb; union basic_block_il_dependent { - struct tree_bb_info * GTY ((tag ("0"))) tree; + struct gimple_bb_info * GTY ((tag ("0"))) gimple; struct rtl_bb_info * GTY ((tag ("1"))) rtl; } GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il; @@ -266,13 +266,13 @@ struct rtl_bb_info GTY(()) int visited; }; -struct tree_bb_info GTY(()) +struct gimple_bb_info GTY(()) { - /* Pointers to the first and last trees of the block. */ - tree stmt_list; + /* Sequence of statements in this block. */ + gimple_seq seq; - /* Chain of PHI nodes for this block. */ - tree phi_nodes; + /* PHI nodes for this block. */ + gimple_seq phi_nodes; }; typedef struct basic_block_def *basic_block; @@ -383,7 +383,7 @@ struct control_flow_graph GTY(()) int x_last_basic_block; /* Mapping of labels to their associated blocks. At present - only used for the tree CFG. */ + only used for the gimple CFG. */ VEC(basic_block,gc) *x_label_to_block_map; enum profile_status { @@ -831,9 +831,9 @@ extern bool maybe_hot_bb_p (const_basic_block); extern bool maybe_hot_edge_p (edge); extern bool probably_cold_bb_p (const_basic_block); extern bool probably_never_executed_bb_p (const_basic_block); -extern bool tree_predicted_by_p (const_basic_block, enum br_predictor); +extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor); extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor); -extern void tree_predict_edge (edge, enum br_predictor, int); +extern void gimple_predict_edge (edge, enum br_predictor, int); extern void rtl_predict_edge (edge, enum br_predictor, int); extern void predict_edge_def (edge, enum br_predictor, enum prediction); extern void guess_outgoing_edge_probabilities (basic_block); diff --git a/gcc/builtins.c b/gcc/builtins.c index b46cd266b39..288ad59717e 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "real.h" #include "rtl.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "flags.h" #include "regs.h" #include "hard-reg-set.h" @@ -3287,6 +3287,7 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) false, /*endp=*/0); HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; + tree_ann_common_t ann; if (result) { @@ -3308,7 +3309,10 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) if (src_align == 0) return NULL_RTX; - stringop_block_profile (exp, &expected_align, &expected_size); + ann = tree_common_ann (exp); + if (ann) + stringop_block_profile (ann->stmt, &expected_align, &expected_size); + if (expected_align < dest_align) expected_align = dest_align; dest_mem = get_memory_rtx (dest, len); @@ -3883,6 +3887,7 @@ expand_builtin_memset_args (tree dest, tree val, tree len, rtx dest_mem, dest_addr, len_rtx; HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; + tree_ann_common_t ann; dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); @@ -3890,7 +3895,10 @@ expand_builtin_memset_args (tree dest, tree val, tree len, if (dest_align == 0) return NULL_RTX; - stringop_block_profile (orig_exp, &expected_align, &expected_size); + ann = tree_common_ann (orig_exp); + if (ann) + stringop_block_profile (ann->stmt, &expected_align, &expected_size); + if (expected_align < dest_align) expected_align = dest_align; @@ -4755,7 +4763,8 @@ expand_builtin_va_start (tree exp) current (padded) address and increment by the (padded) size. */ tree -std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) +std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { tree addr, t, type_size, rounded_size, valist_tmp; unsigned HOST_WIDE_INT align, boundary; @@ -4875,7 +4884,7 @@ dummy_object (tree type) builtin function, but a very special sort of operator. */ enum gimplify_status -gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p) +gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) { tree promoted_type, have_va_type; tree valist = TREE_OPERAND (*expr_p, 0); @@ -4917,7 +4926,7 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p) Call abort to encourage the user to fix the program. */ inform ("if this code is reached, the program will abort"); t = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0); - append_to_statement_list (t, pre_p); + gimplify_and_add (t, pre_p); /* This is dead code, but go ahead and finish so that the mode of the result comes out right. */ @@ -4939,13 +4948,14 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p) tree p1 = build_pointer_type (TREE_TYPE (have_va_type)); valist = build_fold_addr_expr_with_type (valist, p1); } + gimplify_expr (&valist, pre_p, post_p, is_gimple_val, fb_rvalue); } else gimplify_expr (&valist, pre_p, post_p, is_gimple_min_lval, fb_lvalue); if (!targetm.gimplify_va_arg_expr) - /* FIXME:Once most targets are converted we should merely + /* FIXME: Once most targets are converted we should merely assert this is non-null. */ return GS_ALL_DONE; @@ -7292,7 +7302,7 @@ integer_valued_real_p (tree t) case COMPOUND_EXPR: case MODIFY_EXPR: case BIND_EXPR: - return integer_valued_real_p (GENERIC_TREE_OPERAND (t, 1)); + return integer_valued_real_p (TREE_OPERAND (t, 1)); case PLUS_EXPR: case MINUS_EXPR: @@ -10572,7 +10582,7 @@ fold_builtin_n (tree fndecl, tree *args, int nargs, bool ignore) } if (ret) { - ret = build1 (NOP_EXPR, GENERIC_TREE_TYPE (ret), ret); + ret = build1 (NOP_EXPR, TREE_TYPE (ret), ret); TREE_NO_WARNING (ret) = 1; return ret; } @@ -10830,6 +10840,61 @@ validate_arg (const_tree arg, enum tree_code code) return code == TREE_CODE (TREE_TYPE (arg)); } +/* This function validates the types of a function call argument list + against a specified list of tree_codes. If the last specifier is a 0, + that represents an ellipses, otherwise the last specifier must be a + VOID_TYPE. + + This is the GIMPLE version of validate_arglist. Eventually we want to + completely convert builtins.c to work from GIMPLEs and the tree based + validate_arglist will then be removed. */ + +bool +validate_gimple_arglist (const_gimple call, ...) +{ + enum tree_code code; + bool res = 0; + va_list ap; + const_tree arg; + size_t i; + + va_start (ap, call); + i = 0; + + do + { + code = va_arg (ap, enum tree_code); + switch (code) + { + case 0: + /* This signifies an ellipses, any further arguments are all ok. */ + res = true; + goto end; + case VOID_TYPE: + /* This signifies an endlink, if no arguments remain, return + true, otherwise return false. */ + res = (i == gimple_call_num_args (call)); + goto end; + default: + /* If no parameters remain or the parameter's code does not + match the specified code, return false. Otherwise continue + checking any remaining arguments. */ + arg = gimple_call_arg (call, i++); + if (!validate_arg (arg, code)) + goto end; + break; + } + } + while (1); + + /* We need gotos here since we can only have one VA_CLOSE in a + function. */ + end: ; + va_end (ap); + + return res; +} + /* This function validates the types of a function call argument list against a specified list of tree_codes. If the last specifier is a 0, that represents an ellipses, otherwise the last specifier must be a @@ -11439,6 +11504,7 @@ fold_builtin_fputs (tree arg0, tree arg1, bool ignore, bool unlocked, tree len) /* Fold the next_arg or va_start call EXP. Returns true if there was an error produced. False otherwise. This is done so that we don't output the error or warning twice or three times. */ + bool fold_builtin_next_arg (tree exp, bool va_start_p) { @@ -13113,3 +13179,303 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type) return result; } #endif + +/* FIXME tuples. + The functions below provide an alternate interface for folding + builtin function calls presented as GIMPLE_CALL statements rather + than as CALL_EXPRs. The folded result is still expressed as a + tree. There is too much code duplication in the handling of + varargs functions, and a more intrusive re-factoring would permit + better sharing of code between the tree and statement-based + versions of these functions. */ + +/* Construct a new CALL_EXPR using the tail of the argument list of STMT + along with N new arguments specified as the "..." parameters. SKIP + is the number of arguments in STMT to be omitted. This function is used + to do varargs-to-varargs transformations. */ + +static tree +gimple_rewrite_call_expr (gimple stmt, int skip, tree fndecl, int n, ...) +{ + int oldnargs = gimple_call_num_args (stmt); + int nargs = oldnargs - skip + n; + tree fntype = TREE_TYPE (fndecl); + tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl); + tree *buffer; + int i, j; + va_list ap; + + buffer = XALLOCAVEC (tree, nargs); + va_start (ap, n); + for (i = 0; i < n; i++) + buffer[i] = va_arg (ap, tree); + va_end (ap); + for (j = skip; j < oldnargs; j++, i++) + buffer[i] = gimple_call_arg (stmt, j); + + return fold (build_call_array (TREE_TYPE (fntype), fn, nargs, buffer)); +} + +/* Fold a call STMT to __{,v}sprintf_chk. Return NULL_TREE if + a normal call should be emitted rather than expanding the function + inline. FCODE is either BUILT_IN_SPRINTF_CHK or BUILT_IN_VSPRINTF_CHK. */ + +static tree +gimple_fold_builtin_sprintf_chk (gimple stmt, enum built_in_function fcode) +{ + tree dest, size, len, fn, fmt, flag; + const char *fmt_str; + int nargs = gimple_call_num_args (stmt); + + /* Verify the required arguments in the original call. */ + if (nargs < 4) + return NULL_TREE; + dest = gimple_call_arg (stmt, 0); + if (!validate_arg (dest, POINTER_TYPE)) + return NULL_TREE; + flag = gimple_call_arg (stmt, 1); + if (!validate_arg (flag, INTEGER_TYPE)) + return NULL_TREE; + size = gimple_call_arg (stmt, 2); + if (!validate_arg (size, INTEGER_TYPE)) + return NULL_TREE; + fmt = gimple_call_arg (stmt, 3); + if (!validate_arg (fmt, POINTER_TYPE)) + return NULL_TREE; + + if (! host_integerp (size, 1)) + return NULL_TREE; + + len = NULL_TREE; + + if (!init_target_chars ()) + return NULL_TREE; + + /* Check whether the format is a literal string constant. */ + fmt_str = c_getstr (fmt); + if (fmt_str != NULL) + { + /* If the format doesn't contain % args or %%, we know the size. */ + if (strchr (fmt_str, target_percent) == 0) + { + if (fcode != BUILT_IN_SPRINTF_CHK || nargs == 4) + len = build_int_cstu (size_type_node, strlen (fmt_str)); + } + /* If the format is "%s" and first ... argument is a string literal, + we know the size too. */ + else if (fcode == BUILT_IN_SPRINTF_CHK + && strcmp (fmt_str, target_percent_s) == 0) + { + tree arg; + + if (nargs == 5) + { + arg = gimple_call_arg (stmt, 4); + if (validate_arg (arg, POINTER_TYPE)) + { + len = c_strlen (arg, 1); + if (! len || ! host_integerp (len, 1)) + len = NULL_TREE; + } + } + } + } + + if (! integer_all_onesp (size)) + { + if (! len || ! tree_int_cst_lt (len, size)) + return NULL_TREE; + } + + /* Only convert __{,v}sprintf_chk to {,v}sprintf if flag is 0 + or if format doesn't contain % chars or is "%s". */ + if (! integer_zerop (flag)) + { + if (fmt_str == NULL) + return NULL_TREE; + if (strchr (fmt_str, target_percent) != NULL + && strcmp (fmt_str, target_percent_s)) + return NULL_TREE; + } + + /* If __builtin_{,v}sprintf_chk is used, assume {,v}sprintf is available. */ + fn = built_in_decls[fcode == BUILT_IN_VSPRINTF_CHK + ? BUILT_IN_VSPRINTF : BUILT_IN_SPRINTF]; + if (!fn) + return NULL_TREE; + + return gimple_rewrite_call_expr (stmt, 4, fn, 2, dest, fmt); +} + +/* Fold a call STMT to {,v}snprintf. Return NULL_TREE if + a normal call should be emitted rather than expanding the function + inline. FCODE is either BUILT_IN_SNPRINTF_CHK or + BUILT_IN_VSNPRINTF_CHK. If MAXLEN is not NULL, it is maximum length + passed as second argument. */ + +tree +gimple_fold_builtin_snprintf_chk (gimple stmt, tree maxlen, + enum built_in_function fcode) +{ + tree dest, size, len, fn, fmt, flag; + const char *fmt_str; + + /* Verify the required arguments in the original call. */ + if (gimple_call_num_args (stmt) < 5) + return NULL_TREE; + dest = gimple_call_arg (stmt, 0); + if (!validate_arg (dest, POINTER_TYPE)) + return NULL_TREE; + len = gimple_call_arg (stmt, 1); + if (!validate_arg (len, INTEGER_TYPE)) + return NULL_TREE; + flag = gimple_call_arg (stmt, 2); + if (!validate_arg (flag, INTEGER_TYPE)) + return NULL_TREE; + size = gimple_call_arg (stmt, 3); + if (!validate_arg (size, INTEGER_TYPE)) + return NULL_TREE; + fmt = gimple_call_arg (stmt, 4); + if (!validate_arg (fmt, POINTER_TYPE)) + return NULL_TREE; + + if (! host_integerp (size, 1)) + return NULL_TREE; + + if (! integer_all_onesp (size)) + { + if (! host_integerp (len, 1)) + { + /* If LEN is not constant, try MAXLEN too. + For MAXLEN only allow optimizing into non-_ocs function + if SIZE is >= MAXLEN, never convert to __ocs_fail (). */ + if (maxlen == NULL_TREE || ! host_integerp (maxlen, 1)) + return NULL_TREE; + } + else + maxlen = len; + + if (tree_int_cst_lt (size, maxlen)) + return NULL_TREE; + } + + if (!init_target_chars ()) + return NULL_TREE; + + /* Only convert __{,v}snprintf_chk to {,v}snprintf if flag is 0 + or if format doesn't contain % chars or is "%s". */ + if (! integer_zerop (flag)) + { + fmt_str = c_getstr (fmt); + if (fmt_str == NULL) + return NULL_TREE; + if (strchr (fmt_str, target_percent) != NULL + && strcmp (fmt_str, target_percent_s)) + return NULL_TREE; + } + + /* If __builtin_{,v}snprintf_chk is used, assume {,v}snprintf is + available. */ + fn = built_in_decls[fcode == BUILT_IN_VSNPRINTF_CHK + ? BUILT_IN_VSNPRINTF : BUILT_IN_SNPRINTF]; + if (!fn) + return NULL_TREE; + + return gimple_rewrite_call_expr (stmt, 5, fn, 3, dest, len, fmt); +} + +/* Builtins with folding operations that operate on "..." arguments + need special handling; we need to store the arguments in a convenient + data structure before attempting any folding. Fortunately there are + only a few builtins that fall into this category. FNDECL is the + function, EXP is the CALL_EXPR for the call, and IGNORE is true if the + result of the function call is ignored. */ + +static tree +gimple_fold_builtin_varargs (tree fndecl, gimple stmt, bool ignore ATTRIBUTE_UNUSED) +{ + enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); + tree ret = NULL_TREE; + + switch (fcode) + { + case BUILT_IN_SPRINTF_CHK: + case BUILT_IN_VSPRINTF_CHK: + ret = gimple_fold_builtin_sprintf_chk (stmt, fcode); + break; + + case BUILT_IN_SNPRINTF_CHK: + case BUILT_IN_VSNPRINTF_CHK: + ret = gimple_fold_builtin_snprintf_chk (stmt, NULL_TREE, fcode); + + default: + break; + } + if (ret) + { + ret = build1 (NOP_EXPR, TREE_TYPE (ret), ret); + TREE_NO_WARNING (ret) = 1; + return ret; + } + return NULL_TREE; +} + +/* A wrapper function for builtin folding that prevents warnings for + "statement without effect" and the like, caused by removing the + call node earlier than the warning is generated. */ + +tree +fold_call_stmt (gimple stmt, bool ignore) +{ + tree ret = NULL_TREE; + tree fndecl = gimple_call_fndecl (stmt); + if (fndecl + && TREE_CODE (fndecl) == FUNCTION_DECL + && DECL_BUILT_IN (fndecl) + && !gimple_call_va_arg_pack_p (stmt)) + { + int nargs = gimple_call_num_args (stmt); + + /* FIXME: Don't use a list in this interface. */ + if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) + { + tree arglist = NULL_TREE; + int i; + for (i = nargs - 1; i >= 0; i--) + arglist = tree_cons (NULL_TREE, gimple_call_arg (stmt, i), arglist); + return targetm.fold_builtin (fndecl, arglist, ignore); + } + else + { + if (nargs <= MAX_ARGS_TO_FOLD_BUILTIN) + { + tree args[MAX_ARGS_TO_FOLD_BUILTIN]; + int i; + for (i = 0; i < nargs; i++) + args[i] = gimple_call_arg (stmt, i); + ret = fold_builtin_n (fndecl, args, nargs, ignore); + } + if (!ret) + ret = gimple_fold_builtin_varargs (fndecl, stmt, ignore); + if (ret) + { + /* Propagate location information from original call to + expansion of builtin. Otherwise things like + maybe_emit_chk_warning, that operate on the expansion + of a builtin, will use the wrong location information. */ + if (gimple_has_location (stmt)) + { + tree realret = ret; + if (TREE_CODE (ret) == NOP_EXPR) + realret = TREE_OPERAND (ret, 0); + if (CAN_HAVE_LOCATION_P (realret) + && !EXPR_HAS_LOCATION (realret)) + SET_EXPR_LOCATION (realret, gimple_location (stmt)); + return realret; + } + return ret; + } + } + } + return NULL_TREE; +} diff --git a/gcc/c-common.c b/gcc/c-common.c index c9ffd9c9aa3..caac53e7cdd 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "real.h" #include "cgraph.h" #include "target-def.h" +#include "gimple.h" #include "fixed-value.h" cpp_reader *parse_in; /* Declared in c-pragma.h. */ @@ -7376,71 +7377,67 @@ c_parse_error (const char *gmsgid, enum cpp_ttype token, tree value) inlining, so we don't have to worry about that. */ void -c_warn_unused_result (tree *top_p) +c_warn_unused_result (gimple_seq seq) { - tree t = *top_p; - tree_stmt_iterator i; tree fdecl, ftype; + gimple_stmt_iterator i; - switch (TREE_CODE (t)) + for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) { - case STATEMENT_LIST: - for (i = tsi_start (*top_p); !tsi_end_p (i); tsi_next (&i)) - c_warn_unused_result (tsi_stmt_ptr (i)); - break; - - case COND_EXPR: - c_warn_unused_result (&COND_EXPR_THEN (t)); - c_warn_unused_result (&COND_EXPR_ELSE (t)); - break; - case BIND_EXPR: - c_warn_unused_result (&BIND_EXPR_BODY (t)); - break; - case TRY_FINALLY_EXPR: - case TRY_CATCH_EXPR: - c_warn_unused_result (&TREE_OPERAND (t, 0)); - c_warn_unused_result (&TREE_OPERAND (t, 1)); - break; - case CATCH_EXPR: - c_warn_unused_result (&CATCH_BODY (t)); - break; - case EH_FILTER_EXPR: - c_warn_unused_result (&EH_FILTER_FAILURE (t)); - break; + gimple g = gsi_stmt (i); - case CALL_EXPR: - if (TREE_USED (t)) - break; - - /* This is a naked call, as opposed to a CALL_EXPR nested inside - a MODIFY_EXPR. All calls whose value is ignored should be - represented like this. Look for the attribute. */ - fdecl = get_callee_fndecl (t); - if (fdecl) - ftype = TREE_TYPE (fdecl); - else + switch (gimple_code (g)) { - ftype = TREE_TYPE (CALL_EXPR_FN (t)); - /* Look past pointer-to-function to the function type itself. */ - ftype = TREE_TYPE (ftype); - } + case GIMPLE_BIND: + c_warn_unused_result (gimple_bind_body (g)); + break; + case GIMPLE_TRY: + c_warn_unused_result (gimple_try_eval (g)); + c_warn_unused_result (gimple_try_cleanup (g)); + break; + case GIMPLE_CATCH: + c_warn_unused_result (gimple_catch_handler (g)); + break; + case GIMPLE_EH_FILTER: + c_warn_unused_result (gimple_eh_filter_failure (g)); + break; - if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype))) - { - if (fdecl) - warning (0, "%Hignoring return value of %qD, " - "declared with attribute warn_unused_result", - EXPR_LOCUS (t), fdecl); + case GIMPLE_CALL: + if (gimple_call_lhs (g)) + break; + + /* This is a naked call, as opposed to a GIMPLE_CALL with an + LHS. All calls whose value is ignored should be + represented like this. Look for the attribute. */ + fdecl = gimple_call_fn (g); + if (TREE_CODE (fdecl) == FUNCTION_DECL) + ftype = TREE_TYPE (fdecl); else - warning (0, "%Hignoring return value of function " - "declared with attribute warn_unused_result", - EXPR_LOCUS (t)); - } - break; + { + ftype = TREE_TYPE (fdecl); + /* Look past pointer-to-function to the function type itself. */ + ftype = TREE_TYPE (ftype); + } - default: - /* Not a container, not a call, or a call whose value is used. */ - break; + if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype))) + { + location_t loc = gimple_location (g); + + if (fdecl) + warning (0, "%Hignoring return value of %qD, " + "declared with attribute warn_unused_result", + &loc, fdecl); + else + warning (0, "%Hignoring return value of function " + "declared with attribute warn_unused_result", + &loc); + } + break; + + default: + /* Not a container, not a call, or a call whose value is used. */ + break; + } } } diff --git a/gcc/c-common.h b/gcc/c-common.h index 9850dfa94d0..1ff5d665532 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -897,7 +897,7 @@ extern void dump_time_statistics (void); extern bool c_dump_tree (void *, tree); -extern void c_warn_unused_result (tree *); +extern void c_warn_unused_result (gimple_seq); extern void verify_sequence_points (tree); @@ -928,7 +928,7 @@ extern void warn_for_div_by_zero (tree divisor); /* In c-gimplify.c */ extern void c_genericize (tree); -extern int c_gimplify_expr (tree *, tree *, tree *); +extern int c_gimplify_expr (tree *, gimple_seq *, gimple_seq *); extern tree c_build_bind_expr (tree, tree); /* In c-pch.c */ diff --git a/gcc/c-decl.c b/gcc/c-decl.c index dd5f1ea0888..bdb68199351 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -52,7 +52,8 @@ along with GCC; see the file COPYING3. If not see #include "c-pragma.h" #include "langhooks.h" #include "tree-mudflap.h" -#include "tree-gimple.h" +#include "gimple.h" +#include "tree-iterator.h" #include "diagnostic.h" #include "tree-dump.h" #include "cgraph.h" @@ -61,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "except.h" #include "langhooks-def.h" #include "pointer-set.h" +#include "gimple.h" /* In grokdeclarator, distinguish syntactic contexts of declarators. */ enum decl_context @@ -248,7 +250,7 @@ extern char C_SIZEOF_STRUCT_LANG_IDENTIFIER_isnt_accurate union lang_tree_node GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), - chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *) TYPE_NEXT_VARIANT (&%h.generic) : ((union lang_tree_node *) GENERIC_NEXT (&%h.generic))"))) + chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *) TYPE_NEXT_VARIANT (&%h.generic) : ((union lang_tree_node *) TREE_CHAIN (&%h.generic))"))) { union tree_node GTY ((tag ("0"), desc ("tree_node_structure (&%h)"))) @@ -1836,6 +1838,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl); DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); + gimple_set_body (newdecl, gimple_body (olddecl)); DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); /* Set DECL_INLINE on the declaration if we've got a body @@ -1870,6 +1873,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) sizeof (struct tree_decl_common) - sizeof (struct tree_common)); switch (TREE_CODE (olddecl)) { + case FUNCTION_DECL: + gimple_set_body (olddecl, gimple_body (newdecl)); + /* fall through */ + case FIELD_DECL: case VAR_DECL: case PARM_DECL: @@ -1877,7 +1884,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) case RESULT_DECL: case CONST_DECL: case TYPE_DECL: - case FUNCTION_DECL: memcpy ((char *) olddecl + sizeof (struct tree_decl_common), (char *) newdecl + sizeof (struct tree_decl_common), tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common)); @@ -4050,7 +4056,7 @@ grokdeclarator (const struct c_declarator *declarator, "signed". */ if (bitfield && !flag_signed_bitfields && !declspecs->explicit_signed_p && TREE_CODE (type) == INTEGER_TYPE) - type = c_common_unsigned_type (type); + type = unsigned_type_for (type); /* Figure out the type qualifiers for the declaration. There are two ways a declaration can become qualified. One is something @@ -6634,9 +6640,10 @@ static void c_gimple_diagnostics_recursively (tree fndecl) { struct cgraph_node *cgn; + gimple_seq body = gimple_body (fndecl); /* Handle attribute((warn_unused_result)). Relies on gimple input. */ - c_warn_unused_result (&DECL_SAVED_TREE (fndecl)); + c_warn_unused_result (body); /* Notice when OpenMP structured block constraints are violated. */ if (flag_openmp) diff --git a/gcc/c-format.c b/gcc/c-format.c index fa28763028f..9d20d12b97b 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -2262,7 +2262,7 @@ check_format_types (format_wanted_type *types, const char *format_start, && TREE_CODE (cur_type) == INTEGER_TYPE && (!pedantic || i == 0 || (i == 1 && char_type_flag)) && (TYPE_UNSIGNED (wanted_type) - ? wanted_type == c_common_unsigned_type (cur_type) + ? wanted_type == unsigned_type_for (cur_type) : wanted_type == c_common_signed_type (cur_type))) continue; /* Likewise, "signed char", "unsigned char" and "char" are diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c index 12292a7e591..342848acd29 100644 --- a/gcc/c-gimplify.c +++ b/gcc/c-gimplify.c @@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "varray.h" #include "c-tree.h" #include "c-common.h" -#include "tree-gimple.h" +#include "gimple.h" #include "hard-reg-set.h" #include "basic-block.h" #include "tree-flow.h" @@ -104,7 +104,6 @@ c_genericize (tree fndecl) /* Go ahead and gimplify for now. */ gimplify_function_tree (fndecl); - /* Dump the genericized tree IR. */ dump_function (TDI_generic, fndecl); /* Genericize all nested functions now. We do things in this order so @@ -118,14 +117,16 @@ c_genericize (tree fndecl) static void add_block_to_enclosing (tree block) { + unsigned i; tree enclosing; + gimple bind; + VEC(gimple, heap) *stack = gimple_bind_expr_stack (); - for (enclosing = gimple_current_bind_expr (); - enclosing; enclosing = TREE_CHAIN (enclosing)) - if (BIND_EXPR_BLOCK (enclosing)) + for (i = 0; VEC_iterate (gimple, stack, i, bind); i++) + if (gimple_bind_block (bind)) break; - enclosing = BIND_EXPR_BLOCK (enclosing); + enclosing = gimple_bind_block (bind); BLOCK_SUBBLOCKS (enclosing) = chainon (BLOCK_SUBBLOCKS (enclosing), block); } @@ -178,7 +179,7 @@ c_build_bind_expr (tree block, tree body) decl instead. */ static enum gimplify_status -gimplify_compound_literal_expr (tree *expr_p, tree *pre_p) +gimplify_compound_literal_expr (tree *expr_p, gimple_seq *pre_p) { tree decl_s = COMPOUND_LITERAL_EXPR_DECL_STMT (*expr_p); tree decl = DECL_EXPR_DECL (decl_s); @@ -249,10 +250,12 @@ optimize_compound_literals_in_ctor (tree orig_ctor) return ctor; } -/* Do C-specific gimplification. Args are as for gimplify_expr. */ +/* Do C-specific gimplification on *EXPR_P. PRE_P and POST_P are as in + gimplify_expr. */ int -c_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED) +c_gimplify_expr (tree *expr_p, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED) { enum tree_code code = TREE_CODE (*expr_p); diff --git a/gcc/c-omp.c b/gcc/c-omp.c index 1da71d27b9c..7da659cc9fb 100644 --- a/gcc/c-omp.c +++ b/gcc/c-omp.c @@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "c-common.h" #include "toplev.h" -#include "tree-gimple.h" +#include "gimple.h" #include "bitmap.h" #include "langhooks.h" diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 4386c392c9f..67a466ba749 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -1852,14 +1852,13 @@ static void pp_c_assignment_expression (c_pretty_printer *pp, tree e) { if (TREE_CODE (e) == MODIFY_EXPR - || TREE_CODE (e) == GIMPLE_MODIFY_STMT || TREE_CODE (e) == INIT_EXPR) { - pp_c_unary_expression (pp, GENERIC_TREE_OPERAND (e, 0)); + pp_c_unary_expression (pp, TREE_OPERAND (e, 0)); pp_c_whitespace (pp); pp_equal (pp); pp_space (pp); - pp_c_expression (pp, GENERIC_TREE_OPERAND (e, 1)); + pp_c_expression (pp, TREE_OPERAND (e, 1)); } else pp_c_conditional_expression (pp, e); @@ -2007,7 +2006,6 @@ pp_c_expression (c_pretty_printer *pp, tree e) break; case MODIFY_EXPR: - case GIMPLE_MODIFY_STMT: case INIT_EXPR: pp_assignment_expression (pp, e); break; diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index c7933beea1b..62faee54ea8 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -43,7 +43,8 @@ along with GCC; see the file COPYING3. If not see #include "timevar.h" #include "predict.h" #include "tree-inline.h" -#include "tree-gimple.h" +#include "gimple.h" +#include "tree-iterator.h" #include "langhooks.h" /* Create an empty statement tree rooted at T. */ diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 5d7036a4367..160229ad8b8 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "target.h" #include "tree-iterator.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-flow.h" /* Possible cases of implicit bad conversions. Used to select diff --git a/gcc/calls.c b/gcc/calls.c index a4470fa1477..71bdf8c003b 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "rtl.h" #include "tree.h" +#include "gimple.h" #include "flags.h" #include "expr.h" #include "optabs.h" @@ -41,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "except.h" #include "dbgcnt.h" +#include "tree-flow.h" /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) @@ -380,7 +382,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED, add_reg_note (call_insn, REG_EH_REGION, const0_rtx); else { - int rn = lookup_stmt_eh_region (fntree); + int rn = lookup_expr_eh_region (fntree); /* If rn < 0, then either (1) tree-ssa not used or (2) doesn't throw, which we already took care of. */ @@ -542,7 +544,26 @@ setjmp_call_p (const_tree fndecl) return special_function_p (fndecl, 0) & ECF_RETURNS_TWICE; } + +/* Return true if STMT is an alloca call. */ + +bool +gimple_alloca_call_p (const_gimple stmt) +{ + tree fndecl; + + if (!is_gimple_call (stmt)) + return false; + + fndecl = gimple_call_fndecl (stmt); + if (fndecl && (special_function_p (fndecl, 0) & ECF_MAY_BE_ALLOCA)) + return true; + + return false; +} + /* Return true when exp contains alloca call. */ + bool alloca_call_p (const_tree exp) { @@ -2251,7 +2272,7 @@ expand_call (tree exp, rtx target, int ignore) if (currently_expanding_call++ != 0 || !flag_optimize_sibling_calls || args_size.var - || lookup_stmt_eh_region (exp) >= 0 + || lookup_expr_eh_region (exp) >= 0 || dbg_cnt (tail_call) == false) try_tail_call = 0; @@ -3229,7 +3250,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, #ifdef REG_PARM_STACK_SPACE /* Define the boundary of the register parm stack space that needs to be save, if any. */ - int low_to_save, high_to_save; + int low_to_save = 0, high_to_save = 0; rtx save_area = 0; /* Place that it is saved. */ #endif diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 69bd69c33d8..b4c33ab8193 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -42,6 +42,352 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "target.h" + +/* Return an expression tree corresponding to the RHS of GIMPLE + statement STMT. */ + +tree +gimple_assign_rhs_to_tree (gimple stmt) +{ + tree t; + enum gimple_rhs_class class; + + class = get_gimple_rhs_class (gimple_expr_code (stmt)); + + if (class == GIMPLE_BINARY_RHS) + t = build2 (gimple_assign_rhs_code (stmt), + TREE_TYPE (gimple_assign_lhs (stmt)), + gimple_assign_rhs1 (stmt), + gimple_assign_rhs2 (stmt)); + else if (class == GIMPLE_UNARY_RHS) + t = build1 (gimple_assign_rhs_code (stmt), + TREE_TYPE (gimple_assign_lhs (stmt)), + gimple_assign_rhs1 (stmt)); + else if (class == GIMPLE_SINGLE_RHS) + t = gimple_assign_rhs1 (stmt); + else + gcc_unreachable (); + + return t; +} + +/* Return an expression tree corresponding to the PREDICATE of GIMPLE_COND + statement STMT. */ + +static tree +gimple_cond_pred_to_tree (gimple stmt) +{ + return build2 (gimple_cond_code (stmt), boolean_type_node, + gimple_cond_lhs (stmt), gimple_cond_rhs (stmt)); +} + +/* Helper for gimple_to_tree. Set EXPR_LOCATION for every expression + inside *TP. DATA is the location to set. */ + +static tree +set_expr_location_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) +{ + location_t *loc = (location_t *) data; + if (EXPR_P (*tp)) + SET_EXPR_LOCATION (*tp, *loc); + + return NULL_TREE; +} + + +/* RTL expansion has traditionally been done on trees, so the + transition to doing it on GIMPLE tuples is very invasive to the RTL + expander. To facilitate the transition, this function takes a + GIMPLE tuple STMT and returns the same statement in the form of a + tree. */ + +static tree +gimple_to_tree (gimple stmt) +{ + tree t; + int rn; + tree_ann_common_t ann; + location_t loc; + + switch (gimple_code (stmt)) + { + case GIMPLE_ASSIGN: + { + tree lhs = gimple_assign_lhs (stmt); + + t = gimple_assign_rhs_to_tree (stmt); + t = build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, t); + if (gimple_assign_nontemporal_move_p (stmt)) + MOVE_NONTEMPORAL (t) = true; + } + break; + + case GIMPLE_COND: + t = gimple_cond_pred_to_tree (stmt); + t = build3 (COND_EXPR, void_type_node, t, NULL_TREE, NULL_TREE); + break; + + case GIMPLE_GOTO: + t = build1 (GOTO_EXPR, void_type_node, gimple_goto_dest (stmt)); + break; + + case GIMPLE_LABEL: + t = build1 (LABEL_EXPR, void_type_node, gimple_label_label (stmt)); + break; + + case GIMPLE_RETURN: + { + tree retval = gimple_return_retval (stmt); + + if (retval && retval != error_mark_node) + { + tree result = DECL_RESULT (current_function_decl); + + /* If we are not returning the current function's RESULT_DECL, + build an assignment to it. */ + if (retval != result) + { + /* I believe that a function's RESULT_DECL is unique. */ + gcc_assert (TREE_CODE (retval) != RESULT_DECL); + + retval = build2 (MODIFY_EXPR, TREE_TYPE (result), + result, retval); + } + } + t = build1 (RETURN_EXPR, void_type_node, retval); + } + break; + + case GIMPLE_ASM: + { + size_t i, n; + tree out, in, cl; + const char *s; + + out = NULL_TREE; + n = gimple_asm_noutputs (stmt); + if (n > 0) + { + t = out = gimple_asm_output_op (stmt, 0); + for (i = 1; i < n; i++) + { + TREE_CHAIN (t) = gimple_asm_output_op (stmt, i); + t = gimple_asm_output_op (stmt, i); + } + } + + in = NULL_TREE; + n = gimple_asm_ninputs (stmt); + if (n > 0) + { + t = in = gimple_asm_input_op (stmt, 0); + for (i = 1; i < n; i++) + { + TREE_CHAIN (t) = gimple_asm_input_op (stmt, i); + t = gimple_asm_input_op (stmt, i); + } + } + + cl = NULL_TREE; + n = gimple_asm_nclobbers (stmt); + if (n > 0) + { + t = cl = gimple_asm_clobber_op (stmt, 0); + for (i = 1; i < n; i++) + { + TREE_CHAIN (t) = gimple_asm_clobber_op (stmt, i); + t = gimple_asm_clobber_op (stmt, i); + } + } + + s = gimple_asm_string (stmt); + t = build4 (ASM_EXPR, void_type_node, build_string (strlen (s), s), + out, in, cl); + ASM_VOLATILE_P (t) = gimple_asm_volatile_p (stmt); + ASM_INPUT_P (t) = gimple_asm_input_p (stmt); + } + break; + + case GIMPLE_CALL: + { + size_t i; + tree fn; + tree_ann_common_t ann; + + t = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3); + + fn = gimple_call_fn (stmt); + if (TREE_CODE (fn) == FUNCTION_DECL) + CALL_EXPR_FN (t) = build1 (ADDR_EXPR, + build_pointer_type (TREE_TYPE (fn)), + fn); + else + CALL_EXPR_FN (t) = fn; + + TREE_TYPE (t) = gimple_call_return_type (stmt); + + CALL_EXPR_STATIC_CHAIN (t) = gimple_call_chain (stmt); + + for (i = 0; i < gimple_call_num_args (stmt); i++) + CALL_EXPR_ARG (t, i) = gimple_call_arg (stmt, i); + + if (!(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE))) + TREE_SIDE_EFFECTS (t) = 1; + + if (gimple_call_flags (stmt) & ECF_NOTHROW) + TREE_NOTHROW (t) = 1; + + CALL_EXPR_TAILCALL (t) = gimple_call_tail_p (stmt); + CALL_EXPR_RETURN_SLOT_OPT (t) = gimple_call_return_slot_opt_p (stmt); + CALL_FROM_THUNK_P (t) = gimple_call_from_thunk_p (stmt); + CALL_CANNOT_INLINE_P (t) = gimple_call_cannot_inline_p (stmt); + CALL_EXPR_VA_ARG_PACK (t) = gimple_call_va_arg_pack_p (stmt); + + /* If the call has a LHS then create a MODIFY_EXPR to hold it. */ + { + tree lhs = gimple_call_lhs (stmt); + + if (lhs) + t = build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, t); + } + + /* Record the original call statement, as it may be used + to retrieve profile information during expansion. */ + if (TREE_CODE (fn) == FUNCTION_DECL && DECL_BUILT_IN (fn)) + { + ann = get_tree_common_ann (t); + ann->stmt = stmt; + } + } + break; + + case GIMPLE_SWITCH: + { + tree label_vec; + size_t i; + tree elt = gimple_switch_label (stmt, 0); + + label_vec = make_tree_vec (gimple_switch_num_labels (stmt)); + + if (!CASE_LOW (elt) && !CASE_HIGH (elt)) + { + for (i = 1; i < gimple_switch_num_labels (stmt); i++) + TREE_VEC_ELT (label_vec, i - 1) = gimple_switch_label (stmt, i); + + /* The default case in a SWITCH_EXPR must be at the end of + the label vector. */ + TREE_VEC_ELT (label_vec, i - 1) = gimple_switch_label (stmt, 0); + } + else + { + for (i = 0; i < gimple_switch_num_labels (stmt); i++) + TREE_VEC_ELT (label_vec, i) = gimple_switch_label (stmt, i); + } + + t = build3 (SWITCH_EXPR, void_type_node, gimple_switch_index (stmt), + NULL, label_vec); + } + break; + + case GIMPLE_NOP: + case GIMPLE_PREDICT: + t = build1 (NOP_EXPR, void_type_node, size_zero_node); + break; + + case GIMPLE_RESX: + t = build_resx (gimple_resx_region (stmt)); + break; + + default: + if (errorcount == 0) + { + error ("Unrecognized GIMPLE statement during RTL expansion"); + print_gimple_stmt (stderr, stmt, 4, 0); + gcc_unreachable (); + } + else + { + /* Ignore any bad gimple codes if we're going to die anyhow, + so we can at least set TREE_ASM_WRITTEN and have the rest + of compilation advance without sudden ICE death. */ + t = build1 (NOP_EXPR, void_type_node, size_zero_node); + break; + } + } + + /* If STMT is inside an exception region, record it in the generated + expression. */ + rn = lookup_stmt_eh_region (stmt); + if (rn >= 0) + { + tree call = get_call_expr_in (t); + + ann = get_tree_common_ann (t); + ann->rn = rn; + + /* For a CALL_EXPR on the RHS of an assignment, calls.c looks up + the CALL_EXPR not the assignment statment for EH region number. */ + if (call && call != t) + { + ann = get_tree_common_ann (call); + ann->rn = rn; + } + } + + /* Set EXPR_LOCATION in all the embedded expressions. */ + loc = gimple_location (stmt); + walk_tree (&t, set_expr_location_r, (void *) &loc, NULL); + + TREE_BLOCK (t) = gimple_block (stmt); + + return t; +} + + +/* Release back to GC memory allocated by gimple_to_tree. */ + +static void +release_stmt_tree (gimple stmt, tree stmt_tree) +{ + tree_ann_common_t ann; + + switch (gimple_code (stmt)) + { + case GIMPLE_ASSIGN: + if (get_gimple_rhs_class (gimple_expr_code (stmt)) != GIMPLE_SINGLE_RHS) + ggc_free (TREE_OPERAND (stmt_tree, 1)); + break; + case GIMPLE_COND: + ggc_free (COND_EXPR_COND (stmt_tree)); + break; + case GIMPLE_RETURN: + if (TREE_OPERAND (stmt_tree, 0) + && TREE_CODE (TREE_OPERAND (stmt_tree, 0)) == MODIFY_EXPR) + ggc_free (TREE_OPERAND (stmt_tree, 0)); + break; + case GIMPLE_CALL: + if (gimple_call_lhs (stmt)) + { + if (TREE_CODE (gimple_call_fn (stmt)) == FUNCTION_DECL) + ggc_free (CALL_EXPR_FN (TREE_OPERAND (stmt_tree, 1))); + ann = tree_common_ann (TREE_OPERAND (stmt_tree, 1)); + if (ann) + ggc_free (ann); + ggc_free (TREE_OPERAND (stmt_tree, 1)); + } + else if (TREE_CODE (gimple_call_fn (stmt)) == FUNCTION_DECL) + ggc_free (CALL_EXPR_FN (stmt_tree)); + break; + default: + break; + } + ann = tree_common_ann (stmt_tree); + if (ann) + ggc_free (ann); + ggc_free (stmt_tree); +} + + /* Verify that there is exactly single jump instruction since last and attach REG_BR_PROB note specifying probability. ??? We really ought to pass the probability down to RTL expanders and let it @@ -1181,12 +1527,12 @@ expand_used_vars (void) generated for STMT should have been appended. */ static void -maybe_dump_rtl_for_tree_stmt (tree stmt, rtx since) +maybe_dump_rtl_for_gimple_stmt (gimple stmt, rtx since) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "\n;; "); - print_generic_expr (dump_file, stmt, TDF_SLIM); + print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); fprintf (dump_file, "\n"); print_rtl (dump_file, since ? NEXT_INSN (since) : since); @@ -1200,10 +1546,11 @@ static struct pointer_map_t *lab_rtx_for_bb; /* Returns the label_rtx expression for a label starting basic block BB. */ static rtx -label_rtx_for_bb (basic_block bb) +label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) { - tree_stmt_iterator tsi; - tree lab, lab_stmt; + gimple_stmt_iterator gsi; + tree lab; + gimple lab_stmt; void **elt; if (bb->flags & BB_RTL) @@ -1215,13 +1562,13 @@ label_rtx_for_bb (basic_block bb) /* Find the tree label if it is present. */ - for (tsi = tsi_start (bb_stmt_list (bb)); !tsi_end_p (tsi); tsi_next (&tsi)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - lab_stmt = tsi_stmt (tsi); - if (TREE_CODE (lab_stmt) != LABEL_EXPR) + lab_stmt = gsi_stmt (gsi); + if (gimple_code (lab_stmt) != GIMPLE_LABEL) break; - lab = LABEL_EXPR_LABEL (lab_stmt); + lab = gimple_label_label (lab_stmt); if (DECL_NONLOCAL (lab)) break; @@ -1233,29 +1580,28 @@ label_rtx_for_bb (basic_block bb) return (rtx) *elt; } -/* A subroutine of expand_gimple_basic_block. Expand one COND_EXPR. + +/* A subroutine of expand_gimple_basic_block. Expand one GIMPLE_COND. Returns a new basic block if we've terminated the current basic block and created a new one. */ static basic_block -expand_gimple_cond_expr (basic_block bb, tree stmt) +expand_gimple_cond (basic_block bb, gimple stmt) { basic_block new_bb, dest; edge new_edge; edge true_edge; edge false_edge; - tree pred = COND_EXPR_COND (stmt); + tree pred = gimple_cond_pred_to_tree (stmt); rtx last2, last; - gcc_assert (COND_EXPR_THEN (stmt) == NULL_TREE); - gcc_assert (COND_EXPR_ELSE (stmt) == NULL_TREE); last2 = last = get_last_insn (); extract_true_false_edges_from_block (bb, &true_edge, &false_edge); - if (EXPR_LOCUS (stmt)) + if (gimple_has_location (stmt)) { - set_curr_insn_source_location (*(EXPR_LOCUS (stmt))); - set_curr_insn_block (TREE_BLOCK (stmt)); + set_curr_insn_source_location (gimple_location (stmt)); + set_curr_insn_block (gimple_block (stmt)); } /* These flags have no purpose in RTL land. */ @@ -1268,20 +1614,22 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) { jumpif (pred, label_rtx_for_bb (true_edge->dest)); add_reg_br_prob_note (last, true_edge->probability); - maybe_dump_rtl_for_tree_stmt (stmt, last); + maybe_dump_rtl_for_gimple_stmt (stmt, last); if (true_edge->goto_locus) set_curr_insn_source_location (true_edge->goto_locus); false_edge->flags |= EDGE_FALLTHRU; + ggc_free (pred); return NULL; } if (true_edge->dest == bb->next_bb) { jumpifnot (pred, label_rtx_for_bb (false_edge->dest)); add_reg_br_prob_note (last, false_edge->probability); - maybe_dump_rtl_for_tree_stmt (stmt, last); + maybe_dump_rtl_for_gimple_stmt (stmt, last); if (false_edge->goto_locus) set_curr_insn_source_location (false_edge->goto_locus); true_edge->flags |= EDGE_FALLTHRU; + ggc_free (pred); return NULL; } @@ -1308,15 +1656,16 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) BB_END (new_bb) = PREV_INSN (BB_END (new_bb)); update_bb_for_insn (new_bb); - maybe_dump_rtl_for_tree_stmt (stmt, last2); + maybe_dump_rtl_for_gimple_stmt (stmt, last2); if (false_edge->goto_locus) set_curr_insn_source_location (false_edge->goto_locus); + ggc_free (pred); return new_bb; } -/* A subroutine of expand_gimple_basic_block. Expand one CALL_EXPR +/* A subroutine of expand_gimple_basic_block. Expand one GIMPLE_CALL that has CALL_EXPR_TAILCALL set. Returns non-null if we actually generated a tail call (something that might be denied by the ABI rules governing the call; see calls.c). @@ -1327,23 +1676,26 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) tailcall) and the normal result happens via a sqrt instruction. */ static basic_block -expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru) +expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru) { rtx last2, last; edge e; edge_iterator ei; int probability; gcov_type count; + tree stmt_tree = gimple_to_tree (stmt); last2 = last = get_last_insn (); - expand_expr_stmt (stmt); + expand_expr_stmt (stmt_tree); + + release_stmt_tree (stmt, stmt_tree); for (last = NEXT_INSN (last); last; last = NEXT_INSN (last)) if (CALL_P (last) && SIBLING_CALL_P (last)) goto found; - maybe_dump_rtl_for_tree_stmt (stmt, last2); + maybe_dump_rtl_for_gimple_stmt (stmt, last2); *can_fallthru = true; return NULL; @@ -1418,7 +1770,7 @@ expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru) BB_END (bb) = PREV_INSN (last); } - maybe_dump_rtl_for_tree_stmt (stmt, last2); + maybe_dump_rtl_for_gimple_stmt (stmt, last2); return bb; } @@ -1428,50 +1780,52 @@ expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru) static basic_block expand_gimple_basic_block (basic_block bb) { - tree_stmt_iterator tsi; - tree stmts = bb_stmt_list (bb); - tree stmt = NULL; + gimple_stmt_iterator gsi; + gimple_seq stmts; + gimple stmt = NULL; rtx note, last; edge e; edge_iterator ei; void **elt; if (dump_file) - { - fprintf (dump_file, - "\n;; Generating RTL for tree basic block %d\n", - bb->index); - } - - bb->il.tree = NULL; + fprintf (dump_file, "\n;; Generating RTL for gimple basic block %d\n", + bb->index); + + /* Note that since we are now transitioning from GIMPLE to RTL, we + cannot use the gsi_*_bb() routines because they expect the basic + block to be in GIMPLE, instead of RTL. Therefore, we need to + access the BB sequence directly. */ + stmts = bb_seq (bb); + bb->il.gimple = NULL; init_rtl_bb_info (bb); bb->flags |= BB_RTL; /* Remove the RETURN_EXPR if we may fall though to the exit instead. */ - tsi = tsi_last (stmts); - if (!tsi_end_p (tsi) - && TREE_CODE (tsi_stmt (tsi)) == RETURN_EXPR) + gsi = gsi_last (stmts); + if (!gsi_end_p (gsi) + && gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN) { - tree ret_stmt = tsi_stmt (tsi); + gimple ret_stmt = gsi_stmt (gsi); gcc_assert (single_succ_p (bb)); gcc_assert (single_succ (bb) == EXIT_BLOCK_PTR); if (bb->next_bb == EXIT_BLOCK_PTR - && !TREE_OPERAND (ret_stmt, 0)) + && !gimple_return_retval (ret_stmt)) { - tsi_delink (&tsi); + gsi_remove (&gsi, false); single_succ_edge (bb)->flags |= EDGE_FALLTHRU; } } - tsi = tsi_start (stmts); - if (!tsi_end_p (tsi)) + gsi = gsi_start (stmts); + if (!gsi_end_p (gsi)) { - stmt = tsi_stmt (tsi); - if (TREE_CODE (stmt) != LABEL_EXPR) - stmt = NULL_TREE; + stmt = gsi_stmt (gsi); + if (gimple_code (stmt) != GIMPLE_LABEL) + stmt = NULL; } elt = pointer_map_contains (lab_rtx_for_bb, bb); @@ -1482,8 +1836,10 @@ expand_gimple_basic_block (basic_block bb) if (stmt) { - expand_expr_stmt (stmt); - tsi_next (&tsi); + tree stmt_tree = gimple_to_tree (stmt); + expand_expr_stmt (stmt_tree); + release_stmt_tree (stmt, stmt_tree); + gsi_next (&gsi); } if (elt) @@ -1496,7 +1852,7 @@ expand_gimple_basic_block (basic_block bb) BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb)); note = emit_note_after (NOTE_INSN_BASIC_BLOCK, BB_HEAD (bb)); - maybe_dump_rtl_for_tree_stmt (stmt, last); + maybe_dump_rtl_for_gimple_stmt (stmt, last); } else note = BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK); @@ -1517,36 +1873,22 @@ expand_gimple_basic_block (basic_block bb) ei_next (&ei); } - for (; !tsi_end_p (tsi); tsi_next (&tsi)) + for (; !gsi_end_p (gsi); gsi_next (&gsi)) { - tree stmt = tsi_stmt (tsi); + gimple stmt = gsi_stmt (gsi); basic_block new_bb; - if (!stmt) - continue; - /* Expand this statement, then evaluate the resulting RTL and fixup the CFG accordingly. */ - if (TREE_CODE (stmt) == COND_EXPR) + if (gimple_code (stmt) == GIMPLE_COND) { - new_bb = expand_gimple_cond_expr (bb, stmt); + new_bb = expand_gimple_cond (bb, stmt); if (new_bb) return new_bb; } else { - tree call = get_call_expr_in (stmt); - int region; - /* For the benefit of calls.c, converting all this to rtl, - we need to record the call expression, not just the outer - modify statement. */ - if (call && call != stmt) - { - if ((region = lookup_stmt_eh_region (stmt)) > 0) - add_stmt_to_eh_region (call, region); - gimple_duplicate_stmt_histograms (cfun, call, cfun, stmt); - } - if (call && CALL_EXPR_TAILCALL (call)) + if (is_gimple_call (stmt) && gimple_call_tail_p (stmt)) { bool can_fallthru; new_bb = expand_gimple_tailcall (bb, stmt, &can_fallthru); @@ -1560,9 +1902,11 @@ expand_gimple_basic_block (basic_block bb) } else { + tree stmt_tree = gimple_to_tree (stmt); last = get_last_insn (); - expand_expr_stmt (stmt); - maybe_dump_rtl_for_tree_stmt (stmt, last); + expand_expr_stmt (stmt_tree); + maybe_dump_rtl_for_gimple_stmt (stmt, last); + release_stmt_tree (stmt, stmt_tree); } } } @@ -1621,7 +1965,7 @@ construct_init_block (void) otherwise we have to jump into proper target. */ if (e && e->dest != ENTRY_BLOCK_PTR->next_bb) { - tree label = tree_block_label (e->dest); + tree label = gimple_block_label (e->dest); emit_jump (label_rtx (label)); flags = 0; @@ -1779,14 +2123,14 @@ static void discover_nonconstant_array_refs (void) { basic_block bb; - block_stmt_iterator bsi; + gimple_stmt_iterator gsi; FOR_EACH_BB (bb) - { - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) - walk_tree (bsi_stmt_ptr (bsi), discover_nonconstant_array_refs_r, - NULL , NULL); - } + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + walk_gimple_op (stmt, discover_nonconstant_array_refs_r, NULL); + } } /* Translate the intermediate representation contained in the CFG @@ -1799,7 +2143,7 @@ discover_nonconstant_array_refs (void) the expansion. */ static unsigned int -tree_expand_cfg (void) +gimple_expand_cfg (void) { basic_block bb, init_block; sbitmap blocks; @@ -1949,7 +2293,7 @@ struct rtl_opt_pass pass_expand = RTL_PASS, "expand", /* name */ NULL, /* gate */ - tree_expand_cfg, /* execute */ + gimple_expand_cfg, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 5815a7edd37..00d7151f6b8 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -51,9 +51,9 @@ cfg_layout_rtl_register_cfg_hooks (void) /* Initialization of functions specific to the tree IR. */ void -tree_register_cfg_hooks (void) +gimple_register_cfg_hooks (void) { - cfg_hooks = &tree_cfg_hooks; + cfg_hooks = &gimple_cfg_hooks; } /* Returns current ir type. */ @@ -61,7 +61,7 @@ tree_register_cfg_hooks (void) enum ir_type current_ir_type (void) { - if (cfg_hooks == &tree_cfg_hooks) + if (cfg_hooks == &gimple_cfg_hooks) return IR_GIMPLE; else if (cfg_hooks == &rtl_cfg_hooks) return IR_RTL_CFGRTL; @@ -291,7 +291,7 @@ dump_bb (basic_block bb, FILE *outf, int indent) putc ('\n', outf); if (cfg_hooks->dump_bb) - cfg_hooks->dump_bb (bb, outf, indent); + cfg_hooks->dump_bb (bb, outf, indent, 0); } /* Redirect edge E to the given basic block DEST and update underlying program diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index e581d9cd559..537c05f07ba 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -28,7 +28,7 @@ struct cfg_hooks /* Debugging. */ int (*verify_flow_info) (void); - void (*dump_bb) (basic_block, FILE *, int); + void (*dump_bb) (basic_block, FILE *, int, int); /* Basic CFG manipulation. */ @@ -181,7 +181,7 @@ extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block, void *); /* Hooks containers. */ -extern struct cfg_hooks tree_cfg_hooks; +extern struct cfg_hooks gimple_cfg_hooks; extern struct cfg_hooks rtl_cfg_hooks; extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; @@ -189,6 +189,6 @@ extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; extern enum ir_type current_ir_type (void); extern void rtl_register_cfg_hooks (void); extern void cfg_layout_rtl_register_cfg_hooks (void); -extern void tree_register_cfg_hooks (void); +extern void gimple_register_cfg_hooks (void); #endif /* GCC_CFGHOOKS_H */ diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index f565708ae9e..4c9bbf0ab19 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -563,11 +563,13 @@ find_subloop_latch_edge_by_profile (VEC (edge, heap) *latches) another edge. */ static edge -find_subloop_latch_edge_by_ivs (struct loop *loop, VEC (edge, heap) *latches) +find_subloop_latch_edge_by_ivs (struct loop *loop ATTRIBUTE_UNUSED, VEC (edge, heap) *latches) { edge e, latch = VEC_index (edge, latches, 0); unsigned i; - tree phi, lop; + gimple phi; + gimple_stmt_iterator psi; + tree lop; basic_block bb; /* Find the candidate for the latch edge. */ @@ -582,15 +584,16 @@ find_subloop_latch_edge_by_ivs (struct loop *loop, VEC (edge, heap) *latches) /* Check for a phi node that would deny that this is a latch edge of a subloop. */ - for (phi = phi_nodes (loop->header); phi; phi = PHI_CHAIN (phi)) + for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi)) { + phi = gsi_stmt (psi); lop = PHI_ARG_DEF_FROM_EDGE (phi, latch); /* Ignore the values that are not changed inside the subloop. */ if (TREE_CODE (lop) != SSA_NAME || SSA_NAME_DEF_STMT (lop) == phi) continue; - bb = bb_for_stmt (SSA_NAME_DEF_STMT (lop)); + bb = gimple_bb (SSA_NAME_DEF_STMT (lop)); if (!bb || !flow_bb_inside_loop_p (loop, bb)) continue; diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index 056e8f0b1e5..d21d50bebdd 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -49,7 +49,7 @@ struct lpt_decision GTY (()) struct nb_iter_bound GTY ((chain_next ("%h.next"))) { /* The statement STMT is executed at most ... */ - tree stmt; + gimple stmt; /* ... BOUND + 1 times (BOUND must be an unsigned constant). The + 1 is added for the following reasons: diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 240455bca9d..f9e3e17e1a7 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -76,7 +76,7 @@ static void rtl_delete_block (basic_block); static basic_block rtl_redirect_edge_and_branch_force (edge, basic_block); static edge rtl_redirect_edge_and_branch (edge, basic_block); static basic_block rtl_split_block (basic_block, void *); -static void rtl_dump_bb (basic_block, FILE *, int); +static void rtl_dump_bb (basic_block, FILE *, int, int); static int rtl_verify_flow_info_1 (void); static void rtl_make_forwarder_block (edge); @@ -1510,7 +1510,7 @@ commit_edge_insertions (void) at start and end). */ static void -rtl_dump_bb (basic_block bb, FILE *outf, int indent) +rtl_dump_bb (basic_block bb, FILE *outf, int indent, int flags ATTRIBUTE_UNUSED) { rtx insn; rtx last; diff --git a/gcc/cgraph.c b/gcc/cgraph.c index b88ab68f056..51181cbe6a2 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -81,7 +81,7 @@ The callgraph: #include "varray.h" #include "output.h" #include "intl.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-dump.h" #include "tree-flow.h" @@ -503,9 +503,12 @@ edge_eq (const void *x, const void *y) return ((const struct cgraph_edge *) x)->call_stmt == y; } -/* Return callgraph edge representing CALL_EXPR statement. */ + +/* Return the callgraph edge representing the GIMPLE_CALL statement + CALL_STMT. */ + struct cgraph_edge * -cgraph_edge (struct cgraph_node *node, tree call_stmt) +cgraph_edge (struct cgraph_node *node, gimple call_stmt) { struct cgraph_edge *e, *e2; int n = 0; @@ -526,6 +529,7 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt) break; n++; } + if (n > 100) { node->call_site_hash = htab_create_ggc (120, edge_hash, edge_eq, NULL); @@ -540,13 +544,15 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt) *slot = e2; } } + return e; } -/* Change call_stmt of edge E to NEW_STMT. */ + +/* Change field call_smt of edge E to NEW_STMT. */ void -cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt) +cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt) { if (e->caller->call_site_hash) { @@ -571,7 +577,7 @@ cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt) struct cgraph_edge * cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, - tree call_stmt, gcov_type count, int freq, int nest) + gimple call_stmt, gcov_type count, int freq, int nest) { struct cgraph_edge *edge = GGC_NEW (struct cgraph_edge); #ifdef ENABLE_CHECKING @@ -581,9 +587,9 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, gcc_assert (e->call_stmt != call_stmt); #endif - gcc_assert (get_call_expr_in (call_stmt)); + gcc_assert (is_gimple_call (call_stmt)); - if (!DECL_SAVED_TREE (callee->decl)) + if (!gimple_body (callee->decl)) edge->inline_failed = N_("function body not available"); else if (callee->local.redefined_extern_inline) edge->inline_failed = N_("redefined extern inline functions are not " @@ -691,14 +697,15 @@ cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n) e->callee = n; } -/* Update or remove corresponding cgraph edge if a call OLD_CALL - in OLD_STMT changed into NEW_STMT. */ + +/* Update or remove the corresponding cgraph edge if a GIMPLE_CALL + OLD_STMT changed into NEW_STMT. */ void -cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call, - tree new_stmt) +cgraph_update_edges_for_call_stmt (gimple old_stmt, gimple new_stmt) { - tree new_call = get_call_expr_in (new_stmt); + tree new_call = (is_gimple_call (new_stmt)) ? gimple_call_fn (new_stmt) : 0; + tree old_call = (is_gimple_call (old_stmt)) ? gimple_call_fn (old_stmt) : 0; struct cgraph_node *node = cgraph_node (cfun->decl); if (old_call != new_call) @@ -716,7 +723,7 @@ cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call, cgraph_remove_edge (e); if (new_call) { - new_decl = get_callee_fndecl (new_call); + new_decl = gimple_call_fndecl (new_stmt); if (new_decl) { ne = cgraph_create_edge (node, cgraph_node (new_decl), @@ -736,6 +743,7 @@ cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call, } } + /* Remove all callees from the node. */ void @@ -791,6 +799,7 @@ cgraph_release_function_body (struct cgraph_node *node) delete_tree_ssa (); delete_tree_cfg_annotations (); cfun->eh = NULL; + gimple_set_body (node->decl, NULL); current_function_decl = old_decl; pop_cfun(); } @@ -1006,8 +1015,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) fprintf (f, " needed"); else if (node->reachable) fprintf (f, " reachable"); - if (DECL_SAVED_TREE (node->decl)) - fprintf (f, " tree"); + if (gimple_body (node->decl)) + fprintf (f, " body"); if (node->output) fprintf (f, " output"); if (node->local.local) @@ -1147,7 +1156,7 @@ cgraph_function_possibly_inlined_p (tree decl) /* Create clone of E in the node N represented by CALL_EXPR the callgraph. */ struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, - tree call_stmt, gcov_type count_scale, int freq_scale, + gimple call_stmt, gcov_type count_scale, int freq_scale, int loop_nest, bool update_original) { struct cgraph_edge *new; @@ -1178,8 +1187,8 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, function's profile to reflect the fact that part of execution is handled by node. */ struct cgraph_node * -cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, int loop_nest, - bool update_original) +cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, + int loop_nest, bool update_original) { struct cgraph_node *new = cgraph_create_node (); struct cgraph_edge *e; @@ -1335,8 +1344,8 @@ cgraph_add_new_function (tree fndecl, bool lowered) { push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; - tree_register_cfg_hooks (); - tree_lowering_passes (fndecl); + gimple_register_cfg_hooks (); + tree_lowering_passes (fndecl); bitmap_obstack_initialize (NULL); if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) execute_pass_list (pass_early_local_passes.pass.sub); @@ -1357,7 +1366,7 @@ cgraph_add_new_function (tree fndecl, bool lowered) to expansion. */ push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; - tree_register_cfg_hooks (); + gimple_register_cfg_hooks (); if (!lowered) tree_lowering_passes (fndecl); bitmap_obstack_initialize (NULL); diff --git a/gcc/cgraph.h b/gcc/cgraph.h index f36f6f577a2..7a19dd6e059 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -91,7 +91,7 @@ struct cgraph_local_info GTY(()) }; /* Information about the function that needs to be computed globally - once compilation is finished. Available only with -funit-at-time. */ + once compilation is finished. Available only with -funit-at-a-time. */ struct cgraph_global_info GTY(()) { @@ -100,7 +100,8 @@ struct cgraph_global_info GTY(()) /* Expected offset of the stack frame of inlined function. */ HOST_WIDE_INT stack_frame_offset; - /* For inline clones this points to the function they will be inlined into. */ + /* For inline clones this points to the function they will be + inlined into. */ struct cgraph_node *inlined_to; /* Estimated size of the function after inlining. */ @@ -196,7 +197,7 @@ struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_call struct cgraph_edge *next_caller; struct cgraph_edge *prev_callee; struct cgraph_edge *next_callee; - tree call_stmt; + gimple call_stmt; PTR GTY ((skip (""))) aux; /* When NULL, inline this call. When non-NULL, points to the explanation why function was not inlined. */ @@ -306,19 +307,19 @@ void cgraph_release_function_body (struct cgraph_node *); void cgraph_node_remove_callees (struct cgraph_node *node); struct cgraph_edge *cgraph_create_edge (struct cgraph_node *, struct cgraph_node *, - tree, gcov_type, int, int); + gimple, gcov_type, int, int); struct cgraph_node *cgraph_node (tree); struct cgraph_node *cgraph_node_for_asm (tree asmname); -struct cgraph_edge *cgraph_edge (struct cgraph_node *, tree); -void cgraph_set_call_stmt (struct cgraph_edge *, tree); -void cgraph_update_edges_for_call_stmt (tree, tree, tree); +struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple); +void cgraph_set_call_stmt (struct cgraph_edge *, gimple); +void cgraph_update_edges_for_call_stmt (gimple, gimple); struct cgraph_local_info *cgraph_local_info (tree); struct cgraph_global_info *cgraph_global_info (tree); struct cgraph_rtl_info *cgraph_rtl_info (tree); const char * cgraph_node_name (struct cgraph_node *); struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, struct cgraph_node *, - tree, gcov_type, int, int, bool); + gimple, gcov_type, int, int, bool); struct cgraph_node * cgraph_clone_node (struct cgraph_node *, gcov_type, int, int, bool); diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 60b691113d9..958fed7b0cc 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -1,5 +1,6 @@ /* Callgraph construction. - Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. Contributed by Jan Hubicka This file is part of GCC. @@ -28,7 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "pointer-set.h" #include "cgraph.h" #include "intl.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-pass.h" /* Walk tree and record all calls and references to functions/variables. @@ -60,18 +61,6 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) cgraph_mark_needed_node (cgraph_node (decl)); break; - case OMP_PARALLEL: - if (OMP_PARALLEL_FN (*tp)) - cgraph_mark_needed_node (cgraph_node (OMP_PARALLEL_FN (*tp))); - break; - - case OMP_TASK: - if (OMP_TASK_FN (*tp)) - cgraph_mark_needed_node (cgraph_node (OMP_TASK_FN (*tp))); - if (OMP_TASK_COPYFN (*tp)) - cgraph_mark_needed_node (cgraph_node (OMP_TASK_COPYFN (*tp))); - break; - default: /* Save some cycles by not walking types and declaration as we won't find anything useful there anyway. */ @@ -107,7 +96,7 @@ initialize_inline_failed (struct cgraph_node *node) "considered for inlining"); else if (!node->local.inlinable) e->inline_failed = N_("function not inlinable"); - else if (CALL_STMT_CANNOT_INLINE_P (e->call_stmt)) + else if (gimple_call_cannot_inline_p (e->call_stmt)) e->inline_failed = N_("mismatched arguments"); else e->inline_failed = N_("function not considered for inlining"); @@ -142,34 +131,54 @@ build_cgraph_edges (void) basic_block bb; struct cgraph_node *node = cgraph_node (current_function_decl); struct pointer_set_t *visited_nodes = pointer_set_create (); - block_stmt_iterator bsi; + gimple_stmt_iterator gsi; tree step; /* Create the callgraph edges and record the nodes referenced by the function. body. */ FOR_EACH_BB (bb) - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - tree stmt = bsi_stmt (bsi); - tree call = get_call_expr_in (stmt); + gimple stmt = gsi_stmt (gsi); tree decl; - if (call && (decl = get_callee_fndecl (call))) + if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) { - int i; - int n = call_expr_nargs (call); + size_t i; + size_t n = gimple_call_num_args (stmt); cgraph_create_edge (node, cgraph_node (decl), stmt, bb->count, compute_call_stmt_bb_frequency (bb), bb->loop_depth); for (i = 0; i < n; i++) - walk_tree (&CALL_EXPR_ARG (call, i), - record_reference, node, visited_nodes); - if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT) - walk_tree (&GIMPLE_STMT_OPERAND (stmt, 0), - record_reference, node, visited_nodes); + walk_tree (gimple_call_arg_ptr (stmt, i), record_reference, + node, visited_nodes); + if (gimple_call_lhs (stmt)) + walk_tree (gimple_call_lhs_ptr (stmt), record_reference, node, + visited_nodes); } else - walk_tree (bsi_stmt_ptr (bsi), record_reference, node, visited_nodes); + { + struct walk_stmt_info wi; + memset (&wi, 0, sizeof (wi)); + wi.info = node; + wi.pset = visited_nodes; + walk_gimple_op (stmt, record_reference, &wi); + if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL + && gimple_omp_parallel_child_fn (stmt)) + { + tree fn = gimple_omp_parallel_child_fn (stmt); + cgraph_mark_needed_node (cgraph_node (fn)); + } + if (gimple_code (stmt) == GIMPLE_OMP_TASK) + { + tree fn = gimple_omp_task_child_fn (stmt); + if (fn) + cgraph_mark_needed_node (cgraph_node (fn)); + fn = gimple_omp_task_copy_fn (stmt); + if (fn) + cgraph_mark_needed_node (cgraph_node (fn)); + } + } } /* Look for initializers of constant variables and private statics. */ @@ -228,23 +237,23 @@ rebuild_cgraph_edges (void) { basic_block bb; struct cgraph_node *node = cgraph_node (current_function_decl); - block_stmt_iterator bsi; + gimple_stmt_iterator gsi; cgraph_node_remove_callees (node); node->count = ENTRY_BLOCK_PTR->count; FOR_EACH_BB (bb) - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - tree stmt = bsi_stmt (bsi); - tree call = get_call_expr_in (stmt); + gimple stmt = gsi_stmt (gsi); tree decl; - if (call && (decl = get_callee_fndecl (call))) + if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) cgraph_create_edge (node, cgraph_node (decl), stmt, bb->count, compute_call_stmt_bb_frequency (bb), bb->loop_depth); + } initialize_inline_failed (node); gcc_assert (!node->global.inlined_to); diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 9f4f87c2451..48dd70bcac7 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -130,7 +130,8 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "function.h" #include "ipa-prop.h" -#include "tree-gimple.h" +#include "gimple.h" +#include "tree-iterator.h" #include "tree-pass.h" #include "output.h" @@ -404,7 +405,7 @@ cgraph_process_new_functions (void) transformations that has been already performed on the whole cgraph but not on this function. */ - tree_register_cfg_hooks (); + gimple_register_cfg_hooks (); if (!node->analyzed) cgraph_analyze_function (node); push_cfun (DECL_STRUCT_FUNCTION (fndecl)); @@ -555,7 +556,7 @@ verify_cgraph_node (struct cgraph_node *node) struct function *this_cfun = DECL_STRUCT_FUNCTION (node->decl); struct function *saved_cfun = cfun; basic_block this_block; - block_stmt_iterator bsi; + gimple_stmt_iterator gsi; bool error_found = false; if (errorcount || sorrycount) @@ -637,7 +638,8 @@ verify_cgraph_node (struct cgraph_node *node) } if (node->analyzed - && DECL_SAVED_TREE (node->decl) && !TREE_ASM_WRITTEN (node->decl) + && gimple_body (node->decl) + && !TREE_ASM_WRITTEN (node->decl) && (!DECL_EXTERNAL (node->decl) || node->global.inlined_to)) { if (this_cfun->cfg) @@ -648,12 +650,13 @@ verify_cgraph_node (struct cgraph_node *node) /* Reach the trees by walking over the CFG, and note the enclosing basic-blocks in the call edges. */ FOR_EACH_BB_FN (this_block, this_cfun) - for (bsi = bsi_start (this_block); !bsi_end_p (bsi); bsi_next (&bsi)) + for (gsi = gsi_start_bb (this_block); + !gsi_end_p (gsi); + gsi_next (&gsi)) { - tree stmt = bsi_stmt (bsi); - tree call = get_call_expr_in (stmt); + gimple stmt = gsi_stmt (gsi); tree decl; - if (call && (decl = get_callee_fndecl (call))) + if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt))) { struct cgraph_edge *e = cgraph_edge (node, stmt); if (e) @@ -661,7 +664,7 @@ verify_cgraph_node (struct cgraph_node *node) if (e->aux) { error ("shared call_stmt:"); - debug_generic_stmt (stmt); + debug_gimple_stmt (stmt); error_found = true; } if (e->callee->decl != cgraph_node (decl)->decl @@ -677,7 +680,7 @@ verify_cgraph_node (struct cgraph_node *node) else { error ("missing callgraph edge for call stmt:"); - debug_generic_stmt (stmt); + debug_gimple_stmt (stmt); error_found = true; } } @@ -695,7 +698,7 @@ verify_cgraph_node (struct cgraph_node *node) error ("edge %s->%s has no corresponding call_stmt", cgraph_node_name (e->caller), cgraph_node_name (e->callee)); - debug_generic_stmt (e->call_stmt); + debug_gimple_stmt (e->call_stmt); error_found = true; } e->aux = 0; @@ -856,7 +859,7 @@ cgraph_analyze_functions (void) { fprintf (cgraph_dump_file, "Initial entry points:"); for (node = cgraph_nodes; node != first_analyzed; node = node->next) - if (node->needed && DECL_SAVED_TREE (node->decl)) + if (node->needed && gimple_body (node->decl)) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); fprintf (cgraph_dump_file, "\n"); } @@ -878,14 +881,14 @@ cgraph_analyze_functions (void) /* ??? It is possible to create extern inline function and later using weak alias attribute to kill its body. See gcc.c-torture/compile/20011119-1.c */ - if (!DECL_SAVED_TREE (decl)) + if (!DECL_STRUCT_FUNCTION (decl)) { cgraph_reset_node (node); continue; } gcc_assert (!node->analyzed && node->reachable); - gcc_assert (DECL_SAVED_TREE (decl)); + gcc_assert (gimple_body (decl)); cgraph_analyze_function (node); @@ -908,7 +911,7 @@ cgraph_analyze_functions (void) { fprintf (cgraph_dump_file, "Unit entry points:"); for (node = cgraph_nodes; node != first_analyzed; node = node->next) - if (node->needed && DECL_SAVED_TREE (node->decl)) + if (node->needed && gimple_body (node->decl)) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); fprintf (cgraph_dump_file, "\n\nInitial "); dump_cgraph (cgraph_dump_file); @@ -922,10 +925,10 @@ cgraph_analyze_functions (void) tree decl = node->decl; next = node->next; - if (node->local.finalized && !DECL_SAVED_TREE (decl)) + if (node->local.finalized && !gimple_body (decl)) cgraph_reset_node (node); - if (!node->reachable && DECL_SAVED_TREE (decl)) + if (!node->reachable && gimple_body (decl)) { if (cgraph_dump_file) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); @@ -934,7 +937,7 @@ cgraph_analyze_functions (void) } else node->next_needed = NULL; - gcc_assert (!node->local.finalized || DECL_SAVED_TREE (decl)); + gcc_assert (!node->local.finalized || gimple_body (decl)); gcc_assert (node->analyzed == node->local.finalized); } if (cgraph_dump_file) @@ -987,7 +990,7 @@ cgraph_mark_functions_to_output (void) /* We need to output all local functions that are used and not always inlined, as well as those that are reachable from outside the current compilation unit. */ - if (DECL_SAVED_TREE (decl) + if (gimple_body (decl) && !node->global.inlined_to && (node->needed || (e && node->reachable)) @@ -998,14 +1001,16 @@ cgraph_mark_functions_to_output (void) { /* We should've reclaimed all functions that are not needed. */ #ifdef ENABLE_CHECKING - if (!node->global.inlined_to && DECL_SAVED_TREE (decl) + if (!node->global.inlined_to + && gimple_body (decl) && !DECL_EXTERNAL (decl)) { dump_cgraph_node (stderr, node); internal_error ("failed to reclaim unneeded function"); } #endif - gcc_assert (node->global.inlined_to || !DECL_SAVED_TREE (decl) + gcc_assert (node->global.inlined_to + || !gimple_body (decl) || DECL_EXTERNAL (decl)); } @@ -1035,7 +1040,6 @@ cgraph_expand_function (struct cgraph_node *node) /* Make sure that BE didn't give up on compiling. */ /* ??? Can happen with nested function of extern inline. */ gcc_assert (TREE_ASM_WRITTEN (decl)); - current_function_decl = NULL; if (!cgraph_preserve_function_body_p (decl)) { @@ -1224,7 +1228,7 @@ ipa_passes (void) { set_cfun (NULL); current_function_decl = NULL; - tree_register_cfg_hooks (); + gimple_register_cfg_hooks (); bitmap_obstack_initialize (NULL); execute_ipa_pass_list (all_ipa_passes); bitmap_obstack_release (NULL); @@ -1324,7 +1328,7 @@ cgraph_optimize (void) for (node = cgraph_nodes; node; node = node->next) if (node->analyzed && (node->global.inlined_to - || DECL_SAVED_TREE (node->decl))) + || gimple_body (node->decl))) { error_found = true; dump_cgraph_node (stderr, node); @@ -1413,10 +1417,10 @@ update_call_expr (struct cgraph_node *new_version) struct cgraph_edge *e; gcc_assert (new_version); + + /* Update the call expr on the edges to call the new version. */ for (e = new_version->callers; e; e = e->next_caller) - /* Update the call expr on the edges - to call the new version. */ - TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (e->call_stmt)), 0) = new_version->decl; + gimple_call_set_fn (e->call_stmt, new_version->decl); } diff --git a/gcc/config.in b/gcc/config.in index ec20c1cdab0..ca66efe6c8b 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -126,6 +126,12 @@ #undef ENABLE_TREE_CHECKING #endif +/* Define if you want operations on GIMPLE (the basic data structure of + the high-level optimizers) to be checked for dynamic type safety at + runtime. This is moderately expensive. */ +#ifndef USED_FOR_TARGET +#undef ENABLE_GIMPLE_CHECKING +#endif /* Define if you want all gimple types to be verified after gimplifiation. This is cheap. */ diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 350994234cd..e2835acd3b7 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1,6 +1,6 @@ /* Subroutines used for code generation on the DEC Alpha. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) This file is part of GCC. @@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include #include "cfglayout.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-flow.h" #include "tree-stdarg.h" #include "tm-constrs.h" @@ -5817,11 +5817,11 @@ va_list_skip_additions (tree lhs) if (TREE_CODE (stmt) == PHI_NODE) return stmt; - if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT - || GIMPLE_STMT_OPERAND (stmt, 0) != lhs) + if (TREE_CODE (stmt) != MODIFY_EXPR + || TREE_OPERAND (stmt, 0) != lhs) return lhs; - rhs = GIMPLE_STMT_OPERAND (stmt, 1); + rhs = TREE_OPERAND (stmt, 1); if (TREE_CODE (rhs) == WITH_SIZE_EXPR) rhs = TREE_OPERAND (rhs, 0); @@ -5856,11 +5856,17 @@ va_list_skip_additions (tree lhs) current statement. */ static bool -alpha_stdarg_optimize_hook (struct stdarg_info *si, const_tree lhs, const_tree rhs) +alpha_stdarg_optimize_hook (struct stdarg_info *si, const_gimple stmt) { tree base, offset, arg1, arg2; int offset_arg = 1; +#if 1 + /* FIXME tuples. */ + (void) si; + (void) stmt; + return false; +#else while (handled_component_p (rhs)) rhs = TREE_OPERAND (rhs, 0); if (TREE_CODE (rhs) != INDIRECT_REF @@ -5953,6 +5959,7 @@ alpha_stdarg_optimize_hook (struct stdarg_info *si, const_tree lhs, const_tree r escapes: si->va_list_escapes = true; return false; +#endif } #endif @@ -6087,7 +6094,7 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) { nextarg = plus_constant (nextarg, offset); nextarg = plus_constant (nextarg, NUM_ARGS * UNITS_PER_WORD); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist, + t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, make_tree (ptr_type_node, nextarg)); TREE_SIDE_EFFECTS (t) = 1; @@ -6106,20 +6113,20 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = make_tree (ptr_type_node, virtual_incoming_args_rtx); t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t, size_int (offset)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (base_field), base_field, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (base_field), base_field, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); t = build_int_cst (NULL_TREE, NUM_ARGS * UNITS_PER_WORD); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (offset_field), - offset_field, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } } static tree -alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p) +alpha_gimplify_va_arg_1 (tree type, tree base, gimple_seq offset, + gimple_seq *pre_p) { tree type_size, ptr_type, addend, t, addr, internal_post; @@ -6128,9 +6135,9 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p) if (targetm.calls.must_pass_in_stack (TYPE_MODE (type), type)) { t = build_int_cst (TREE_TYPE (offset), 6*8); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (offset), offset, - build2 (MAX_EXPR, TREE_TYPE (offset), offset, t)); - gimplify_and_add (t, pre_p); + gimplify_assign (offset, + build2 (MAX_EXPR, TREE_TYPE (offset), offset, t), + pre_p); } addend = offset; @@ -6182,15 +6189,15 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p) t = size_binop (MULT_EXPR, t, size_int (8)); } t = fold_convert (TREE_TYPE (offset), t); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, offset, - build2 (PLUS_EXPR, TREE_TYPE (offset), offset, t)); - gimplify_and_add (t, pre_p); + gimplify_assign (offset, build2 (PLUS_EXPR, TREE_TYPE (offset), offset, t), + pre_p); return build_va_arg_indirect_ref (addr); } static tree -alpha_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) +alpha_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { tree offset_field, base_field, offset, base, t, r; bool indirect; @@ -6222,9 +6229,8 @@ alpha_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) r = alpha_gimplify_va_arg_1 (type, base, offset, pre_p); /* Stuff the offset temporary back into its field. */ - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, offset_field, - fold_convert (TREE_TYPE (offset_field), offset)); - gimplify_and_add (t, pre_p); + gimplify_assign (offset_field, + fold_convert (TREE_TYPE (offset_field), offset), pre_p); if (indirect) r = build_va_arg_indirect_ref (r); diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 6ba924b1df7..07e8eaae928 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -2207,7 +2207,7 @@ frv_expand_builtin_va_start (tree valist, rtx nextarg) debug_rtx (nextarg); } - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist, + t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, fold_convert (TREE_TYPE (valist), make_tree (sizetype, nextarg))); TREE_SIDE_EFFECTS (t) = 1; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7b4c243035a..62d1b8d9bce 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "target-def.h" #include "langhooks.h" #include "cgraph.h" -#include "tree-gimple.h" +#include "gimple.h" #include "dwarf2.h" #include "df.h" #include "tm-constrs.h" @@ -6327,8 +6327,8 @@ ix86_va_start (tree valist, rtx nextarg) if (cfun->va_list_gpr_size) { type = TREE_TYPE (gpr); - t = build2 (GIMPLE_MODIFY_STMT, type, gpr, - build_int_cst (type, n_gpr * 8)); + t = build2 (MODIFY_EXPR, type, + gpr, build_int_cst (type, n_gpr * 8)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -6336,7 +6336,7 @@ ix86_va_start (tree valist, rtx nextarg) if (cfun->va_list_fpr_size) { type = TREE_TYPE (fpr); - t = build2 (GIMPLE_MODIFY_STMT, type, fpr, + t = build2 (MODIFY_EXPR, type, fpr, build_int_cst (type, n_fpr * 16 + 8*X86_64_REGPARM_MAX)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6348,7 +6348,7 @@ ix86_va_start (tree valist, rtx nextarg) if (words != 0) t = build2 (POINTER_PLUS_EXPR, type, t, size_int (words * UNITS_PER_WORD)); - t = build2 (GIMPLE_MODIFY_STMT, type, ovf, t); + t = build2 (MODIFY_EXPR, type, ovf, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6358,7 +6358,7 @@ ix86_va_start (tree valist, rtx nextarg) Prologue of the function save it right above stack frame. */ type = TREE_TYPE (sav); t = make_tree (type, frame_pointer_rtx); - t = build2 (GIMPLE_MODIFY_STMT, type, sav, t); + t = build2 (MODIFY_EXPR, type, sav, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -6367,7 +6367,8 @@ ix86_va_start (tree valist, rtx nextarg) /* Implement va_arg. */ static tree -ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) +ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { static const int intreg[6] = { 0, 1, 2, 3, 4, 5 }; tree f_gpr, f_fpr, f_ovf, f_sav; @@ -6497,16 +6498,14 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) /* int_addr = gpr + sav; */ t = fold_convert (sizetype, gpr); t = build2 (POINTER_PLUS_EXPR, ptr_type_node, sav, t); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, int_addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (int_addr, t, pre_p); } if (needed_sseregs) { /* sse_addr = fpr + sav; */ t = fold_convert (sizetype, fpr); t = build2 (POINTER_PLUS_EXPR, ptr_type_node, sav, t); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, sse_addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (sse_addr, t, pre_p); } if (need_temp) { @@ -6515,8 +6514,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) /* addr = &temp; */ t = build1 (ADDR_EXPR, build_pointer_type (type), temp); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (addr, t, pre_p); for (i = 0; i < XVECLEN (container, 0); i++) { @@ -6549,8 +6547,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) size_int (INTVAL (XEXP (slot, 1)))); dest = build_va_arg_indirect_ref (dest_addr); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, dest, src); - gimplify_and_add (t, pre_p); + gimplify_assign (dest, src, pre_p); } } @@ -6558,22 +6555,19 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) { t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr, build_int_cst (TREE_TYPE (gpr), needed_intregs * 8)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gpr), gpr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (gpr, t, pre_p); } + if (needed_sseregs) { t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr, build_int_cst (TREE_TYPE (fpr), needed_sseregs * 16)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (fpr), fpr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (fpr, t, pre_p); } - t = build1 (GOTO_EXPR, void_type_node, lab_over); - gimplify_and_add (t, pre_p); + gimple_seq_add_stmt (pre_p, gimple_build_goto (lab_over)); - t = build1 (LABEL_EXPR, void_type_node, lab_false); - append_to_statement_list (t, pre_p); + gimple_seq_add_stmt (pre_p, gimple_build_label (lab_false)); } /* ... otherwise out of the overflow area. */ @@ -6601,20 +6595,14 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) t = fold_convert (TREE_TYPE (ovf), t); } gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue); - - t2 = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (t2, pre_p); + gimplify_assign (addr, t, pre_p); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, size_int (rsize * UNITS_PER_WORD)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t); - gimplify_and_add (t, pre_p); + gimplify_assign (unshare_expr (ovf), t, pre_p); if (container) - { - t = build1 (LABEL_EXPR, void_type_node, lab_over); - append_to_statement_list (t, pre_p); - } + gimple_seq_add_stmt (pre_p, gimple_build_label (lab_over)); ptrtype = build_pointer_type (type); addr = fold_convert (ptrtype, addr); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 29a9a8dacf2..c07b21d9d53 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -50,7 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "langhooks.h" #include "cfglayout.h" -#include "tree-gimple.h" +#include "gimple.h" #include "intl.h" #include "df.h" #include "debug.h" @@ -275,7 +275,7 @@ static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *); static tree ia64_handle_version_id_attribute (tree *, tree, tree, int, bool *); static void ia64_encode_section_info (tree, rtx, int); static rtx ia64_struct_value_rtx (tree, int); -static tree ia64_gimplify_va_arg (tree, tree, tree *, tree *); +static tree ia64_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *); static bool ia64_scalar_mode_supported_p (enum machine_mode mode); static bool ia64_vector_mode_supported_p (enum machine_mode mode); static bool ia64_cannot_force_const_mem (rtx); @@ -4342,7 +4342,8 @@ ia64_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) /* Implement va_arg. */ static tree -ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) +ia64_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { /* Variable sized types are passed by reference. */ if (pass_by_reference (NULL, TYPE_MODE (type), type, false)) @@ -4365,8 +4366,7 @@ ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, size_int (-2 * UNITS_PER_WORD)); t = fold_convert (TREE_TYPE (valist), t); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist, t); - gimplify_and_add (t, pre_p); + gimplify_assign (unshare_expr (valist), t, pre_p); } return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h index a63191c21ab..ec98d81f93c 100644 --- a/gcc/config/m32c/m32c-protos.h +++ b/gcc/config/m32c/m32c-protos.h @@ -1,5 +1,5 @@ /* Target Prototypes for R8C/M16C/M32C - Copyright (C) 2005, 2007 + Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. Contributed by Red Hat. @@ -108,7 +108,7 @@ int m32c_split_psi_p (rtx *); #ifdef TREE_CODE void m32c_function_arg_advance (CUMULATIVE_ARGS *, MM, tree, int); -tree m32c_gimplify_va_arg_expr (tree, tree, tree *, tree *); +tree m32c_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); void m32c_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); bool m32c_promote_function_return (const_tree); int m32c_special_page_vector_p (tree); diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index b0733dd8364..0e03c9e6bf2 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -47,7 +47,7 @@ #include "target-def.h" #include "tm_p.h" #include "langhooks.h" -#include "tree-gimple.h" +#include "gimple.h" #include "df.h" /* Prototypes */ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index d1def425576..913acc71cf1 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -56,7 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "cfglayout.h" #include "sched-int.h" -#include "tree-gimple.h" +#include "gimple.h" #include "bitmap.h" #include "diagnostic.h" @@ -4959,12 +4959,12 @@ mips_va_start (tree valist, rtx nextarg) if (cum->stack_words > 0) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovfl), t, size_int (cum->stack_words * UNITS_PER_WORD)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Emit code to initialize GTOP, the top of the GPR save area. */ t = make_tree (TREE_TYPE (gtop), virtual_incoming_args_rtx); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gtop), gtop, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (gtop), gtop, t); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Emit code to initialize FTOP, the top of the FPR save area. @@ -4976,18 +4976,18 @@ mips_va_start (tree valist, rtx nextarg) if (fpr_offset) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ftop), t, size_int (-fpr_offset)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ftop), ftop, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (ftop), ftop, t); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Emit code to initialize GOFF, the offset from GTOP of the next GPR argument. */ - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (goff), goff, + t = build2 (MODIFY_EXPR, TREE_TYPE (goff), goff, build_int_cst (TREE_TYPE (goff), gpr_save_area_size)); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Likewise emit code to initialize FOFF, the offset from FTOP of the next FPR argument. */ - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (foff), foff, + t = build2 (MODIFY_EXPR, TREE_TYPE (foff), foff, build_int_cst (TREE_TYPE (foff), fpr_save_area_size)); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -5001,7 +5001,8 @@ mips_va_start (tree valist, rtx nextarg) /* Implement TARGET_GIMPLIFY_VA_ARG_EXPR. */ static tree -mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) +mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { tree addr; bool indirect_p; @@ -5100,8 +5101,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) /* [1] Emit code for: off &= -rsize. */ t = build2 (BIT_AND_EXPR, TREE_TYPE (off), off, build_int_cst (NULL_TREE, -rsize)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (off), off, t); - gimplify_and_add (t, pre_p); + gimplify_assign (off, t, pre_p); } osize = rsize; } @@ -5137,7 +5137,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) u = size_int (-osize); t = build2 (BIT_AND_EXPR, sizetype, t, u); t = fold_convert (TREE_TYPE (ovfl), t); - align = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t); + align = build2 (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t); } else align = NULL; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 238d35276e4..76d84bad092 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for HPPA. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Tim Moore (moore@cs.utah.edu), based on sparc.c This file is part of GCC. @@ -125,7 +125,7 @@ static void pa_asm_out_destructor (rtx, int); static void pa_init_builtins (void); static rtx hppa_builtin_saveregs (void); static void hppa_va_start (tree, rtx); -static tree hppa_gimplify_va_arg_expr (tree, tree, tree *, tree *); +static tree hppa_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static bool pa_scalar_mode_supported_p (enum machine_mode); static bool pa_commutative_p (const_rtx x, int outer_code); static void copy_fp_args (rtx) ATTRIBUTE_UNUSED; @@ -5998,7 +5998,8 @@ hppa_va_start (tree valist, rtx nextarg) } static tree -hppa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) +hppa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { if (TARGET_64BIT) { diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5e2f7ac38a1..0e03be0fe2a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -52,7 +52,7 @@ #include "reload.h" #include "cfglayout.h" #include "sched-int.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-flow.h" #include "intl.h" #include "params.h" @@ -958,7 +958,7 @@ static void rs6000_darwin_file_start (void); static tree rs6000_build_builtin_va_list (void); static void rs6000_va_start (tree, rtx); -static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *); +static tree rs6000_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *); static bool rs6000_must_pass_in_stack (enum machine_mode, const_tree); static bool rs6000_scalar_mode_supported_p (enum machine_mode); static bool rs6000_vector_mode_supported_p (enum machine_mode); @@ -6713,9 +6713,12 @@ rs6000_va_start (tree valist, rtx nextarg) valist = build_va_arg_indirect_ref (valist); gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE); - fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE); - ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE); - sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE); + fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist), + f_fpr, NULL_TREE); + ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), unshare_expr (valist), + f_ovf, NULL_TREE); + sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), unshare_expr (valist), + f_sav, NULL_TREE); /* Count number of gp and fp argument registers used. */ words = crtl->args.info.words; @@ -6731,7 +6734,7 @@ rs6000_va_start (tree valist, rtx nextarg) if (cfun->va_list_gpr_size) { - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gpr), gpr, + t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr, build_int_cst (NULL_TREE, n_gpr)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6739,7 +6742,7 @@ rs6000_va_start (tree valist, rtx nextarg) if (cfun->va_list_fpr_size) { - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (fpr), fpr, + t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr, build_int_cst (NULL_TREE, n_fpr)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6750,7 +6753,7 @@ rs6000_va_start (tree valist, rtx nextarg) if (words != 0) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovf), t, size_int (words * UNITS_PER_WORD)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6767,7 +6770,7 @@ rs6000_va_start (tree valist, rtx nextarg) if (cfun->machine->varargs_save_offset) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (sav), t, size_int (cfun->machine->varargs_save_offset)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (sav), sav, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (sav), sav, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -6775,7 +6778,8 @@ rs6000_va_start (tree valist, rtx nextarg) /* Implement va_arg. */ tree -rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) +rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { tree f_gpr, f_fpr, f_res, f_ovf, f_sav; tree gpr, fpr, ovf, sav, reg, t, u; @@ -6784,6 +6788,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) int align; tree ptrtype = build_pointer_type (type); int regalign = 0; + gimple stmt; if (pass_by_reference (NULL, TYPE_MODE (type), type, false)) { @@ -6802,14 +6807,14 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) if (elem_size < UNITS_PER_WORD) { tree real_part, imag_part; - tree post = NULL_TREE; + gimple_seq post = NULL; real_part = rs6000_gimplify_va_arg (valist, elem_type, pre_p, &post); /* Copy the value into a temporary, lest the formal temporary be reused out from under us. */ real_part = get_initialized_tmp_var (real_part, pre_p, &post); - append_to_statement_list (post, pre_p); + gimple_seq_add_seq (pre_p, post); imag_part = rs6000_gimplify_va_arg (valist, elem_type, pre_p, post_p); @@ -6829,9 +6834,12 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) valist = build_va_arg_indirect_ref (valist); gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE); - fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE); - ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE); - sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE); + fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist), + f_fpr, NULL_TREE); + ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), unshare_expr (valist), + f_ovf, NULL_TREE); + sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), unshare_expr (valist), + f_sav, NULL_TREE); size = int_size_in_bytes (type); rsize = (size + 3) / 4; @@ -6885,18 +6893,19 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) if (n_reg == 2 && reg == gpr) { regalign = 1; - u = build2 (BIT_AND_EXPR, TREE_TYPE (reg), reg, + u = build2 (BIT_AND_EXPR, TREE_TYPE (reg), unshare_expr (reg), build_int_cst (TREE_TYPE (reg), n_reg - 1)); - u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), reg, u); + u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), + unshare_expr (reg), u); } /* _Decimal128 is passed in even/odd fpr pairs; the stored reg number is 0 for f1, so we want to make it odd. */ else if (reg == fpr && TYPE_MODE (type) == TDmode) { regalign = 1; - t = build2 (BIT_IOR_EXPR, TREE_TYPE (reg), reg, + t = build2 (BIT_IOR_EXPR, TREE_TYPE (reg), unshare_expr (reg), build_int_cst (TREE_TYPE (reg), 1)); - u = build2 (MODIFY_EXPR, void_type_node, reg, t); + u = build2 (MODIFY_EXPR, void_type_node, unshare_expr (reg), t); } t = fold_convert (TREE_TYPE (reg), size_int (8 - n_reg + 1)); @@ -6909,7 +6918,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) if (sav_ofs) t = build2 (POINTER_PLUS_EXPR, ptr_type_node, sav, size_int (sav_ofs)); - u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), reg, + u = build2 (POSTINCREMENT_EXPR, TREE_TYPE (reg), unshare_expr (reg), build_int_cst (TREE_TYPE (reg), n_reg)); u = fold_convert (sizetype, u); u = build2 (MULT_EXPR, sizetype, u, size_int (sav_scale)); @@ -6922,22 +6931,18 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) && TYPE_MODE (type) == SDmode) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, size_int (size)); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (addr, t, pre_p); - t = build1 (GOTO_EXPR, void_type_node, lab_over); - gimplify_and_add (t, pre_p); + gimple_seq_add_stmt (pre_p, gimple_build_goto (lab_over)); - t = build1 (LABEL_EXPR, void_type_node, lab_false); - append_to_statement_list (t, pre_p); + stmt = gimple_build_label (lab_false); + gimple_seq_add_stmt (pre_p, stmt); if ((n_reg == 2 && !regalign) || n_reg > 2) { /* Ensure that we don't find any more args in regs. Alignment has taken care of for special cases. */ - t = build_gimple_modify_stmt (reg, - build_int_cst (TREE_TYPE (reg), 8)); - gimplify_and_add (t, pre_p); + gimplify_assign (reg, build_int_cst (TREE_TYPE (reg), 8), pre_p); } } @@ -6955,17 +6960,15 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) } gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue); - u = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (u, pre_p); + gimplify_assign (unshare_expr (addr), t, pre_p); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, size_int (size)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t); - gimplify_and_add (t, pre_p); + gimplify_assign (unshare_expr (ovf), t, pre_p); if (lab_over) { - t = build1 (LABEL_EXPR, void_type_node, lab_over); - append_to_statement_list (t, pre_p); + stmt = gimple_build_label (lab_over); + gimple_seq_add_stmt (pre_p, stmt); } if (STRICT_ALIGNMENT @@ -11321,15 +11324,14 @@ rs6000_alloc_sdmode_stack_slot (void) { tree t; basic_block bb; - block_stmt_iterator bsi; + gimple_stmt_iterator gsi; gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX); FOR_EACH_BB (bb) - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - tree ret = walk_tree_without_duplicates (bsi_stmt_ptr (bsi), - rs6000_check_sdmode, NULL); + tree ret = walk_gimple_op (gsi_stmt (gsi), rs6000_check_sdmode, NULL); if (ret) { rtx stack = assign_stack_local (DDmode, GET_MODE_SIZE (DDmode), 0); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 936e0a0ead2..3c7d92b3c8d 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -50,7 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "debug.h" #include "langhooks.h" #include "optabs.h" -#include "tree-gimple.h" +#include "gimple.h" #include "df.h" @@ -8424,15 +8424,15 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) if (cfun->va_list_gpr_size) { - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (gpr), gpr, - build_int_cst (NULL_TREE, n_gpr)); + t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr, + build_int_cst (NULL_TREE, n_gpr)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } if (cfun->va_list_fpr_size) { - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (fpr), fpr, + t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr, build_int_cst (NULL_TREE, n_fpr)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -8452,7 +8452,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovf), t, size_int (off)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovf), ovf, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -8465,7 +8465,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (sav), t, size_int (-RETURN_REGNUM * UNITS_PER_WORD)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (sav), sav, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (sav), sav, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -8496,8 +8496,8 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) } */ static tree -s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, - tree *post_p ATTRIBUTE_UNUSED) +s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED) { tree f_gpr, f_fpr, f_ovf, f_sav; tree gpr, fpr, ovf, sav, reg, t, u; @@ -8512,9 +8512,13 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, valist = build_va_arg_indirect_ref (valist); gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE); fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE); - ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE); sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE); + /* The tree for args* cannot be shared between gpr/fpr and ovf since + both appear on a lhs. */ + valist = unshare_expr (valist); + ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE); + size = int_size_in_bytes (type); if (pass_by_reference (NULL, TYPE_MODE (type), type, false)) @@ -8598,14 +8602,11 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, fold_convert (TREE_TYPE (reg), size_int (sav_scale))); t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t, fold_convert (sizetype, u)); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (addr, t, pre_p); - t = build1 (GOTO_EXPR, void_type_node, lab_over); - gimplify_and_add (t, pre_p); + gimple_seq_add_stmt (pre_p, gimple_build_goto (lab_over)); - t = build1 (LABEL_EXPR, void_type_node, lab_false); - append_to_statement_list (t, pre_p); + gimple_seq_add_stmt (pre_p, gimple_build_label (lab_false)); /* ... Otherwise out of the overflow area. */ @@ -8617,16 +8618,13 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue); - u = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (u, pre_p); + gimplify_assign (addr, t, pre_p); t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t, size_int (size)); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, ovf, t); - gimplify_and_add (t, pre_p); + gimplify_assign (ovf, t, pre_p); - t = build1 (LABEL_EXPR, void_type_node, lab_over); - append_to_statement_list (t, pre_p); + gimple_seq_add_stmt (pre_p, gimple_build_label (lab_over)); /* Increment register save count. */ diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index e311362de6c..c7b8f582062 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "sched-int.h" #include "ggc.h" -#include "tree-gimple.h" +#include "gimple.h" #include "cfgloop.h" #include "alloc-pool.h" #include "tm-constrs.h" @@ -262,7 +262,7 @@ static bool sh_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *); static tree sh_build_builtin_va_list (void); static tree sh_canonical_va_list_type (tree); static void sh_va_start (tree, rtx); -static tree sh_gimplify_va_arg_expr (tree, tree, tree *, tree *); +static tree sh_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static bool sh_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); static bool sh_callee_copies (CUMULATIVE_ARGS *, enum machine_mode, @@ -7200,7 +7200,7 @@ sh_va_start (tree valist, rtx nextarg) /* Call __builtin_saveregs. */ u = make_tree (sizetype, expand_builtin_saveregs ()); u = fold_convert (ptr_type_node, u); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp, u); + t = build2 (MODIFY_EXPR, ptr_type_node, next_fp, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -7211,11 +7211,11 @@ sh_va_start (tree valist, rtx nextarg) nfp = 0; u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u, size_int (UNITS_PER_WORD * nfp)); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp_limit, u); + t = build2 (MODIFY_EXPR, ptr_type_node, next_fp_limit, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_o, u); + t = build2 (MODIFY_EXPR, ptr_type_node, next_o, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -7226,12 +7226,12 @@ sh_va_start (tree valist, rtx nextarg) nint = 0; u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u, size_int (UNITS_PER_WORD * nint)); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_o_limit, u); + t = build2 (MODIFY_EXPR, ptr_type_node, next_o_limit, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); u = make_tree (ptr_type_node, nextarg); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_stack, u); + t = build2 (MODIFY_EXPR, ptr_type_node, next_stack, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -7260,8 +7260,8 @@ find_sole_member (tree type) /* Implement `va_arg'. */ static tree -sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, - tree *post_p ATTRIBUTE_UNUSED) +sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED) { HOST_WIDE_INT size, rsize; tree tmp, pptr_type_node; @@ -7351,11 +7351,9 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, bool is_double = size == 8 && TREE_CODE (eff_type) == REAL_TYPE; tmp = build1 (ADDR_EXPR, pptr_type_node, next_fp); - tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (addr, tmp, pre_p); - tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp_tmp, valist); - gimplify_and_add (tmp, pre_p); + gimplify_assign (next_fp_tmp, valist, pre_p); tmp = next_fp_limit; if (size > 4 && !is_double) tmp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (tmp), tmp, @@ -7375,9 +7373,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, size_int (UNITS_PER_WORD)); tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, next_fp_tmp, tmp); - tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, - next_fp_tmp, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (next_fp_tmp, tmp, pre_p); } if (is_double) gimplify_and_add (cmp, pre_p); @@ -7409,13 +7405,10 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, gimplify_and_add (tmp, pre_p); tmp = build1 (ADDR_EXPR, pptr_type_node, next_stack); - tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp); - gimplify_and_add (tmp, pre_p); - tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, next_fp_tmp, valist); - gimplify_and_add (tmp, pre_p); + gimplify_assign (addr, tmp, pre_p); + gimplify_assign (next_fp_tmp, valist, pre_p); - tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, valist, next_fp_tmp); - gimplify_and_add (tmp, post_p); + gimplify_assign (valist, next_fp_tmp, post_p); valist = next_fp_tmp; } else @@ -7429,8 +7422,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, gimplify_and_add (tmp, pre_p); tmp = build1 (ADDR_EXPR, pptr_type_node, next_o); - tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (addr, tmp, pre_p); tmp = build1 (GOTO_EXPR, void_type_node, lab_over); gimplify_and_add (tmp, pre_p); @@ -7439,15 +7431,10 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, gimplify_and_add (tmp, pre_p); if (size > 4 && ! (TARGET_SH4 || TARGET_SH2A)) - { - tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, - next_o, next_o_limit); - gimplify_and_add (tmp, pre_p); - } + gimplify_assign (next_o, next_o_limit, pre_p); tmp = build1 (ADDR_EXPR, pptr_type_node, next_stack); - tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (addr, tmp, pre_p); } if (!result) @@ -7463,8 +7450,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tmp = std_gimplify_va_arg_expr (valist, type, pre_p, NULL); if (result) { - tmp = build2 (GIMPLE_MODIFY_STMT, void_type_node, result, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (result, tmp, pre_p); tmp = build1 (LABEL_EXPR, void_type_node, lab_over); gimplify_and_add (tmp, pre_p); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 5e6f5748672..adf28c027b1 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "target-def.h" #include "cfglayout.h" -#include "tree-gimple.h" +#include "gimple.h" #include "langhooks.h" #include "params.h" #include "df.h" @@ -410,7 +410,7 @@ static rtx sparc_struct_value_rtx (tree, int); static bool sparc_return_in_memory (const_tree, const_tree); static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *); static void sparc_va_start (tree, rtx); -static tree sparc_gimplify_va_arg (tree, tree, tree *, tree *); +static tree sparc_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *); static bool sparc_vector_mode_supported_p (enum machine_mode); static bool sparc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); @@ -5709,7 +5709,8 @@ sparc_va_start (tree valist, rtx nextarg) /* Implement `va_arg' for stdarg. */ static tree -sparc_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) +sparc_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p) { HOST_WIDE_INT size, rsize, align; tree addr, incr; @@ -5792,8 +5793,7 @@ sparc_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) addr = fold_convert (ptrtype, addr); incr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, incr, size_int (rsize)); - incr = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, valist, incr); - gimplify_and_add (incr, post_p); + gimplify_assign (valist, incr, post_p); return build_va_arg_indirect_ref (addr); } diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index e645adb2281..83bd9f51315 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -50,7 +50,7 @@ #include "assert.h" #include "c-common.h" #include "machmode.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tm-constrs.h" #include "spu-builtins.h" #include "ddg.h" @@ -118,8 +118,8 @@ static unsigned char spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_m const_tree type, unsigned char named); static tree spu_build_builtin_va_list (void); static void spu_va_start (tree, rtx); -static tree spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p, - tree * post_p); +static tree spu_gimplify_va_arg_expr (tree valist, tree type, + gimple_seq * pre_p, gimple_seq * post_p); static int regno_aligned_for_load (int regno); static int store_with_one_insn_p (rtx mem); static int mem_is_padded_component_ref (rtx x); @@ -3238,7 +3238,7 @@ spu_va_start (tree valist, rtx nextarg) if (crtl->args.pretend_args_size > 0) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (args), t, size_int (-STACK_POINTER_OFFSET)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (args), args, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (args), args, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -3247,7 +3247,7 @@ spu_va_start (tree valist, rtx nextarg) t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (skip), t, size_int (crtl->args.pretend_args_size - STACK_POINTER_OFFSET)); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (skip), skip, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (skip), skip, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } @@ -3270,8 +3270,8 @@ spu_va_start (tree valist, rtx nextarg) ret = *(TYPE *)addr; */ static tree -spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p, - tree * post_p ATTRIBUTE_UNUSED) +spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p, + gimple_seq * post_p ATTRIBUTE_UNUSED) { tree f_args, f_skip; tree args, skip; @@ -3303,22 +3303,21 @@ spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p, /* build conditional expression to calculate addr. The expression will be gimplified later. */ paddedsize = size_int (rsize); - tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, args, paddedsize); + tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, unshare_expr (args), paddedsize); tmp = build2 (TRUTH_AND_EXPR, boolean_type_node, - build2 (GT_EXPR, boolean_type_node, tmp, skip), - build2 (LE_EXPR, boolean_type_node, args, skip)); + build2 (GT_EXPR, boolean_type_node, tmp, unshare_expr (skip)), + build2 (LE_EXPR, boolean_type_node, unshare_expr (args), + unshare_expr (skip))); tmp = build3 (COND_EXPR, ptr_type_node, tmp, - build2 (POINTER_PLUS_EXPR, ptr_type_node, skip, - size_int (32)), args); + build2 (POINTER_PLUS_EXPR, ptr_type_node, unshare_expr (skip), + size_int (32)), unshare_expr (args)); - tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, addr, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (addr, tmp, pre_p); /* update VALIST.__args */ tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, addr, paddedsize); - tmp = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (args), args, tmp); - gimplify_and_add (tmp, pre_p); + gimplify_assign (unshare_expr (args), tmp, pre_p); addr = fold_convert (build_pointer_type (type), addr); diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 6cbe52d5048..64ecec8f5e5 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "target-def.h" #include "tm_p.h" #include "langhooks.h" -#include "tree-gimple.h" +#include "gimple.h" #include "df.h" #include "ggc.h" @@ -1350,11 +1350,11 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) u = build_int_cst (NULL_TREE, INCOMING_FRAME_SP_OFFSET); u = fold_convert (TREE_TYPE (count), u); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base), t, u); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (base), base, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (base), base, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (count), count, + t = build2 (MODIFY_EXPR, TREE_TYPE (count), count, build_int_cst (NULL_TREE, crtl->args.info * UNITS_PER_WORD)); TREE_SIDE_EFFECTS (t) = 1; @@ -1366,8 +1366,8 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) Note: This algorithm is documented in stormy-abi. */ static tree -xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, - tree *post_p ATTRIBUTE_UNUSED) +xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED) { tree f_base, f_count; tree base, count; @@ -1408,8 +1408,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, gimplify_and_add (t, pre_p); t = build2 (POINTER_PLUS_EXPR, ptr_type_node, base, count_tmp); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (addr, t, pre_p); t = build1 (GOTO_EXPR, void_type_node, lab_gotaddr); gimplify_and_add (t, pre_p); @@ -1427,7 +1426,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree r, u; r = size_int (NUM_ARGUMENT_REGISTERS * UNITS_PER_WORD); - u = build2 (GIMPLE_MODIFY_STMT, void_type_node, count_tmp, r); + u = build2 (MODIFY_EXPR, TREE_TYPE (count_tmp), count_tmp, r); t = fold_convert (TREE_TYPE (count), r); t = build2 (GE_EXPR, boolean_type_node, count_tmp, t); @@ -1444,16 +1443,14 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, t = fold_convert (TREE_TYPE (t), fold (t)); t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base), base, t); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t); - gimplify_and_add (t, pre_p); + gimplify_assign (addr, t, pre_p); t = build1 (LABEL_EXPR, void_type_node, lab_gotaddr); gimplify_and_add (t, pre_p); t = fold_convert (TREE_TYPE (count), size_tree); t = build2 (PLUS_EXPR, TREE_TYPE (count), count_tmp, t); - t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (count), count, t); - gimplify_and_add (t, pre_p); + gimplify_assign (count, t, pre_p); addr = fold_convert (build_pointer_type (type), addr); return build_va_arg_indirect_ref (addr); diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 38a621df0d0..000df14854c 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "target-def.h" #include "langhooks.h" -#include "tree-gimple.h" +#include "gimple.h" #include "df.h" @@ -142,8 +142,9 @@ static section *xtensa_select_rtx_section (enum machine_mode, rtx, static bool xtensa_rtx_costs (rtx, int, int, int *); static tree xtensa_build_builtin_va_list (void); static bool xtensa_return_in_memory (const_tree, const_tree); +static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *, + gimple_seq *); static rtx xtensa_function_value (const_tree, const_tree, bool); -static tree xtensa_gimplify_va_arg_expr (tree, tree, tree *, tree *); static void xtensa_init_builtins (void); static tree xtensa_fold_builtin (tree, tree, bool); static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int); @@ -2538,14 +2539,14 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Call __builtin_saveregs; save the result in __va_reg */ u = make_tree (sizetype, expand_builtin_saveregs ()); u = fold_convert (ptr_type_node, u); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, reg, u); + t = build2 (MODIFY_EXPR, ptr_type_node, reg, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Set the __va_stk member to ($arg_ptr - 32). */ u = make_tree (ptr_type_node, virtual_incoming_args_rtx); u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u, size_int (-32)); - t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, stk, u); + t = build2 (MODIFY_EXPR, ptr_type_node, stk, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -2554,7 +2555,7 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) alignment offset for __va_stk. */ if (arg_words >= MAX_ARGS_IN_REGISTERS) arg_words += 2; - t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx, + t = build2 (MODIFY_EXPR, integer_type_node, ndx, build_int_cst (integer_type_node, arg_words * UNITS_PER_WORD)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -2564,8 +2565,8 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Implement `va_arg'. */ static tree -xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, - tree *post_p ATTRIBUTE_UNUSED) +xtensa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, + gimple_seq *post_p ATTRIBUTE_UNUSED) { tree f_stk, stk; tree f_reg, reg; @@ -2624,8 +2625,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, build_int_cst (integer_type_node, align - 1)); t = build2 (BIT_AND_EXPR, integer_type_node, t, build_int_cst (integer_type_node, -align)); - t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, orig_ndx, t); - gimplify_and_add (t, pre_p); + gimplify_assign (orig_ndx, t, pre_p); } @@ -2635,8 +2635,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, t = fold_convert (integer_type_node, va_size); t = build2 (PLUS_EXPR, integer_type_node, orig_ndx, t); - t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx, t); - gimplify_and_add (t, pre_p); + gimplify_assign (ndx, t, pre_p); /* Check if the argument is in registers: @@ -2661,8 +2660,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, NULL_TREE); gimplify_and_add (t, pre_p); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, array, reg); - gimplify_and_add (t, pre_p); + gimplify_assign (array, reg, pre_p); t = build1 (GOTO_EXPR, void_type_node, lab_over); gimplify_and_add (t, pre_p); @@ -2694,14 +2692,12 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, t = size_binop (PLUS_EXPR, va_size, size_int (32)); t = fold_convert (integer_type_node, t); - t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx, t); - gimplify_and_add (t, pre_p); + gimplify_assign (ndx, t, pre_p); t = build1 (LABEL_EXPR, void_type_node, lab_false2); gimplify_and_add (t, pre_p); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, array, stk); - gimplify_and_add (t, pre_p); + gimplify_assign (array, stk, pre_p); if (lab_over) { diff --git a/gcc/configure b/gcc/configure index c015f6e52e3..3293be1713e 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1017,7 +1017,7 @@ Optional Features: enable expensive run-time checks. With LIST, enable only specific categories of checks. Categories are: yes,no,all,none,release. - Flags are: assert,df,fold,gc,gcac,misc, + Flags are: assert,df,fold,gc,gcac,gimple,misc, rtlflag,rtl,runtime,tree,valgrind,types. --enable-coverage=LEVEL enable compiler's code coverage collection. @@ -7266,25 +7266,25 @@ do # these set all the flags to specific states yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ; ac_fold_checking= ; ac_gc_checking=1 ; - ac_gc_always_collect= ; ac_rtl_checking= ; + ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ; ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; ac_tree_checking=1 ; ac_valgrind_checking= ; ac_types_checking=1 ;; no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ; ac_fold_checking= ; ac_gc_checking= ; - ac_gc_always_collect= ; ac_rtl_checking= ; + ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; ac_rtlflag_checking= ; ac_runtime_checking= ; ac_tree_checking= ; ac_valgrind_checking= ; ac_types_checking= ;; all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ; ac_fold_checking=1 ; ac_gc_checking=1 ; - ac_gc_always_collect=1 ; ac_rtl_checking=1 ; + ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ; ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; ac_tree_checking=1 ; ac_valgrind_checking= ; ac_types_checking=1 ;; release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ; ac_fold_checking= ; ac_gc_checking= ; - ac_gc_always_collect= ; ac_rtl_checking= ; + ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; ac_rtlflag_checking= ; ac_runtime_checking=1 ; ac_tree_checking= ; ac_valgrind_checking= ; ac_types_checking= ;; @@ -7294,6 +7294,7 @@ do fold) ac_fold_checking=1 ;; gc) ac_gc_checking=1 ;; gcac) ac_gc_always_collect=1 ;; + gimple) ac_gimple_checking=1 ;; misc) ac_checking=1 ;; rtl) ac_rtl_checking=1 ;; rtlflag) ac_rtlflag_checking=1 ;; @@ -7331,6 +7332,13 @@ cat >>confdefs.h <<\_ACEOF #define ENABLE_ASSERT_CHECKING 1 _ACEOF +fi +if test x$ac_gimple_checking != x ; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_GIMPLE_CHECKING 1 +_ACEOF + fi if test x$ac_runtime_checking != x ; then @@ -14723,13 +14731,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:14726: $ac_compile\"" >&5) + (eval echo "\"\$as_me:14734: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:14729: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:14737: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:14732: output\"" >&5) + (eval echo "\"\$as_me:14740: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -15784,7 +15792,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 15787 "configure"' > conftest.$ac_ext + echo '#line 15795 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16404,11 +16412,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16407: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16415: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16411: \$? = $ac_status" >&5 + echo "$as_me:16419: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16726,11 +16734,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16729: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16737: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16733: \$? = $ac_status" >&5 + echo "$as_me:16741: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16831,11 +16839,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16834: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16842: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16838: \$? = $ac_status" >&5 + echo "$as_me:16846: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16886,11 +16894,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16889: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16897: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16893: \$? = $ac_status" >&5 + echo "$as_me:16901: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19683,7 +19691,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19686 "configure" +#line 19694 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19783,7 +19791,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19786 "configure" +#line 19794 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 03c3d1c3888..6d266f285d9 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -350,7 +350,7 @@ AC_ARG_ENABLE(checking, enable expensive run-time checks. With LIST, enable only specific categories of checks. Categories are: yes,no,all,none,release. - Flags are: assert,df,fold,gc,gcac,misc, + Flags are: assert,df,fold,gc,gcac,gimple,misc, rtlflag,rtl,runtime,tree,valgrind,types.], [ac_checking_flags="${enableval}"],[ # Determine the default checks. @@ -366,25 +366,25 @@ do # these set all the flags to specific states yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ; ac_fold_checking= ; ac_gc_checking=1 ; - ac_gc_always_collect= ; ac_rtl_checking= ; + ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ; ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; ac_tree_checking=1 ; ac_valgrind_checking= ; ac_types_checking=1 ;; no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ; ac_fold_checking= ; ac_gc_checking= ; - ac_gc_always_collect= ; ac_rtl_checking= ; + ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; ac_rtlflag_checking= ; ac_runtime_checking= ; ac_tree_checking= ; ac_valgrind_checking= ; ac_types_checking= ;; all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ; ac_fold_checking=1 ; ac_gc_checking=1 ; - ac_gc_always_collect=1 ; ac_rtl_checking=1 ; + ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ; ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; ac_tree_checking=1 ; ac_valgrind_checking= ; ac_types_checking=1 ;; release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ; ac_fold_checking= ; ac_gc_checking= ; - ac_gc_always_collect= ; ac_rtl_checking= ; + ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; ac_rtlflag_checking= ; ac_runtime_checking=1 ; ac_tree_checking= ; ac_valgrind_checking= ; ac_types_checking= ;; @@ -394,6 +394,7 @@ do fold) ac_fold_checking=1 ;; gc) ac_gc_checking=1 ;; gcac) ac_gc_always_collect=1 ;; + gimple) ac_gimple_checking=1 ;; misc) ac_checking=1 ;; rtl) ac_rtl_checking=1 ;; rtlflag) ac_rtlflag_checking=1 ;; @@ -422,6 +423,12 @@ if test x$ac_assert_checking != x ; then AC_DEFINE(ENABLE_ASSERT_CHECKING, 1, [Define if you want assertions enabled. This is a cheap check.]) fi +if test x$ac_gimple_checking != x ; then + AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1, +[Define if you want operations on GIMPLE (the basic data structure of +the high-level optimizers) to be checked for dynamic type safety at +runtime. This is moderately expensive.]) +fi GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING) if test x$ac_runtime_checking != x ; then AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1, diff --git a/gcc/coretypes.h b/gcc/coretypes.h index f5d62cab785..e1d66a52608 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -47,11 +47,20 @@ typedef struct rtvec_def *rtvec; typedef const struct rtvec_def *const_rtvec; union tree_node; typedef union tree_node *tree; +union gimple_statement_d; +typedef union gimple_statement_d *gimple; typedef const union tree_node *const_tree; +typedef const union gimple_statement_d *const_gimple; union section; typedef union section section; struct cl_target_option; struct cl_optimization; +struct gimple_seq_d; +typedef struct gimple_seq_d *gimple_seq; +typedef const struct gimple_seq_d *const_gimple_seq; +struct gimple_seq_node_d; +typedef struct gimple_seq_node_d *gimple_seq_node; +typedef const struct gimple_seq_node_d *const_gimple_seq_node; /* The major intermediate representations of GCC. */ enum ir_type { diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6a13613d860..ad2964cf403 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,143 @@ +2008-07-28 Richard Guenther + + Merge from gimple-tuples-branch. + + 2008-07-22 Aldy Hernandez + + * cp-gimplify.c (gimplify_if_stmt): Set location on newly created + COND_EXPR. + + 2008-07-18 Jakub Jelinek + + * decl.c (finish_function): Call gimple_body after cp_genericize. + + 2008-07-18 Aldy Hernandez + + * optimize.c: Include gimple.h instead of tree-gimple.h. + * Make-lang.in (cp-gimplify.o): Depend on tree-iterator.h. + * cp-gimplify.c: Rename tree-gimple.h to gimple.h. Include + tree-iterator.h. + + 2008-07-16 Jakub Jelinek + + * optimize.c (maybe_clone_body): Clear DECL_SAVED_TREE for the clone. + + 2008-07-14 Jakub Jelinek + + * cp-gimplify.c (cp_gimplify_expr): Update comment. + + 2008-07-14 Aldy Hernandez + + * cp-tree.h (union lang_tree_node): Rename GENERIC_NEXT to + TREE_CHAIN. + * cp-gimplify.c (cxx_omp_clause_apply_fn): Rename + GIMPLE_MODIFY_STMT to MODIFY_EXPR. + (cxx_omp_clause_copy_ctor): Same. + (cxx_omp_clause_assign_op): Same. + + 2008-05-28 Jakub Jelinek + + * cp-gimplify.c (cp_gimplify_omp_for): Add pre_p argument. Tuplify. + (cp_gimplify_expr): Adjust caller. + + 2008-05-11 Doug Kwan + + * init.c (build_vec_delete): Add type conversion for argument + 0 of POINTER_PLUS_EXPR. + + 2008-04-29 Doug Kwan + + * decl2 (File): Include "gimple.h" + (cp_write_global_declarations): Use gimple_body instead of + DECL_SAVED_TREE. + * Make-lang.in (cp/decl2.o): Add $(GIMPLE_H) + + 2008-04-10 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00913.html + + * optimize.c (maybe_clone_body): Re-enable call to + clone_body. + * cp-gimplify.c (cp_gimplify_omp_for): Mark disabled + code with call to gimple_unreachable. + (cp_genericize): Fix handling of clone bodies. + + 2008-04-04 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00413.html + + * optimize.c (maybe_clone_body): Re-enable. + + 2008-02-19 Diego Novillo + Oleg Ryjkov + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00804.html + + * cp-gimplify.c (gimplify_for_stmt): Change gimple_seq + argument to gimple_seq *. Update all users. + (gimplify_must_not_throw_expr): Likewise. + + 2008-02-04 Oleg Ryjkov + + * except.c: Include gimple.h + (cp_protect_cleanup_actions): Convert to tuples. + * Make-lang.in (cp/except.o): Add dependency on gimple.h + + 2007-11-10 Aldy Hernandez + + * cp-gimplify.c (gimplify_cp_loop): Call tree_annotate_all_with_locus + instead of annotating each block manually. + + 2007-10-30 Aldy Hernandez + + * cp-gimplify.c (gimplify_cp_loop): Tuplify. + (gimplify_for_stmt): Same. + (gimplify_switch_stmt): Same. + (cp_gimplify_expr): [FOR_STMT]: Do not call gimplify_for_stmt. Return + GS_OK. + [WHILE_STMT]: Return GS_OK. + [SWITCH_STMT]: Same. + [CONTINUE_STMT]: Same. + [BREAK_STMT]: Same. + (cp_genericize): Set gimple_body() of cloned functions when needed. + + 2007-10-29 Aldy Hernandez + + * cp-gimplify.c: Move build_gimple_eh_filter_tree here. + (cp_gimplify_init_expr): Convert to tuples. + (gimplify_must_not_throw_expr): Make function return a + gimplify_status and convert to tuples. + + 2007-10-18 Aldy Hernandez + + * cp-gimplify.c (genericize_try_block): Enable and do not call + gimplify_stmt. + (genericize_catch_block): Same. + (genericize_eh_spec_block): Same. + Rename gimple_build_eh_filter_tree to build_gimple_eh_filter_tree. + (cp_gimplify_expr): Enable TRY_BLOCK, HANDLER, and EH_SPEC_BLOCK. + + 2007-10-16 Aldy Hernandez + + * optimize.c (maybe_clone_body): Comment out call to clone_body. + * decl.c (finish_function): Use gimple_body instead of + DECL_SAVED_TREE. + * cp-tree.h (cp_gimplify_expr): Last 2 arguments are sequences. + * cp-gimplify.c (genericize_try_block): Comment out. + (genericize_catch_block): Same. + (genericize_eh_spec_block): Same. + (gimplify_cp_loop): Comment out calls to gimplify_stmt. + (gimplify_for_stmt): Comment out. + (gimplify_switch_stmt): Comment out call to gimplify_stmt. + (cp_gimplify_omp_for): Same. + (gimplify_must_not_throw_expr): Argument pre_p is a sequence. + Comment out call to gimplify_stmt and append_to_statement_list. + Rename gimple_build_eh_filter_tree to build_gimple_eh_filter_tree. + (cp_gimplify_init_expr): Arguments pre_p and post_p are sequences. + (cp_gimplify_expr): Same. + Comment out calls to genericize_*_block. Comment out call to + gimplify_for_stmt. + 2008-07-27 H.J. Lu PR c++/36944 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index c7877205f25..03963446251 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -239,7 +239,7 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \ debug.h gt-cp-decl.h $(TIMEVAR_H) $(TREE_FLOW_H) $(TARGET_H) cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h $(EXPR_H) \ output.h except.h toplev.h $(RTL_H) $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \ - $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) + $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) $(GIMPLE_H) cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) $(C_COMMON_H) toplev.h \ langhooks.h $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h \ @@ -280,17 +280,17 @@ cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \ gt-cp-repo.h cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) except.h toplev.h \ $(FLAGS_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ - $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) + $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H) cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) $(TREE_DUMP_H) cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h $(INTEGRATE_H) \ - insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(TREE_GIMPLE_H) \ + insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \ $(TARGET_H) cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h $(REAL_H) \ gt-cp-mangle.h $(TARGET_H) $(TM_P_H) cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_H) gt-cp-parser.h \ output.h $(TARGET_H) cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) toplev.h $(C_COMMON_H) \ - $(TM_H) coretypes.h pointer-set.h + $(TM_H) coretypes.h pointer-set.h tree-iterator.h cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h toplev.h \ diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index c6d64dfbb75..8dda74d3cbe 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -28,7 +28,8 @@ along with GCC; see the file COPYING3. If not see #include "cp-tree.h" #include "c-common.h" #include "toplev.h" -#include "tree-gimple.h" +#include "tree-iterator.h" +#include "gimple.h" #include "hashtab.h" #include "pointer-set.h" #include "flags.h" @@ -62,20 +63,14 @@ begin_bc_block (enum bc_t bc) If we saw a break (or continue) in the scope, append a LABEL_EXPR to body. Otherwise, just forget the label. */ -static tree -finish_bc_block (enum bc_t bc, tree label, tree body) +static gimple_seq +finish_bc_block (enum bc_t bc, tree label, gimple_seq body) { gcc_assert (label == bc_label[bc]); if (TREE_USED (label)) { - tree t, sl = NULL; - - t = build1 (LABEL_EXPR, void_type_node, label); - - append_to_statement_list (body, &sl); - append_to_statement_list (t, &sl); - body = sl; + gimple_seq_add_stmt (&body, gimple_build_label (label)); } bc_label[bc] = TREE_CHAIN (label); @@ -83,11 +78,11 @@ finish_bc_block (enum bc_t bc, tree label, tree body) return body; } -/* Build a GOTO_EXPR to represent a break or continue statement. BC - indicates which. */ +/* Get the LABEL_EXPR to represent a break or continue statement + in the current block scope. BC indicates which. */ static tree -build_bc_goto (enum bc_t bc) +get_bc_label (enum bc_t bc) { tree label = bc_label[bc]; @@ -103,7 +98,7 @@ build_bc_goto (enum bc_t bc) /* Mark the label used for finish_bc_block. */ TREE_USED (label) = 1; - return build1 (GOTO_EXPR, void_type_node, label); + return label; } /* Genericize a TRY_BLOCK. */ @@ -114,13 +109,6 @@ genericize_try_block (tree *stmt_p) tree body = TRY_STMTS (*stmt_p); tree cleanup = TRY_HANDLERS (*stmt_p); - gimplify_stmt (&body); - - if (CLEANUP_P (*stmt_p)) - /* A cleanup is an expression, so it doesn't need to be genericized. */; - else - gimplify_stmt (&cleanup); - *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup); } @@ -132,12 +120,28 @@ genericize_catch_block (tree *stmt_p) tree type = HANDLER_TYPE (*stmt_p); tree body = HANDLER_BODY (*stmt_p); - gimplify_stmt (&body); - /* FIXME should the caught type go in TREE_TYPE? */ *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body); } +/* A terser interface for building a representation of an exception + specification. */ + +static tree +build_gimple_eh_filter_tree (tree body, tree allowed, tree failure) +{ + tree t; + + /* FIXME should the allowed types go in TREE_TYPE? */ + t = build2 (EH_FILTER_EXPR, void_type_node, allowed, NULL_TREE); + append_to_statement_list (failure, &EH_FILTER_FAILURE (t)); + + t = build2 (TRY_CATCH_EXPR, void_type_node, NULL_TREE, t); + append_to_statement_list (body, &TREE_OPERAND (t, 0)); + + return t; +} + /* Genericize an EH_SPEC_BLOCK by converting it to a TRY_CATCH_EXPR/EH_FILTER_EXPR pair. */ @@ -147,9 +151,8 @@ genericize_eh_spec_block (tree *stmt_p) tree body = EH_SPEC_STMTS (*stmt_p); tree allowed = EH_SPEC_RAISES (*stmt_p); tree failure = build_call_n (call_unexpected_node, 1, build_exc_ptr ()); - gimplify_stmt (&body); - *stmt_p = gimple_build_eh_filter (body, allowed, failure); + *stmt_p = build_gimple_eh_filter_tree (body, allowed, failure); } /* Genericize an IF_STMT by turning it into a COND_EXPR. */ @@ -158,6 +161,7 @@ static void gimplify_if_stmt (tree *stmt_p) { tree stmt, cond, then_, else_; + location_t locus = EXPR_LOCATION (*stmt_p); stmt = *stmt_p; cond = IF_COND (stmt); @@ -175,6 +179,8 @@ gimplify_if_stmt (tree *stmt_p) stmt = else_; else stmt = build3 (COND_EXPR, void_type_node, cond, then_, else_); + if (CAN_HAVE_LOCATION_P (stmt) && !EXPR_HAS_LOCATION (stmt)) + SET_EXPR_LOCATION (stmt, locus); *stmt_p = stmt; } @@ -185,15 +191,20 @@ gimplify_if_stmt (tree *stmt_p) evaluated before the loop body as in while and for loops, or after the loop body as in do-while loops. */ -static tree +static gimple_seq gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) { - tree top, entry, exit, cont_block, break_block, stmt_list, t; + gimple top, entry, stmt; + gimple_seq stmt_list, body_seq, incr_seq, exit_seq; + tree cont_block, break_block; location_t stmt_locus; stmt_locus = input_location; - stmt_list = NULL_TREE; - entry = NULL_TREE; + stmt_list = NULL; + body_seq = NULL; + incr_seq = NULL; + exit_seq = NULL; + entry = NULL; break_block = begin_bc_block (bc_break); cont_block = begin_bc_block (bc_continue); @@ -201,12 +212,12 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) /* If condition is zero don't generate a loop construct. */ if (cond && integer_zerop (cond)) { - top = NULL_TREE; - exit = NULL_TREE; + top = NULL; if (cond_is_first) { - t = build_bc_goto (bc_break); - append_to_statement_list (t, &stmt_list); + stmt = gimple_build_goto (get_bc_label (bc_break)); + gimple_set_location (stmt, stmt_locus); + gimple_seq_add_stmt (&stmt_list, stmt); } } else @@ -215,44 +226,55 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) back through the main gimplifier to lower it. Given that we have to gimplify the loop body NOW so that we can resolve break/continue stmts, seems easier to just expand to gotos. */ - top = build1 (LABEL_EXPR, void_type_node, NULL_TREE); + top = gimple_build_label (create_artificial_label ()); /* If we have an exit condition, then we build an IF with gotos either out of the loop, or to the top of it. If there's no exit condition, then we just build a jump back to the top. */ - exit = build_and_jump (&LABEL_EXPR_LABEL (top)); if (cond && !integer_nonzerop (cond)) { - t = build_bc_goto (bc_break); - exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t); - gimplify_stmt (&exit); + if (cond != error_mark_node) + { + gimplify_expr (&cond, &exit_seq, NULL, is_gimple_val, fb_rvalue); + stmt = gimple_build_cond (NE_EXPR, cond, + build_int_cst (TREE_TYPE (cond), 0), + gimple_label_label (top), + get_bc_label (bc_break)); + gimple_seq_add_stmt (&exit_seq, stmt); + } if (cond_is_first) { if (incr) { - entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE); - t = build_and_jump (&LABEL_EXPR_LABEL (entry)); + entry = gimple_build_label (create_artificial_label ()); + stmt = gimple_build_goto (gimple_label_label (entry)); } else - t = build_bc_goto (bc_continue); - append_to_statement_list (t, &stmt_list); + stmt = gimple_build_goto (get_bc_label (bc_continue)); + gimple_set_location (stmt, stmt_locus); + gimple_seq_add_stmt (&stmt_list, stmt); } } + else + { + stmt = gimple_build_goto (gimple_label_label (top)); + gimple_seq_add_stmt (&exit_seq, stmt); + } } - gimplify_stmt (&body); - gimplify_stmt (&incr); + gimplify_stmt (&body, &body_seq); + gimplify_stmt (&incr, &incr_seq); - body = finish_bc_block (bc_continue, cont_block, body); + body_seq = finish_bc_block (bc_continue, cont_block, body_seq); - append_to_statement_list (top, &stmt_list); - append_to_statement_list (body, &stmt_list); - append_to_statement_list (incr, &stmt_list); - append_to_statement_list (entry, &stmt_list); - append_to_statement_list (exit, &stmt_list); + gimple_seq_add_stmt (&stmt_list, top); + gimple_seq_add_seq (&stmt_list, body_seq); + gimple_seq_add_seq (&stmt_list, incr_seq); + gimple_seq_add_stmt (&stmt_list, entry); + gimple_seq_add_seq (&stmt_list, exit_seq); - annotate_all_with_locus (&stmt_list, stmt_locus); + annotate_all_with_location (stmt_list, stmt_locus); return finish_bc_block (bc_break, break_block, stmt_list); } @@ -261,45 +283,52 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) prequeue and hand off to gimplify_cp_loop. */ static void -gimplify_for_stmt (tree *stmt_p, tree *pre_p) +gimplify_for_stmt (tree *stmt_p, gimple_seq *pre_p) { tree stmt = *stmt_p; if (FOR_INIT_STMT (stmt)) gimplify_and_add (FOR_INIT_STMT (stmt), pre_p); - *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt), - FOR_EXPR (stmt), 1); + gimple_seq_add_seq (pre_p, + gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt), + FOR_EXPR (stmt), 1)); + *stmt_p = NULL_TREE; } /* Gimplify a WHILE_STMT node. */ static void -gimplify_while_stmt (tree *stmt_p) +gimplify_while_stmt (tree *stmt_p, gimple_seq *pre_p) { tree stmt = *stmt_p; - *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt), - NULL_TREE, 1); + gimple_seq_add_seq (pre_p, + gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt), + NULL_TREE, 1)); + *stmt_p = NULL_TREE; } /* Gimplify a DO_STMT node. */ static void -gimplify_do_stmt (tree *stmt_p) +gimplify_do_stmt (tree *stmt_p, gimple_seq *pre_p) { tree stmt = *stmt_p; - *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt), - NULL_TREE, 0); + gimple_seq_add_seq (pre_p, + gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt), + NULL_TREE, 0)); + *stmt_p = NULL_TREE; } /* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR. */ static void -gimplify_switch_stmt (tree *stmt_p) +gimplify_switch_stmt (tree *stmt_p, gimple_seq *pre_p) { tree stmt = *stmt_p; - tree break_block, body; + tree break_block, body, t; location_t stmt_locus = input_location; + gimple_seq seq = NULL; break_block = begin_bc_block (bc_break); @@ -307,12 +336,14 @@ gimplify_switch_stmt (tree *stmt_p) if (!body) body = build_empty_stmt (); - *stmt_p = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt), - SWITCH_STMT_COND (stmt), body, NULL_TREE); - SET_EXPR_LOCATION (*stmt_p, stmt_locus); - gimplify_stmt (stmt_p); + t = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt), + SWITCH_STMT_COND (stmt), body, NULL_TREE); + SET_EXPR_LOCATION (t, stmt_locus); + gimplify_and_add (t, &seq); - *stmt_p = finish_bc_block (bc_break, break_block, *stmt_p); + seq = finish_bc_block (bc_break, break_block, seq); + gimple_seq_add_seq (pre_p, seq); + *stmt_p = NULL_TREE; } /* Hook into the middle of gimplifying an OMP_FOR node. This is required @@ -321,10 +352,12 @@ gimplify_switch_stmt (tree *stmt_p) regular gimplifier. */ static enum gimplify_status -cp_gimplify_omp_for (tree *expr_p) +cp_gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) { tree for_stmt = *expr_p; tree cont_block; + gimple stmt; + gimple_seq seq = NULL; /* Protect ourselves from recursion. */ if (OMP_FOR_GIMPLIFYING_P (for_stmt)) @@ -336,10 +369,15 @@ cp_gimplify_omp_for (tree *expr_p) statement expressions within the INIT, COND, or INCR expressions. */ cont_block = begin_bc_block (bc_continue); - gimplify_stmt (expr_p); + gimplify_and_add (for_stmt, &seq); + stmt = gimple_seq_last_stmt (seq); + if (gimple_code (stmt) == GIMPLE_OMP_FOR) + gimple_omp_set_body (stmt, finish_bc_block (bc_continue, cont_block, + gimple_omp_body (stmt))); + else + seq = finish_bc_block (bc_continue, cont_block, seq); + gimple_seq_add_seq (pre_p, seq); - OMP_FOR_BODY (for_stmt) - = finish_bc_block (bc_continue, cont_block, OMP_FOR_BODY (for_stmt)); OMP_FOR_GIMPLIFYING_P (for_stmt) = 0; return GS_ALL_DONE; @@ -383,7 +421,7 @@ gimplify_expr_stmt (tree *stmt_p) /* Gimplify initialization from an AGGR_INIT_EXPR. */ static void -cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p) +cp_gimplify_init_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) { tree from = TREE_OPERAND (*expr_p, 1); tree to = TREE_OPERAND (*expr_p, 0); @@ -441,31 +479,31 @@ cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p) /* Gimplify a MUST_NOT_THROW_EXPR. */ -static void -gimplify_must_not_throw_expr (tree *expr_p, tree *pre_p) +static enum gimplify_status +gimplify_must_not_throw_expr (tree *expr_p, gimple_seq *pre_p) { tree stmt = *expr_p; tree temp = voidify_wrapper_expr (stmt, NULL); tree body = TREE_OPERAND (stmt, 0); - gimplify_stmt (&body); - - stmt = gimple_build_eh_filter (body, NULL_TREE, - build_call_n (terminate_node, 0)); + stmt = build_gimple_eh_filter_tree (body, NULL_TREE, + build_call_n (terminate_node, 0)); + gimplify_and_add (stmt, pre_p); if (temp) { - append_to_statement_list (stmt, pre_p); *expr_p = temp; + return GS_OK; } - else - *expr_p = stmt; + + *expr_p = NULL; + return GS_ALL_DONE; } /* Do C++-specific gimplification. Args are as for gimplify_expr. */ int -cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p) +cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) { int saved_stmts_are_full_exprs_p = 0; enum tree_code code = TREE_CODE (*expr_p); @@ -498,11 +536,10 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p) break; case MUST_NOT_THROW_EXPR: - gimplify_must_not_throw_expr (expr_p, pre_p); - ret = GS_OK; + ret = gimplify_must_not_throw_expr (expr_p, pre_p); break; - /* We used to do this for GIMPLE_MODIFY_STMT as well, but that's unsafe; the + /* We used to do this for MODIFY_EXPR as well, but that's unsafe; the LHS of an assignment might also be involved in the RHS, as in bug 25979. */ case INIT_EXPR: @@ -539,7 +576,7 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p) case USING_STMT: /* Just ignore for now. Eventually we will want to pass this on to the debugger. */ - *expr_p = build_empty_stmt (); + *expr_p = NULL; ret = GS_ALL_DONE; break; @@ -550,35 +587,37 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p) case FOR_STMT: gimplify_for_stmt (expr_p, pre_p); - ret = GS_ALL_DONE; + ret = GS_OK; break; case WHILE_STMT: - gimplify_while_stmt (expr_p); - ret = GS_ALL_DONE; + gimplify_while_stmt (expr_p, pre_p); + ret = GS_OK; break; case DO_STMT: - gimplify_do_stmt (expr_p); - ret = GS_ALL_DONE; + gimplify_do_stmt (expr_p, pre_p); + ret = GS_OK; break; case SWITCH_STMT: - gimplify_switch_stmt (expr_p); - ret = GS_ALL_DONE; + gimplify_switch_stmt (expr_p, pre_p); + ret = GS_OK; break; case OMP_FOR: - ret = cp_gimplify_omp_for (expr_p); + ret = cp_gimplify_omp_for (expr_p, pre_p); break; case CONTINUE_STMT: - *expr_p = build_bc_goto (bc_continue); + gimple_seq_add_stmt (pre_p, gimple_build_goto (get_bc_label (bc_continue))); + *expr_p = NULL_TREE; ret = GS_ALL_DONE; break; case BREAK_STMT: - *expr_p = build_bc_goto (bc_break); + gimple_seq_add_stmt (pre_p, gimple_build_goto (get_bc_label (bc_break))); + *expr_p = NULL_TREE; ret = GS_ALL_DONE; break; @@ -835,13 +874,13 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) end1 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (start1), start1, end1); p1 = create_tmp_var (TREE_TYPE (start1), NULL); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p1, start1); + t = build2 (MODIFY_EXPR, TREE_TYPE (p1), p1, start1); append_to_statement_list (t, &ret); if (arg2) { p2 = create_tmp_var (TREE_TYPE (start2), NULL); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p2, start2); + t = build2 (MODIFY_EXPR, TREE_TYPE (p2), p2, start2); append_to_statement_list (t, &ret); } @@ -864,14 +903,14 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) t = TYPE_SIZE_UNIT (inner_type); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (p1), p1, t); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p1, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (p1), p1, t); append_to_statement_list (t, &ret); if (arg2) { t = TYPE_SIZE_UNIT (inner_type); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (p2), p2, t); - t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p2, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (p2), p2, t); append_to_statement_list (t, &ret); } @@ -925,7 +964,7 @@ cxx_omp_clause_copy_ctor (tree clause, tree dst, tree src) if (info) ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 0), dst, src); if (ret == NULL) - ret = build2 (GIMPLE_MODIFY_STMT, void_type_node, dst, src); + ret = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); return ret; } @@ -941,7 +980,7 @@ cxx_omp_clause_assign_op (tree clause, tree dst, tree src) if (info) ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 2), dst, src); if (ret == NULL) - ret = build2 (GIMPLE_MODIFY_STMT, void_type_node, dst, src); + ret = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); return ret; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 67f15e55219..f9a2af8bb01 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -534,7 +534,7 @@ enum cp_tree_node_structure_enum { /* The resulting tree type. */ union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), - chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.generic)"))) + chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) { union tree_node GTY ((tag ("TS_CP_GENERIC"), desc ("tree_node_structure (&%h)"))) generic; @@ -4938,7 +4938,8 @@ extern void init_shadowed_var_for_decl (void); extern tree cxx_staticp (tree); /* in cp-gimplify.c */ -extern int cp_gimplify_expr (tree *, tree *, tree *); +extern int cp_gimplify_expr (tree *, gimple_seq *, + gimple_seq *); extern void cp_genericize (tree); /* -- end of C++ */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0cc17a484f6..630faacb354 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12038,7 +12038,7 @@ finish_function (int flags) f->extern_decl_map = NULL; /* Handle attribute((warn_unused_result)). Relies on gimple input. */ - c_warn_unused_result (&DECL_SAVED_TREE (fndecl)); + c_warn_unused_result (gimple_body (fndecl)); } /* Clear out the bits we don't need. */ local_names = NULL; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a156e32dcdb..20b0826faf2 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "c-pragma.h" #include "tree-dump.h" #include "intl.h" +#include "gimple.h" extern cpp_reader *parse_in; @@ -3439,7 +3440,7 @@ cp_write_global_declarations (void) reconsider = true; } - if (!DECL_SAVED_TREE (decl)) + if (!gimple_body (decl)) continue; /* We lie to the back end, pretending that some functions diff --git a/gcc/cp/except.c b/gcc/cp/except.c index adb1b97928f..56a551212fe 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "tree-iterator.h" #include "target.h" +#include "gimple.h" static void push_eh_cleanup (tree); static tree prepare_eh_type (tree); @@ -53,7 +54,7 @@ static tree wrap_cleanups_r (tree *, int *, void *); static int complete_ptr_ref_or_void_ptr_p (tree, tree); static bool is_admissible_throw_operand (tree); static int can_convert_eh (tree, tree); -static tree cp_protect_cleanup_actions (void); +static gimple cp_protect_cleanup_actions (void); /* Sets up all the global eh stuff that needs to be initialized at the start of compilation. */ @@ -92,14 +93,14 @@ init_exception_processing (void) /* Returns an expression to be executed if an unhandled exception is propagated out of a cleanup region. */ -static tree +static gimple cp_protect_cleanup_actions (void) { /* [except.terminate] When the destruction of an object during stack unwinding exits using an exception ... void terminate(); is called. */ - return build_call_n (terminate_node, 0); + return gimple_build_call (terminate_node, 0); } static tree diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3dd6c4e328b..3deb85d432b 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3275,6 +3275,7 @@ build_vec_delete (tree base, tree maxindex, { /* Step back one from start of vector, and read dimension. */ tree cookie_addr; + tree size_ptr_type = build_pointer_type (sizetype); if (TREE_SIDE_EFFECTS (base)) { @@ -3284,8 +3285,8 @@ build_vec_delete (tree base, tree maxindex, type = strip_array_types (TREE_TYPE (type)); cookie_addr = fold_build1 (NEGATE_EXPR, sizetype, TYPE_SIZE_UNIT (sizetype)); cookie_addr = build2 (POINTER_PLUS_EXPR, - build_pointer_type (sizetype), - base, + size_ptr_type, + fold_convert (size_ptr_type, base), cookie_addr); maxindex = cp_build_indirect_ref (cookie_addr, NULL, tf_warning_or_error); } diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index a91f8d5f564..ed43b435831 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -1,5 +1,5 @@ /* Perform optimizations on tree structure. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Written by Mark Michell (mark@codesourcery.com). @@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "diagnostic.h" #include "tree-dump.h" -#include "tree-gimple.h" +#include "gimple.h" /* Prototypes. */ @@ -72,35 +72,40 @@ update_cloned_parm (tree parm, tree cloned_parm, bool first) DECL_GIMPLE_REG_P (cloned_parm) = DECL_GIMPLE_REG_P (parm); } -/* FN is a function that has a complete body, and CLONE is a function whose - body is to be set to a copy of FN, mapping argument declarations according - to the ARG_MAP splay_tree. */ + +/* FN is a function in High GIMPLE form that has a complete body and no + CFG. CLONE is a function whose body is to be set to a copy of FN, + mapping argument declarations according to the ARG_MAP splay_tree. */ static void clone_body (tree clone, tree fn, void *arg_map) { copy_body_data id; + gimple_seq new_body; + + /* FN must already be in GIMPLE form. */ + gcc_assert (gimple_body (fn)); - /* Clone the body, as if we were making an inline call. But, remap the - parameters in the callee to the parameters of caller. */ + /* Clone the body, as if we were making an inline call. But, remap + the parameters in the callee to the parameters of caller. */ memset (&id, 0, sizeof (id)); id.src_fn = fn; id.dst_fn = clone; id.src_cfun = DECL_STRUCT_FUNCTION (fn); - id.decl_map = (struct pointer_map_t *)arg_map; + id.decl_map = (struct pointer_map_t *) arg_map; id.copy_decl = copy_decl_no_change; id.transform_call_graph_edges = CB_CGE_DUPLICATE; id.transform_new_cfg = true; id.transform_return_to_modify = false; - id.transform_lang_insert_block = insert_block; + id.transform_lang_insert_block = NULL; /* We're not inside any EH region. */ id.eh_region = -1; /* Actually copy the body. */ - append_to_statement_list_force (copy_generic_body (&id), - &DECL_SAVED_TREE (clone)); + new_body = remap_gimple_seq (gimple_body (fn), &id); + gimple_set_body (clone, new_body); } /* FN is a function that has a complete body. Clone the body as @@ -228,6 +233,7 @@ maybe_clone_body (tree fn) /* Now, expand this function into RTL, if appropriate. */ finish_function (0); BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn); + DECL_SAVED_TREE (clone) = NULL; expand_or_defer_fn (clone); first = false; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ffa6493ced4..5ada42241fb 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-iterator.h" #include "vec.h" #include "target.h" +#include "gimple.h" /* There routines provide a modular interface to perform many parsing operations. They may therefore be used during actual parsing, or @@ -3201,6 +3202,8 @@ expand_or_defer_fn (tree fn) return; } + gcc_assert (gimple_body (fn)); + /* Replace AGGR_INIT_EXPRs with appropriate CALL_EXPRs. */ cp_walk_tree_without_duplicates (&DECL_SAVED_TREE (fn), simplify_aggr_init_exprs_r, diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 1d13eeeae42..8906cc48ca0 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -215,14 +215,24 @@ extern char *diagnostic_build_prefix (diagnostic_info *); extern char *file_name_as_prefix (const char *); /* In tree-pretty-print.c */ +extern void print_declaration (pretty_printer *, tree, int, int); extern int dump_generic_node (pretty_printer *, tree, int, int, bool); extern void print_generic_stmt (FILE *, tree, int); extern void print_generic_stmt_indented (FILE *, tree, int, int); extern void print_generic_expr (FILE *, tree, int); extern void print_generic_decl (FILE *, tree, int); +extern void debug_c_tree (tree); +extern void dump_omp_clauses (pretty_printer *, tree, int, int); +/* In gimple-pretty-print.c */ extern void debug_generic_expr (tree); extern void debug_generic_stmt (tree); extern void debug_tree_chain (tree); -extern void debug_c_tree (tree); +extern void debug_gimple_stmt (gimple); +extern void debug_gimple_seq (gimple_seq); +extern void print_gimple_seq (FILE *, gimple_seq, int, int); +extern void print_gimple_stmt (FILE *, gimple, int, int); +extern void print_gimple_expr (FILE *, gimple, int, int); +extern void dump_gimple_stmt (pretty_printer *, gimple, int, int); + #endif /* ! GCC_DIAGNOSTIC_H */ diff --git a/gcc/domwalk.c b/gcc/domwalk.c index cec95a5f932..8f779225432 100644 --- a/gcc/domwalk.c +++ b/gcc/domwalk.c @@ -144,7 +144,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) { void *bd = NULL; basic_block dest; - block_stmt_iterator bsi; + gimple_stmt_iterator gsi; bool is_interesting; basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks * 2); int sp = 0; @@ -168,8 +168,8 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) { bool recycled; - /* First get some local data, reusing any local data pointer we may - have saved. */ + /* First get some local data, reusing any local data + pointer we may have saved. */ if (VEC_length (void_p, walk_data->free_block_data) > 0) { bd = VEC_pop (void_p, walk_data->free_block_data); @@ -199,13 +199,14 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) if (is_interesting && walk_data->before_dom_children_walk_stmts) { if (walk_data->walk_stmts_backward) - for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi)) + for (gsi = gsi_last (bb_seq (bb)); !gsi_end_p (gsi); + gsi_prev (&gsi)) (*walk_data->before_dom_children_walk_stmts) (walk_data, bb, - bsi); + gsi); else - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) (*walk_data->before_dom_children_walk_stmts) (walk_data, bb, - bsi); + gsi); } /* Callback for operations to execute before we have walked the @@ -239,13 +240,14 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) if (is_interesting && walk_data->after_dom_children_walk_stmts) { if (walk_data->walk_stmts_backward) - for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi)) + for (gsi = gsi_last (bb_seq (bb)); !gsi_end_p (gsi); + gsi_prev (&gsi)) (*walk_data->after_dom_children_walk_stmts) (walk_data, bb, - bsi); + gsi); else - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) (*walk_data->after_dom_children_walk_stmts) (walk_data, bb, - bsi); + gsi); } /* Callback for operations to execute after we have walked the diff --git a/gcc/domwalk.h b/gcc/domwalk.h index 3fc6810207e..61117ef7d45 100644 --- a/gcc/domwalk.h +++ b/gcc/domwalk.h @@ -66,7 +66,7 @@ struct dom_walk_data /* Function to call to walk statements before the recursive walk of the dominator children. */ void (*before_dom_children_walk_stmts) (struct dom_walk_data *, - basic_block, block_stmt_iterator); + basic_block, gimple_stmt_iterator); /* Function to call after the statement walk occurring before the recursive walk of the dominator children. */ @@ -81,7 +81,7 @@ struct dom_walk_data /* Function to call to walk statements after the recursive walk of the dominator children. */ void (*after_dom_children_walk_stmts) (struct dom_walk_data *, - basic_block, block_stmt_iterator); + basic_block, gimple_stmt_iterator); /* Function to call after the statement walk occurring after the recursive walk of the dominator children. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d37a2c23a7d..a8e06efb22d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9636,9 +9636,8 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) CASE_CONVERT: case VIEW_CONVERT_EXPR: case SAVE_EXPR: - case GIMPLE_MODIFY_STMT: - return loc_descriptor_from_tree_1 (GENERIC_TREE_OPERAND (loc, 0), - want_address); + case MODIFY_EXPR: + return loc_descriptor_from_tree_1 (TREE_OPERAND (loc, 0), want_address); case COMPONENT_REF: case BIT_FIELD_REF: @@ -10442,7 +10441,7 @@ static tree reference_to_unused (tree * tp, int * walk_subtrees, void * data ATTRIBUTE_UNUSED) { - if (! EXPR_P (*tp) && ! GIMPLE_STMT_P (*tp) && ! CONSTANT_CLASS_P (*tp)) + if (! EXPR_P (*tp) && ! CONSTANT_CLASS_P (*tp)) *walk_subtrees = 0; if (DECL_P (*tp) && ! TREE_PUBLIC (*tp) && ! TREE_USED (*tp) diff --git a/gcc/ebitmap.h b/gcc/ebitmap.h index 8efb4375ecc..2916e44b223 100644 --- a/gcc/ebitmap.h +++ b/gcc/ebitmap.h @@ -121,7 +121,7 @@ ebitmap_iter_init (ebitmap_iterator *i, ebitmap bmp, unsigned int min) static inline bool ebitmap_iter_cond (ebitmap_iterator *i, unsigned int *n) { - unsigned int ourn; + unsigned int ourn = 0; if (i->size == 0) return false; diff --git a/gcc/except.c b/gcc/except.c index 5118a53cfa3..962dd0b8b64 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -86,7 +86,7 @@ along with GCC; see the file COPYING3. If not see /* Protect cleanup actions with must-not-throw regions, with a call to the given failure handler. */ -tree (*lang_protect_cleanup_actions) (void); +gimple (*lang_protect_cleanup_actions) (void); /* Return true if type A catches type B. */ int (*lang_eh_type_covers) (tree a, tree b); diff --git a/gcc/except.h b/gcc/except.h index ae3264e6f3e..8f9efb26382 100644 --- a/gcc/except.h +++ b/gcc/except.h @@ -108,20 +108,13 @@ extern void dump_eh_tree (FILE *, struct function *); extern bool eh_region_outer_p (struct function *, int, int); extern int eh_region_outermost (struct function *, int, int); -/* tree-eh.c */ -extern void add_stmt_to_eh_region_fn (struct function *, tree, int); -extern bool remove_stmt_from_eh_region_fn (struct function *, tree); -extern int lookup_stmt_eh_region_fn (struct function *, const_tree); -extern int lookup_stmt_eh_region (const_tree); -extern bool verify_eh_edges (tree); - /* If non-NULL, this is a function that returns an expression to be executed if an unhandled exception is propagated out of a cleanup region. For example, in C++, an exception thrown by a destructor during stack unwinding is required to result in a call to `std::terminate', so the C++ version of this function returns a CALL_EXPR for `std::terminate'. */ -extern tree (*lang_protect_cleanup_actions) (void); +extern gimple (*lang_protect_cleanup_actions) (void); /* Return true if type A catches type B. */ extern int (*lang_eh_type_covers) (tree a, tree b); @@ -175,7 +168,7 @@ extern tree (*lang_eh_runtime_type) (tree); struct throw_stmt_node GTY(()) { - tree stmt; + gimple stmt; int region_nr; }; diff --git a/gcc/expr.c b/gcc/expr.c index e7c24e2b838..4984780fe32 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6539,9 +6539,6 @@ safe_from_p (const_rtx x, tree exp, int top_p) case tcc_type: /* Should never get a type here. */ gcc_unreachable (); - - case tcc_gimple_stmt: - gcc_unreachable (); } /* If we have an rtl, find any enclosed object. Then see if we conflict @@ -7048,8 +7045,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, /* Handle ERROR_MARK before anybody tries to access its type. */ if (TREE_CODE (exp) == ERROR_MARK - || TREE_CODE (exp) == PREDICT_EXPR - || (!GIMPLE_TUPLE_P (exp) && TREE_CODE (TREE_TYPE (exp)) == ERROR_MARK)) + || (TREE_CODE (TREE_TYPE (exp)) == ERROR_MARK)) { ret = CONST0_RTX (tmode); return ret ? ret : const0_rtx; @@ -7057,7 +7053,8 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, if (flag_non_call_exceptions) { - rn = lookup_stmt_eh_region (exp); + rn = lookup_expr_eh_region (exp); + /* If rn < 0, then either (1) tree-ssa not used or (2) doesn't throw. */ if (rn >= 0) last = get_last_insn (); @@ -7131,18 +7128,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, type) \ : (expr)) - if (GIMPLE_STMT_P (exp)) - { - type = void_type_node; - mode = VOIDmode; - unsignedp = 0; - } - else - { - type = TREE_TYPE (exp); - mode = TYPE_MODE (type); - unsignedp = TYPE_UNSIGNED (type); - } + type = TREE_TYPE (exp); + mode = TYPE_MODE (type); + unsignedp = TYPE_UNSIGNED (type); ignore = (target == const0_rtx || ((code == NOP_EXPR || code == CONVERT_EXPR @@ -9089,16 +9077,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, { tree lhs = TREE_OPERAND (exp, 0); tree rhs = TREE_OPERAND (exp, 1); - gcc_assert (ignore); - expand_assignment (lhs, rhs, false); - return const0_rtx; - } - - case GIMPLE_MODIFY_STMT: - { - tree lhs = GIMPLE_STMT_OPERAND (exp, 0); - tree rhs = GIMPLE_STMT_OPERAND (exp, 1); - gcc_assert (ignore); /* Check for |= or &= of a bitfield of size one into another bitfield @@ -9358,17 +9336,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, case VEC_PACK_TRUNC_EXPR: case VEC_PACK_SAT_EXPR: case VEC_PACK_FIX_TRUNC_EXPR: - { - mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))); - goto binop; - } - - case OMP_ATOMIC_LOAD: - case OMP_ATOMIC_STORE: - /* OMP expansion is not run when there were errors, so these codes - can get here. */ - gcc_assert (errorcount != 0); - return NULL_RTX; + mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))); + goto binop; default: return lang_hooks.expand_expr (exp, original_target, tmode, diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e1e04bb625d..f8085dc3709 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "langhooks.h" #include "md5.h" +#include "gimple.h" /* Nonzero if we are folding constants inside an initializer; zero otherwise. */ @@ -949,7 +950,7 @@ fold_defer_overflow_warnings (void) deferred code. */ void -fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code) +fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code) { const char *warnmsg; location_t locus; @@ -971,7 +972,7 @@ fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code) if (!issue || warnmsg == NULL) return; - if (stmt != NULL_TREE && TREE_NO_WARNING (stmt)) + if (gimple_no_warning_p (stmt)) return; /* Use the smallest code level when deciding to issue the @@ -982,10 +983,10 @@ fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code) if (!issue_strict_overflow_warning (code)) return; - if (stmt == NULL_TREE || !expr_has_location (stmt)) + if (stmt == NULL) locus = input_location; else - locus = expr_location (stmt); + locus = gimple_location (stmt); warning (OPT_Wstrict_overflow, "%H%s", &locus, warnmsg); } @@ -995,7 +996,7 @@ fold_undefer_overflow_warnings (bool issue, const_tree stmt, int code) void fold_undefer_and_ignore_overflow_warnings (void) { - fold_undefer_overflow_warnings (false, NULL_TREE, 0); + fold_undefer_overflow_warnings (false, NULL, 0); } /* Whether we are deferring overflow warnings. */ @@ -2639,7 +2640,7 @@ fold_convert (tree type, tree arg) case VOID_TYPE: tem = fold_ignored_result (arg); - if (TREE_CODE (tem) == GIMPLE_MODIFY_STMT) + if (TREE_CODE (tem) == MODIFY_EXPR) return tem; return fold_build1 (NOP_EXPR, type, tem); @@ -2682,7 +2683,6 @@ maybe_lvalue_p (const_tree x) case WITH_CLEANUP_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR: - case GIMPLE_MODIFY_STMT: case TARGET_EXPR: case COND_EXPR: case BIND_EXPR: @@ -7847,17 +7847,16 @@ fold_unary (enum tree_code code, tree type, tree op0) return fold_convert (type, fold_addr_expr (base)); } - if ((TREE_CODE (op0) == MODIFY_EXPR - || TREE_CODE (op0) == GIMPLE_MODIFY_STMT) - && TREE_CONSTANT (GENERIC_TREE_OPERAND (op0, 1)) + if (TREE_CODE (op0) == MODIFY_EXPR + && TREE_CONSTANT (TREE_OPERAND (op0, 1)) /* Detect assigning a bitfield. */ - && !(TREE_CODE (GENERIC_TREE_OPERAND (op0, 0)) == COMPONENT_REF + && !(TREE_CODE (TREE_OPERAND (op0, 0)) == COMPONENT_REF && DECL_BIT_FIELD - (TREE_OPERAND (GENERIC_TREE_OPERAND (op0, 0), 1)))) + (TREE_OPERAND (TREE_OPERAND (op0, 0), 1)))) { /* Don't leave an assignment inside a conversion unless assigning a bitfield. */ - tem = fold_build1 (code, type, GENERIC_TREE_OPERAND (op0, 1)); + tem = fold_build1 (code, type, TREE_OPERAND (op0, 1)); /* First do the assignment, then return converted constant. */ tem = build2 (COMPOUND_EXPR, TREE_TYPE (tem), op0, tem); TREE_NO_WARNING (tem) = 1; @@ -9249,8 +9248,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) tree t1 = NULL_TREE; bool strict_overflow_p; - gcc_assert ((IS_EXPR_CODE_CLASS (kind) - || IS_GIMPLE_STMT_CODE_CLASS (kind)) + gcc_assert (IS_EXPR_CODE_CLASS (kind) && TREE_CODE_LENGTH (code) == 2 && op0 != NULL_TREE && op1 != NULL_TREE); @@ -13169,8 +13167,7 @@ fold (tree expr) return expr; } - if (IS_EXPR_CODE_CLASS (kind) - || IS_GIMPLE_STMT_CODE_CLASS (kind)) + if (IS_EXPR_CODE_CLASS (kind)) { tree type = TREE_TYPE (t); tree op0, op1, op2; @@ -14110,7 +14107,7 @@ tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p) *STRICT_OVERFLOW_P. */ bool -tree_call_nonnegative_warnv_p (enum tree_code code, tree type, tree fndecl, +tree_call_nonnegative_warnv_p (tree type, tree fndecl, tree arg0, tree arg1, bool *strict_overflow_p) { if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) @@ -14231,7 +14228,7 @@ tree_call_nonnegative_warnv_p (enum tree_code code, tree type, tree fndecl, default: break; } - return tree_simple_nonnegative_warnv_p (code, + return tree_simple_nonnegative_warnv_p (CALL_EXPR, type); } @@ -14273,10 +14270,9 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p) else break; } - if ((TREE_CODE (t) == MODIFY_EXPR - || TREE_CODE (t) == GIMPLE_MODIFY_STMT) - && GENERIC_TREE_OPERAND (t, 0) == temp) - return tree_expr_nonnegative_warnv_p (GENERIC_TREE_OPERAND (t, 1), + if (TREE_CODE (t) == MODIFY_EXPR + && TREE_OPERAND (t, 0) == temp) + return tree_expr_nonnegative_warnv_p (TREE_OPERAND (t, 1), strict_overflow_p); return false; @@ -14287,8 +14283,7 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p) tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE; tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE; - return tree_call_nonnegative_warnv_p (TREE_CODE (t), - TREE_TYPE (t), + return tree_call_nonnegative_warnv_p (TREE_TYPE (t), get_callee_fndecl (t), arg0, arg1, @@ -14296,8 +14291,7 @@ tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p) } case COMPOUND_EXPR: case MODIFY_EXPR: - case GIMPLE_MODIFY_STMT: - return tree_expr_nonnegative_warnv_p (GENERIC_TREE_OPERAND (t, 1), + return tree_expr_nonnegative_warnv_p (TREE_OPERAND (t, 1), strict_overflow_p); case BIND_EXPR: return tree_expr_nonnegative_warnv_p (expr_last (TREE_OPERAND (t, 1)), @@ -14672,9 +14666,8 @@ tree_expr_nonzero_warnv_p (tree t, bool *strict_overflow_p) case COMPOUND_EXPR: case MODIFY_EXPR: - case GIMPLE_MODIFY_STMT: case BIND_EXPR: - return tree_expr_nonzero_warnv_p (GENERIC_TREE_OPERAND (t, 1), + return tree_expr_nonzero_warnv_p (TREE_OPERAND (t, 1), strict_overflow_p); case SAVE_EXPR: diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fd3cff552d3..cfcfa12530a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,92 @@ +2008-07-28 Richard Guenther + + Merge from gimple-tuples-branch. + + 2008-07-18 Aldy Hernandez + + * trans-expr.c: Include gimple.h instead of tree-gimple.h. + * trans-array.c: Same. + * trans-openmp.c: Same. + * trans-stmt.c: Same. + * f95-lang.c: Same. + * trans-io.c: Same. + * trans-decl.c: Same. + * trans-intrinsic.c: Same. + * trans.c: Same. Include tree-iterator.h. + * Make-lang.in (trans.o): Depend on tree-iterator.h + + 2008-07-14 Aldy Hernandez + + * trans-array.h (gfc_conv_descriptor_data_set_internal): + Rename to gfc_conv_descriptor_data_set. + (gfc_conv_descriptor_data_set_tuples): Remove. + * trans-array.c (gfc_conv_descriptor_data_get): Rename + from gfc_conv_descriptor_data_set_internal. + Remove last argument to gfc_add_modify. + (gfc_trans_allocate_array_storage): Rename gfc_add_modify_expr to + gfc_add_modify. + (gfc_trans_create_temp_array): Same. + (gfc_conv_array_transpose): Same. + (gfc_grow_array): Same. + (gfc_put_offset_into_var): Same. + (gfc_trans_array_ctor_element): Same. + (gfc_trans_array_constructor_subarray): Same. + (gfc_trans_array_constructor_value): Same. + (gfc_trans_scalarized_loop_end): Same. + (gfc_array_init_size): Same. + (gfc_array_allocate): Same. + (gfc_trans_array_bounds): Same. + (gfc_trans_auto_array_allocation): Same. + (gfc_trans_g77_array): Same. + (gfc_trans_dummy_array_bias): Same. + (gfc_conv_expr_descriptor): Same. + (structure_alloc_comps): Same. + * trans-expr.c: Same. + * trans-openmp.c (gfc_omp_clause_default_ctor): Same. + Rename gfc_conv_descriptor_data_set_tuples to + gfc_conv_descriptor_data_set. + (gfc_omp_clause_copy_ctor): Change build_gimple_modify_stmt to + build2_v. + (gfc_omp_clause_assign_op): Same. + (gfc_trans_omp_array_reduction): Rename gfc_add_modify_expr to + gfc_add_modify. + (gfc_trans_omp_atomic): Same. + (gfc_trans_omp_do): Same. Change GIMPLE_MODIFY_STMT to MODIFY_EXPR. + Rename gfc_add_modify_stmt to gfc_add_modify. + * trans-stmt.c: Rename gfc_add_modify_expr to + gfc_add_modify. + * trans.c: Rename gfc_add_modify_expr to + gfc_add_modify. + (gfc_add_modify): Remove last argument. + Rename GIMPLE_MODIFY_STMT to MODIFY_EXPR. + * trans.h: Remove gfc_add_modify_expr, gfc_add_modify_stmt. + Add prototype for gfc_add_modify. + * f95-lang.c (union lang_tree_node): Rename GENERIC_NEXT to TREE_CHAIN. + * trans-decl.c: Rename gfc_add_modify_stmt to gfc_add_modify. + * trans-io.c: Same. + * trans-intrinsic.c: Same. + + 2008-02-25 Aldy Hernandez + + * Make-lang.in (fortran-warn): Add -Wno-format. + + 2008-02-19 Diego Novillo + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00804.html + + * fortran/Make-lang.in (fortran-warn): Remove. + + 2007-11-22 Aldy Hernandez + + * trans-expr.c (gfc_trans_string_copy): Use "void *" when building a + memset. + + 2007-11-10 Aldy Hernandez + + * Make-lang.in (fortran-warn): Set to -Wno-format. + * trans.c (gfc_trans_code): Update comment to say GENERIC. + Call tree_annotate_all_with_locus instead of annotate_all_with_locus. + 2008-07-27 Tobias Burnus PR fortran/36132 diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index b0944c94308..77ddb6ae5e0 100644 --- a/gcc/fortran/Make-lang.in +++ b/gcc/fortran/Make-lang.in @@ -47,6 +47,7 @@ GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed # Use strict warnings for this front end. fortran-warn = $(STRICT_WARN) +fortran-warn += -Wno-format -Wno-missing-format-attribute -Wno-uninitialized # FIXME tuples: Do not merge. # These are the groups of object files we have. The F95_PARSER_OBJS are # all the front end files, the F95_OBJS are the files for the translation @@ -311,9 +312,9 @@ fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \ $(BUILTINS_DEF) fortran/types.def fortran/scanner.o: toplev.h fortran/cpp.h fortran/convert.o: $(GFORTRAN_TRANS_DEPS) -fortran/trans.o: $(GFORTRAN_TRANS_DEPS) +fortran/trans.o: $(GFORTRAN_TRANS_DEPS) tree-iterator.h fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \ - $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \ + $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(GIMPLE_H) \ $(TREE_DUMP_H) fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \ $(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H) dwarf2out.h diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 941f7cd47d2..d2768b112dd 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "flags.h" #include "langhooks.h" #include "langhooks-def.h" @@ -62,7 +62,7 @@ GTY(()) union lang_tree_node GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), - chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.generic)"))) + chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) { union tree_node GTY((tag ("0"), diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 14bab8ead53..fe6b63de90b 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -80,7 +80,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -161,12 +161,10 @@ gfc_conv_descriptor_data_get (tree desc) This function gets called through the following macros: gfc_conv_descriptor_data_set - gfc_conv_descriptor_data_set_tuples. */ + gfc_conv_descriptor_data_set. */ void -gfc_conv_descriptor_data_set_internal (stmtblock_t *block, - tree desc, tree value, - bool tuples_p) +gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value) { tree field, type, t; @@ -177,7 +175,7 @@ gfc_conv_descriptor_data_set_internal (stmtblock_t *block, gcc_assert (DATA_FIELD == 0); t = fold_build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE); - gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value), tuples_p); + gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value)); } @@ -547,7 +545,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, /* The offset is zero because we create temporaries with a zero lower bound. */ tmp = gfc_conv_descriptor_offset (desc); - gfc_add_modify_expr (pre, tmp, gfc_index_zero_node); + gfc_add_modify (pre, tmp, gfc_index_zero_node); if (dealloc && !onstack) { @@ -627,7 +625,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, /* Fill in the array dtype. */ tmp = gfc_conv_descriptor_dtype (desc); - gfc_add_modify_expr (pre, tmp, gfc_get_dtype (TREE_TYPE (desc))); + gfc_add_modify (pre, tmp, gfc_get_dtype (TREE_TYPE (desc))); /* Fill in the bounds and stride. This is a packed array, so: @@ -661,13 +659,13 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, /* Store the stride and bound components in the descriptor. */ tmp = gfc_conv_descriptor_stride (desc, gfc_rank_cst[n]); - gfc_add_modify_expr (pre, tmp, size); + gfc_add_modify (pre, tmp, size); tmp = gfc_conv_descriptor_lbound (desc, gfc_rank_cst[n]); - gfc_add_modify_expr (pre, tmp, gfc_index_zero_node); + gfc_add_modify (pre, tmp, gfc_index_zero_node); tmp = gfc_conv_descriptor_ubound (desc, gfc_rank_cst[n]); - gfc_add_modify_expr (pre, tmp, loop->to[n]); + gfc_add_modify (pre, tmp, loop->to[n]); tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, loop->to[n], gfc_index_one_node); @@ -752,7 +750,7 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) se->expr = dest; /* Copy across the dtype field. */ - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_dtype (dest), gfc_conv_descriptor_dtype (src)); @@ -769,15 +767,15 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) dest_index = gfc_rank_cst[n]; src_index = gfc_rank_cst[1 - n]; - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_stride (dest, dest_index), gfc_conv_descriptor_stride (src, src_index)); - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_lbound (dest, dest_index), gfc_conv_descriptor_lbound (src, src_index)); - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_ubound (dest, dest_index), gfc_conv_descriptor_ubound (src, src_index)); @@ -803,7 +801,7 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) else dest_info->offset = gfc_index_zero_node; - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_offset (dest), dest_info->offset); @@ -847,7 +845,7 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra) /* Add EXTRA to the upper bound. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ubound, extra); - gfc_add_modify_expr (pblock, ubound, tmp); + gfc_add_modify (pblock, ubound, tmp); /* Get the value of the current data pointer. */ arg0 = gfc_conv_descriptor_data_get (desc); @@ -957,7 +955,7 @@ gfc_put_offset_into_var (stmtblock_t * pblock, tree * poffset, /* We should have already created the offset variable. We cannot create it here because we may be in an inner scope. */ gcc_assert (*offsetvar != NULL_TREE); - gfc_add_modify_expr (pblock, *offsetvar, *poffset); + gfc_add_modify (pblock, *offsetvar, *poffset); *poffset = *offsetvar; TREE_USED (*offsetvar) = 1; } @@ -996,7 +994,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { /* The temporary is an array of pointers. */ se->expr = fold_convert (TREE_TYPE (tmp), se->expr); - gfc_add_modify_expr (&se->pre, tmp, se->expr); + gfc_add_modify (&se->pre, tmp, se->expr); } else { @@ -1011,7 +1009,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { if (first_len) { - gfc_add_modify_expr (&se->pre, first_len_val, + gfc_add_modify (&se->pre, first_len_val, se->string_length); first_len = false; } @@ -1033,7 +1031,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { /* TODO: Should the frontend already have done this conversion? */ se->expr = fold_convert (TREE_TYPE (tmp), se->expr); - gfc_add_modify_expr (&se->pre, tmp, se->expr); + gfc_add_modify (&se->pre, tmp, se->expr); } gfc_add_block_to_block (pblock, &se->pre); @@ -1104,7 +1102,7 @@ gfc_trans_array_constructor_subarray (stmtblock_t * pblock, /* Increment the offset. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, *poffset, gfc_index_one_node); - gfc_add_modify_expr (&body, *poffset, tmp); + gfc_add_modify (&body, *poffset, tmp); /* Finish the loop. */ gfc_trans_scalarizing_loops (&loop, &body); @@ -1243,7 +1241,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, } if (!INTEGER_CST_P (*poffset)) { - gfc_add_modify_expr (&body, *offsetvar, *poffset); + gfc_add_modify (&body, *offsetvar, *poffset); *poffset = *offsetvar; } } @@ -1289,13 +1287,13 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, /* Make a temporary, store the current value in that and return it, once the loop is done. */ tmp_loopvar = gfc_create_var (TREE_TYPE (loopvar), "loopvar"); - gfc_add_modify_expr (pblock, tmp_loopvar, loopvar); + gfc_add_modify (pblock, tmp_loopvar, loopvar); /* Initialize the loop. */ gfc_init_se (&se, NULL); gfc_conv_expr_val (&se, c->iterator->start); gfc_add_block_to_block (pblock, &se.pre); - gfc_add_modify_expr (pblock, loopvar, se.expr); + gfc_add_modify (pblock, loopvar, se.expr); gfc_init_se (&se, NULL); gfc_conv_expr_val (&se, c->iterator->end); @@ -1348,7 +1346,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, /* Increase loop variable by step. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (loopvar), loopvar, step); - gfc_add_modify_expr (&body, loopvar, tmp); + gfc_add_modify (&body, loopvar, tmp); /* Finish the loop. */ tmp = gfc_finish_block (&body); @@ -1360,7 +1358,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, gfc_add_expr_to_block (pblock, tmp); /* Restore the original value of the loop counter. */ - gfc_add_modify_expr (pblock, loopvar, tmp_loopvar); + gfc_add_modify (pblock, loopvar, tmp_loopvar); } } mpz_clear (size); @@ -2640,7 +2638,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n, loopbody = gfc_finish_block (pbody); /* Initialize the loopvar. */ - gfc_add_modify_expr (&loop->code[n], loop->loopvar[n], loop->from[n]); + gfc_add_modify (&loop->code[n], loop->loopvar[n], loop->from[n]); exit_label = gfc_build_label_decl (NULL_TREE); @@ -2661,7 +2659,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n, /* Increment the loopvar. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, loop->loopvar[n], gfc_index_one_node); - gfc_add_modify_expr (&block, loop->loopvar[n], tmp); + gfc_add_modify (&block, loop->loopvar[n], tmp); /* Build the loop. */ tmp = gfc_finish_block (&block); @@ -3621,7 +3619,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, /* Set the dtype. */ tmp = gfc_conv_descriptor_dtype (descriptor); - gfc_add_modify_expr (pblock, tmp, gfc_get_dtype (TREE_TYPE (descriptor))); + gfc_add_modify (pblock, tmp, gfc_get_dtype (TREE_TYPE (descriptor))); or_expr = NULL_TREE; @@ -3652,7 +3650,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, } } tmp = gfc_conv_descriptor_lbound (descriptor, gfc_rank_cst[n]); - gfc_add_modify_expr (pblock, tmp, se.expr); + gfc_add_modify (pblock, tmp, se.expr); /* Work out the offset for this component. */ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, se.expr, stride); @@ -3669,11 +3667,11 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, gfc_add_block_to_block (pblock, &se.pre); tmp = gfc_conv_descriptor_ubound (descriptor, gfc_rank_cst[n]); - gfc_add_modify_expr (pblock, tmp, se.expr); + gfc_add_modify (pblock, tmp, se.expr); /* Store the stride. */ tmp = gfc_conv_descriptor_stride (descriptor, gfc_rank_cst[n]); - gfc_add_modify_expr (pblock, tmp, stride); + gfc_add_modify (pblock, tmp, stride); /* Calculate the size of this dimension. */ size = fold_build2 (PLUS_EXPR, gfc_array_index_type, se.expr, size); @@ -3713,11 +3711,11 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, var = gfc_create_var (TREE_TYPE (size), "size"); gfc_start_block (&thenblock); - gfc_add_modify_expr (&thenblock, var, gfc_index_zero_node); + gfc_add_modify (&thenblock, var, gfc_index_zero_node); thencase = gfc_finish_block (&thenblock); gfc_start_block (&elseblock); - gfc_add_modify_expr (&elseblock, var, size); + gfc_add_modify (&elseblock, var, size); elsecase = gfc_finish_block (&elseblock); tmp = gfc_evaluate_now (or_expr, pblock); @@ -3803,7 +3801,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat) gfc_add_expr_to_block (&se->pre, tmp); tmp = gfc_conv_descriptor_offset (se->expr); - gfc_add_modify_expr (&se->pre, tmp, offset); + gfc_add_modify (&se->pre, tmp, offset); if (expr->ts.type == BT_DERIVED && expr->ts.derived->attr.alloc_comp) @@ -4001,7 +3999,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_init_se (&se, NULL); gfc_conv_expr_type (&se, as->lower[dim], gfc_array_index_type); gfc_add_block_to_block (pblock, &se.pre); - gfc_add_modify_expr (pblock, lbound, se.expr); + gfc_add_modify (pblock, lbound, se.expr); } ubound = GFC_TYPE_ARRAY_UBOUND (type, dim); if (as->upper[dim] && !INTEGER_CST_P (ubound)) @@ -4009,7 +4007,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_init_se (&se, NULL); gfc_conv_expr_type (&se, as->upper[dim], gfc_array_index_type); gfc_add_block_to_block (pblock, &se.pre); - gfc_add_modify_expr (pblock, ubound, se.expr); + gfc_add_modify (pblock, ubound, se.expr); } /* The offset of this dimension. offset = offset - lbound * stride. */ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, lbound, size); @@ -4029,7 +4027,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ubound, tmp); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp); if (stride) - gfc_add_modify_expr (pblock, stride, tmp); + gfc_add_modify (pblock, stride, tmp); else stride = gfc_evaluate_now (tmp, pblock); @@ -4039,7 +4037,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, stride, gfc_index_zero_node); tmp = fold_build3 (COND_EXPR, gfc_array_index_type, tmp, stride, gfc_index_zero_node); - gfc_add_modify_expr (pblock, stride, tmp); + gfc_add_modify (pblock, stride, tmp); } size = stride; @@ -4112,7 +4110,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) if (sym->attr.cray_pointee) { if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_add_expr_to_block (&block, fnbody); return gfc_finish_block (&block); } @@ -4125,11 +4123,11 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) /* Allocate memory to hold the data. */ tmp = gfc_call_malloc (&block, TREE_TYPE (decl), size); - gfc_add_modify_expr (&block, decl, tmp); + gfc_add_modify (&block, decl, tmp); /* Set offset of the array. */ if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); /* Automatic arrays should not have initializers. */ @@ -4177,13 +4175,13 @@ gfc_trans_g77_array (gfc_symbol * sym, tree body) /* Set the offset. */ if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); /* Set the pointer itself if we aren't using the parameter directly. */ if (TREE_CODE (parm) != PARM_DECL) { tmp = convert (TREE_TYPE (parm), GFC_DECL_SAVED_DESCRIPTOR (parm)); - gfc_add_modify_expr (&block, parm, tmp); + gfc_add_modify (&block, parm, tmp); } stmt = gfc_finish_block (&block); @@ -4278,7 +4276,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) TREE_USED (partial) = 1; tmp = gfc_conv_descriptor_stride (dumdesc, gfc_rank_cst[0]); tmp = fold_build2 (EQ_EXPR, boolean_type_node, tmp, gfc_index_one_node); - gfc_add_modify_expr (&block, partial, tmp); + gfc_add_modify (&block, partial, tmp); } else { @@ -4298,7 +4296,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tmp = fold_build3 (COND_EXPR, gfc_array_index_type, tmp, gfc_index_one_node, stride); stride = GFC_TYPE_ARRAY_STRIDE (type, 0); - gfc_add_modify_expr (&block, stride, tmp); + gfc_add_modify (&block, stride, tmp); /* Allow the user to disable array repacking. */ stmt_unpacked = NULL_TREE; @@ -4332,7 +4330,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) } else tmp = stmt_packed != NULL_TREE ? stmt_packed : stmt_unpacked; - gfc_add_modify_expr (&block, tmpdesc, fold_convert (type, tmp)); + gfc_add_modify (&block, tmpdesc, fold_convert (type, tmp)); offset = gfc_index_zero_node; size = gfc_index_one_node; @@ -4359,7 +4357,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) gfc_conv_expr_type (&se, sym->as->lower[n], gfc_array_index_type); gfc_add_block_to_block (&block, &se.pre); - gfc_add_modify_expr (&block, lbound, se.expr); + gfc_add_modify (&block, lbound, se.expr); } ubound = GFC_TYPE_ARRAY_UBOUND (type, n); @@ -4373,7 +4371,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) gfc_conv_expr_type (&se, sym->as->upper[n], gfc_array_index_type); gfc_add_block_to_block (&block, &se.pre); - gfc_add_modify_expr (&block, ubound, se.expr); + gfc_add_modify (&block, ubound, se.expr); } /* Check the sizes match. */ @@ -4400,7 +4398,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound); tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp, lbound); - gfc_add_modify_expr (&block, ubound, tmp); + gfc_add_modify (&block, ubound, tmp); } /* The offset of this dimension. offset = offset - lbound * stride. */ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, lbound, stride); @@ -4440,7 +4438,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) stmt_unpacked, stmt_packed); else tmp = (stmt_packed != NULL_TREE) ? stmt_packed : stmt_unpacked; - gfc_add_modify_expr (&block, stride, tmp); + gfc_add_modify (&block, stride, tmp); } } else @@ -4456,14 +4454,14 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) ubound, tmp); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, GFC_TYPE_ARRAY_STRIDE (type, n), tmp); - gfc_add_modify_expr (&block, stride, tmp); + gfc_add_modify (&block, stride, tmp); } } } /* Set the offset. */ if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_trans_vla_type_sizes (sym, &block); @@ -4758,7 +4756,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) if (se->direct_byref) { /* Copy the descriptor for pointer assignments. */ - gfc_add_modify_expr (&se->pre, se->expr, desc); + gfc_add_modify (&se->pre, se->expr, desc); /* Add any offsets from subreferences. */ gfc_get_dataptr_offset (&se->pre, se->expr, desc, NULL_TREE, @@ -4991,7 +4989,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Set the dtype. */ tmp = gfc_conv_descriptor_dtype (parm); - gfc_add_modify_expr (&loop.pre, tmp, gfc_get_dtype (parmtype)); + gfc_add_modify (&loop.pre, tmp, gfc_get_dtype (parmtype)); /* Set offset for assignments to pointer only to zero if it is not the full array. */ @@ -5060,11 +5058,11 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) from = gfc_index_one_node; } tmp = gfc_conv_descriptor_lbound (parm, gfc_rank_cst[dim]); - gfc_add_modify_expr (&loop.pre, tmp, from); + gfc_add_modify (&loop.pre, tmp, from); /* Set the new upper bound. */ tmp = gfc_conv_descriptor_ubound (parm, gfc_rank_cst[dim]); - gfc_add_modify_expr (&loop.pre, tmp, to); + gfc_add_modify (&loop.pre, tmp, to); /* Multiply the stride by the section stride to get the total stride. */ @@ -5089,7 +5087,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Store the new stride. */ tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]); - gfc_add_modify_expr (&loop.pre, tmp, stride); + gfc_add_modify (&loop.pre, tmp, stride); dim++; } @@ -5106,14 +5104,14 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) { /* Set the offset. */ tmp = gfc_conv_descriptor_offset (parm); - gfc_add_modify_expr (&loop.pre, tmp, base); + gfc_add_modify (&loop.pre, tmp, base); } else { /* Only the callee knows what the correct offset it, so just set it to zero here. */ tmp = gfc_conv_descriptor_offset (parm); - gfc_add_modify_expr (&loop.pre, tmp, gfc_index_zero_node); + gfc_add_modify (&loop.pre, tmp, gfc_index_zero_node); } desc = parm; } @@ -5588,7 +5586,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, { rank = c->as ? c->as->rank : 0; tmp = fold_convert (TREE_TYPE (dcmp), comp); - gfc_add_modify_expr (&fnblock, dcmp, tmp); + gfc_add_modify (&fnblock, dcmp, tmp); tmp = structure_alloc_comps (c->ts.derived, comp, dcmp, rank, purpose); gfc_add_expr_to_block (&fnblock, tmp); diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h index 145f4a82565..18de51c8437 100644 --- a/gcc/fortran/trans-array.h +++ b/gcc/fortran/trans-array.h @@ -120,11 +120,7 @@ tree gfc_conv_array_ubound (tree, int); /* Build expressions for accessing components of an array descriptor. */ tree gfc_conv_descriptor_data_get (tree); -void gfc_conv_descriptor_data_set_internal (stmtblock_t *, tree, tree, bool); -#define gfc_conv_descriptor_data_set(BLOCK, T1, T2) \ - gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), false) -#define gfc_conv_descriptor_data_set_tuples(BLOCK, T1, T2) \ - gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), true) +void gfc_conv_descriptor_data_set (stmtblock_t *, tree, tree); tree gfc_conv_descriptor_data_addr (tree); tree gfc_conv_descriptor_offset (tree); tree gfc_conv_descriptor_dtype (tree); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index d2cb6a319c7..1dfa05cc46f 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" #include "tree-dump.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "tm.h" @@ -2576,7 +2576,7 @@ gfc_trans_assign_aux_var (gfc_symbol * sym, tree fnbody) /* Set the initial value to length. See the comments in function gfc_add_assign_aux_vars in this file. */ - gfc_add_modify_expr (&body, GFC_DECL_STRING_LEN (sym->backend_decl), + gfc_add_modify (&body, GFC_DECL_STRING_LEN (sym->backend_decl), build_int_cst (NULL_TREE, -2)); gfc_add_expr_to_block (&body, fnbody); @@ -2607,7 +2607,7 @@ gfc_trans_vla_one_sizepos (tree *tp, stmtblock_t *body) var = gfc_create_var_np (TREE_TYPE (t), NULL); gfc_add_decl_to_function (var); - gfc_add_modify_expr (body, var, val); + gfc_add_modify (body, var, val); if (TREE_CODE (t) == SAVE_EXPR) TREE_OPERAND (t, 0) = var; *tp = var; @@ -3412,7 +3412,7 @@ gfc_generate_function_code (gfc_namespace * ns) { tree alternate_return; alternate_return = gfc_get_fake_result_decl (sym, 0); - gfc_add_modify_expr (&body, alternate_return, integer_zero_node); + gfc_add_modify (&body, alternate_return, integer_zero_node); } if (ns->entries) diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index e145c0ca01c..05ee3902e34 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "toplev.h" #include "real.h" -#include "tree-gimple.h" +#include "gimple.h" #include "langhooks.h" #include "flags.h" #include "gfortran.h" @@ -115,7 +115,7 @@ gfc_make_safe_expr (gfc_se * se) /* We need a temporary for this result. */ var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); se->expr = var; } @@ -257,7 +257,7 @@ gfc_conv_string_length (gfc_charlen * cl, stmtblock_t * pblock) gfc_add_block_to_block (pblock, &se.pre); if (cl->backend_decl) - gfc_add_modify_expr (pblock, cl->backend_decl, se.expr); + gfc_add_modify (pblock, cl->backend_decl, se.expr); else cl->backend_decl = gfc_evaluate_now (se.expr, pblock); } @@ -993,7 +993,7 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) fold_build2 (MULT_EXPR, TREE_TYPE (len), len, fold_convert (TREE_TYPE (len), TYPE_SIZE (type)))); - gfc_add_modify_expr (&se->pre, var, tmp); + gfc_add_modify (&se->pre, var, tmp); /* Free the temporary afterwards. */ tmp = gfc_call_free (convert (pvoid_type_node, var)); @@ -1509,7 +1509,7 @@ gfc_get_interface_mapping_array (stmtblock_t * block, gfc_symbol * sym, type = gfc_get_nodesc_array_type (type, sym->as, packed); var = gfc_create_var (type, "ifm"); - gfc_add_modify_expr (block, var, fold_convert (type, data)); + gfc_add_modify (block, var, fold_convert (type, data)); return var; } @@ -2165,7 +2165,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, tmp_index = fold_build2 (MINUS_EXPR, gfc_array_index_type, tmp_index, rse.loop->from[0]); - gfc_add_modify_expr (&rse.loop->code[0], offset, tmp_index); + gfc_add_modify (&rse.loop->code[0], offset, tmp_index); tmp_index = fold_build2 (PLUS_EXPR, gfc_array_index_type, rse.loop->loopvar[0], offset); @@ -2895,9 +2895,9 @@ fill_with_spaces (tree start, tree type, tree size) /* Initialize variables. */ gfc_init_block (&block); i = gfc_create_var (sizetype, "i"); - gfc_add_modify_expr (&block, i, fold_convert (sizetype, size)); + gfc_add_modify (&block, i, fold_convert (sizetype, size)); el = gfc_create_var (build_pointer_type (type), "el"); - gfc_add_modify_expr (&block, el, fold_convert (TREE_TYPE (el), start)); + gfc_add_modify (&block, el, fold_convert (TREE_TYPE (el), start)); exit_label = gfc_build_label_decl (NULL_TREE); TREE_USED (exit_label) = 1; @@ -2913,14 +2913,14 @@ fill_with_spaces (tree start, tree type, tree size) gfc_add_expr_to_block (&loop, tmp); /* Assignment. */ - gfc_add_modify_expr (&loop, fold_build1 (INDIRECT_REF, type, el), + gfc_add_modify (&loop, fold_build1 (INDIRECT_REF, type, el), build_int_cst (type, lang_hooks.to_target_charset (' '))); /* Increment loop variables. */ - gfc_add_modify_expr (&loop, i, fold_build2 (MINUS_EXPR, sizetype, i, + gfc_add_modify (&loop, i, fold_build2 (MINUS_EXPR, sizetype, i, TYPE_SIZE_UNIT (type))); - gfc_add_modify_expr (&loop, el, fold_build2 (POINTER_PLUS_EXPR, + gfc_add_modify (&loop, el, fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (el), el, TYPE_SIZE_UNIT (type))); @@ -2989,7 +2989,7 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest, if (dsc != NULL_TREE && ssc != NULL_TREE && TREE_TYPE (dsc) == TREE_TYPE (ssc)) { - gfc_add_modify_expr (block, dsc, ssc); + gfc_add_modify (block, dsc, ssc); return; } @@ -3135,7 +3135,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr) gfc_conv_expr (&lse, args->expr); gfc_add_block_to_block (&se->pre, &lse.pre); - gfc_add_modify_expr (&se->pre, temp_vars[n], lse.expr); + gfc_add_modify (&se->pre, temp_vars[n], lse.expr); gfc_add_block_to_block (&se->pre, &lse.post); } @@ -3420,7 +3420,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) se.want_pointer = 1; gfc_conv_expr (&se, expr); gfc_add_block_to_block (&block, &se.pre); - gfc_add_modify_expr (&block, dest, + gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest), se.expr)); gfc_add_block_to_block (&block, &se.post); } @@ -3441,7 +3441,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) gfc_add_block_to_block (&block, &se.pre); tmp = fold_convert (TREE_TYPE (dest), se.expr); - gfc_add_modify_expr (&block, dest, tmp); + gfc_add_modify (&block, dest, tmp); if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp) tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest, @@ -3459,7 +3459,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) /* Shift the lbound and ubound of temporaries to being unity, rather than zero, based. Calculate the offset for all cases. */ offset = gfc_conv_descriptor_offset (dest); - gfc_add_modify_expr (&block, offset, gfc_index_zero_node); + gfc_add_modify (&block, offset, gfc_index_zero_node); tmp2 =gfc_create_var (gfc_array_index_type, NULL); for (n = 0; n < expr->rank; n++) { @@ -3470,21 +3470,21 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) tmp = gfc_conv_descriptor_ubound (dest, gfc_rank_cst[n]); span = fold_build2 (MINUS_EXPR, gfc_array_index_type, tmp, gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n])); - gfc_add_modify_expr (&block, tmp, + gfc_add_modify (&block, tmp, fold_build2 (PLUS_EXPR, gfc_array_index_type, span, gfc_index_one_node)); tmp = gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n]); - gfc_add_modify_expr (&block, tmp, gfc_index_one_node); + gfc_add_modify (&block, tmp, gfc_index_one_node); } tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n]), gfc_conv_descriptor_stride (dest, gfc_rank_cst[n])); - gfc_add_modify_expr (&block, tmp2, tmp); + gfc_add_modify (&block, tmp2, tmp); tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp2); - gfc_add_modify_expr (&block, offset, tmp); + gfc_add_modify (&block, offset, tmp); } } else @@ -3499,7 +3499,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) { gfc_init_se (&se, NULL); gfc_conv_expr (&se, expr); - gfc_add_modify_expr (&block, dest, + gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest), se.expr)); } else @@ -3745,7 +3745,7 @@ gfc_conv_expr_val (gfc_se * se, gfc_expr * expr) if (se->post.head) { val = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, val, se->expr); + gfc_add_modify (&se->pre, val, se->expr); se->expr = val; gfc_add_block_to_block (&se->pre, &se->post); } @@ -3791,7 +3791,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr) if (se->post.head) { var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); gfc_add_block_to_block (&se->pre, &se->post); se->expr = var; } @@ -3805,7 +3805,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr) se->want_pointer = 1; gfc_conv_expr (se, expr); var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); se->expr = var; return; } @@ -3826,7 +3826,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr) else { var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); } gfc_add_block_to_block (&se->pre, &se->post); @@ -3879,7 +3879,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_add_block_to_block (&block, &lse.pre); gfc_add_block_to_block (&block, &rse.pre); - gfc_add_modify_expr (&block, lse.expr, + gfc_add_modify (&block, lse.expr, fold_convert (TREE_TYPE (lse.expr), rse.expr)); gfc_add_block_to_block (&block, &rse.post); gfc_add_block_to_block (&block, &lse.post); @@ -3912,7 +3912,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) tmp = fold_convert (gfc_array_index_type, size_in_bytes (tmp)); if (!INTEGER_CST_P (tmp)) gfc_add_block_to_block (&lse.post, &rse.pre); - gfc_add_modify_expr (&lse.post, GFC_DECL_SPAN(decl), tmp); + gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp); } break; @@ -3926,7 +3926,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) lse.expr = tmp; lse.direct_byref = 1; gfc_conv_expr_descriptor (&lse, expr2, rss); - gfc_add_modify_expr (&lse.pre, desc, tmp); + gfc_add_modify (&lse.pre, desc, tmp); break; } gfc_add_block_to_block (&block, &lse.pre); @@ -4038,7 +4038,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts, gfc_add_block_to_block (&block, &rse->pre); gfc_add_block_to_block (&block, &lse->pre); - gfc_add_modify_expr (&block, lse->expr, + gfc_add_modify (&block, lse->expr, fold_convert (TREE_TYPE (lse->expr), rse->expr)); /* Do a deep copy if the rhs is a variable, if it is not the @@ -4055,7 +4055,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts, gfc_add_block_to_block (&block, &lse->pre); gfc_add_block_to_block (&block, &rse->pre); - gfc_add_modify_expr (&block, lse->expr, + gfc_add_modify (&block, lse->expr, fold_convert (TREE_TYPE (lse->expr), rse->expr)); } diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 2dc2d4f7a98..a56f4c1fabb 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "toplev.h" #include "real.h" -#include "tree-gimple.h" +#include "gimple.h" #include "flags.h" #include "gfortran.h" #include "arith.h" @@ -1316,7 +1316,7 @@ gfc_conv_intrinsic_char (gfc_se * se, gfc_expr * expr) var = gfc_create_var (type, "char"); arg[0] = fold_build1 (NOP_EXPR, type, arg[0]); - gfc_add_modify_expr (&se->pre, var, arg[0]); + gfc_add_modify (&se->pre, var, arg[0]); se->expr = gfc_build_addr_expr (build_pointer_type (type), var); se->string_length = integer_one_node; } @@ -1479,7 +1479,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op) args[0] = gfc_evaluate_now (args[0], &se->pre); mvar = gfc_create_var (type, "M"); - gfc_add_modify_expr (&se->pre, mvar, args[0]); + gfc_add_modify (&se->pre, mvar, args[0]); for (i = 1, argexpr = argexpr->next; i < nargs; i++) { tree cond, isnan; @@ -1718,7 +1718,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) tmp = convert (type, boolean_true_node); else tmp = convert (type, boolean_false_node); - gfc_add_modify_expr (&se->pre, resvar, tmp); + gfc_add_modify (&se->pre, resvar, tmp); /* Walk the arguments. */ arrayss = gfc_walk_expr (actual->expr); @@ -1744,7 +1744,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) tmp = convert (type, boolean_false_node); else tmp = convert (type, boolean_true_node); - gfc_add_modify_expr (&block, resvar, tmp); + gfc_add_modify (&block, resvar, tmp); /* And break out of the loop. */ tmp = build1_v (GOTO_EXPR, exit_label); @@ -1802,7 +1802,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr) type = gfc_typenode_for_spec (&expr->ts); /* Initialize the result. */ resvar = gfc_create_var (type, "count"); - gfc_add_modify_expr (&se->pre, resvar, build_int_cst (type, 0)); + gfc_add_modify (&se->pre, resvar, build_int_cst (type, 0)); /* Walk the arguments. */ arrayss = gfc_walk_expr (actual->expr); @@ -1875,7 +1875,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op) else tmp = gfc_build_const (type, integer_one_node); - gfc_add_modify_expr (&se->pre, resvar, tmp); + gfc_add_modify (&se->pre, resvar, tmp); /* Walk the arguments. */ actual = expr->value.function.actual; @@ -1932,7 +1932,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op) gfc_add_block_to_block (&block, &arrayse.pre); tmp = fold_build2 (op, type, resvar, arrayse.expr); - gfc_add_modify_expr (&block, resvar, tmp); + gfc_add_modify (&block, resvar, tmp); gfc_add_block_to_block (&block, &arrayse.post); if (maskss) @@ -1999,7 +1999,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr) else tmp = gfc_build_const (type, integer_zero_node); - gfc_add_modify_expr (&se->pre, resvar, tmp); + gfc_add_modify (&se->pre, resvar, tmp); /* Walk argument #1. */ actual = expr->value.function.actual; @@ -2056,7 +2056,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr) tmp = fold_build2 (MULT_EXPR, type, arrayse1.expr, arrayse2.expr); tmp = fold_build2 (PLUS_EXPR, type, resvar, tmp); } - gfc_add_modify_expr (&block, resvar, tmp); + gfc_add_modify (&block, resvar, tmp); /* Finish up the loop block and the loop. */ tmp = gfc_finish_block (&block); @@ -2146,7 +2146,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) possible value is HUGE in both cases. */ if (op == GT_EXPR) tmp = fold_build1 (NEGATE_EXPR, TREE_TYPE (tmp), tmp); - gfc_add_modify_expr (&se->pre, limit, tmp); + gfc_add_modify (&se->pre, limit, tmp); if (op == GT_EXPR && expr->ts.type == BT_INTEGER) tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp, @@ -2167,7 +2167,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) /* Initialize the position to zero, following Fortran 2003. We are free to do this because Fortran 95 allows the result of an entirely false mask to be processor dependent. */ - gfc_add_modify_expr (&loop.pre, pos, gfc_index_zero_node); + gfc_add_modify (&loop.pre, pos, gfc_index_zero_node); gfc_mark_ss_chain_used (arrayss, 1); if (maskss) @@ -2200,7 +2200,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) gfc_start_block (&ifblock); /* Assign the value to the limit... */ - gfc_add_modify_expr (&ifblock, limit, arrayse.expr); + gfc_add_modify (&ifblock, limit, arrayse.expr); /* Remember where we are. An offset must be added to the loop counter to obtain the required position. */ @@ -2210,11 +2210,11 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) else tmp = build_int_cst (gfc_array_index_type, 1); - gfc_add_modify_expr (&block, offset, tmp); + gfc_add_modify (&block, offset, tmp); tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (pos), loop.loopvar[0], offset); - gfc_add_modify_expr (&ifblock, pos, tmp); + gfc_add_modify (&ifblock, pos, tmp); ifbody = gfc_finish_block (&ifblock); @@ -2258,7 +2258,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) the pos variable the same way as above. */ gfc_init_block (&elseblock); - gfc_add_modify_expr (&elseblock, pos, gfc_index_zero_node); + gfc_add_modify (&elseblock, pos, gfc_index_zero_node); elsetmp = gfc_finish_block (&elseblock); tmp = build3_v (COND_EXPR, maskse.expr, tmp, elsetmp); @@ -2329,7 +2329,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op) tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp, build_int_cst (type, 1)); - gfc_add_modify_expr (&se->pre, limit, tmp); + gfc_add_modify (&se->pre, limit, tmp); /* Walk the arguments. */ actual = expr->value.function.actual; @@ -3003,12 +3003,12 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr) gfc_add_expr_to_block (&block, tmp); tmp = fold_build2 (MINUS_EXPR, integer_type_node, e, prec); - gfc_add_modify_expr (&block, e, fold_build2 (MAX_EXPR, integer_type_node, + gfc_add_modify (&block, e, fold_build2 (MAX_EXPR, integer_type_node, tmp, emin)); tmp = build_call_expr (built_in_decls[scalbn], 2, build_real_from_int_cst (type, integer_one_node), e); - gfc_add_modify_expr (&block, res, tmp); + gfc_add_modify (&block, res, tmp); /* Finish by building the IF statement. */ cond = fold_build2 (EQ_EXPR, boolean_type_node, arg, @@ -3071,7 +3071,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr) e = gfc_create_var (integer_type_node, NULL); x = gfc_create_var (type, NULL); - gfc_add_modify_expr (&se->pre, x, + gfc_add_modify (&se->pre, x, build_call_expr (built_in_decls[fabs], 1, arg)); @@ -3083,7 +3083,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr) tmp = fold_build2 (MINUS_EXPR, integer_type_node, build_int_cst (NULL_TREE, prec), e); tmp = build_call_expr (built_in_decls[scalbn], 2, x, tmp); - gfc_add_modify_expr (&block, x, tmp); + gfc_add_modify (&block, x, tmp); stmt = gfc_finish_block (&block); cond = fold_build2 (NE_EXPR, boolean_type_node, x, @@ -3300,7 +3300,7 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr) else tmp = fold_convert (gfc_array_index_type, size_in_bytes (type)); - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); /* Obtain the size of the array in bytes. */ for (n = 0; n < arg->rank; n++) @@ -3315,7 +3315,7 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr) tmp, gfc_index_one_node); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, tmp, source_bytes); - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); } se->expr = source_bytes; } @@ -3473,13 +3473,13 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) { tree idx; idx = gfc_rank_cst[n]; - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); stride = gfc_conv_descriptor_stride (argse.expr, idx); lower = gfc_conv_descriptor_lbound (argse.expr, idx); upper = gfc_conv_descriptor_ubound (argse.expr, idx); tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, upper, lower); - gfc_add_modify_expr (&argse.pre, extent, tmp); + gfc_add_modify (&argse.pre, extent, tmp); tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, extent, gfc_index_one_node); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, @@ -3487,7 +3487,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) } } - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); gfc_add_block_to_block (&se->pre, &argse.pre); gfc_add_block_to_block (&se->post, &argse.post); @@ -3522,7 +3522,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) size_in_bytes (mold_type)); dest_word_len = gfc_create_var (gfc_array_index_type, NULL); - gfc_add_modify_expr (&se->pre, dest_word_len, tmp); + gfc_add_modify (&se->pre, dest_word_len, tmp); /* Finally convert SIZE, if it is present. */ arg = arg->next; @@ -3551,8 +3551,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) else tmp = source_bytes; - gfc_add_modify_expr (&se->pre, size_bytes, tmp); - gfc_add_modify_expr (&se->pre, size_words, + gfc_add_modify (&se->pre, size_bytes, tmp); + gfc_add_modify (&se->pre, size_words, fold_build2 (CEIL_DIV_EXPR, gfc_array_index_type, size_bytes, dest_word_len)); @@ -3569,8 +3569,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) tmp, gfc_index_one_node); tmp = fold_build2 (MIN_EXPR, gfc_array_index_type, tmp, size_words); - gfc_add_modify_expr (&se->pre, size_words, tmp); - gfc_add_modify_expr (&se->pre, size_bytes, + gfc_add_modify (&se->pre, size_words, tmp); + gfc_add_modify (&se->pre, size_bytes, fold_build2 (MULT_EXPR, gfc_array_index_type, size_words, dest_word_len)); upper = fold_build2 (PLUS_EXPR, gfc_array_index_type, @@ -3971,7 +3971,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) build_int_cst (size_type_node, 0)); tmp = fold_build3 (COND_EXPR, ncopies_type, cond, build_int_cst (ncopies_type, 0), ncopies); - gfc_add_modify_expr (&se->pre, n, tmp); + gfc_add_modify (&se->pre, n, tmp); ncopies = n; /* Check that ncopies is not too large: ncopies should be less than @@ -4006,7 +4006,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) memmove (dest + (i * slen * size), src, slen*size); */ gfc_start_block (&block); count = gfc_create_var (ncopies_type, "count"); - gfc_add_modify_expr (&block, count, build_int_cst (ncopies_type, 0)); + gfc_add_modify (&block, count, build_int_cst (ncopies_type, 0)); exit_label = gfc_build_label_decl (NULL_TREE); /* Start the loop body. */ @@ -4037,7 +4037,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, ncopies_type, count, build_int_cst (TREE_TYPE (count), 1)); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); /* Build the loop. */ tmp = build1_v (LOOP_EXPR, gfc_finish_block (&body)); @@ -4101,7 +4101,7 @@ gfc_conv_intrinsic_loc (gfc_se * se, gfc_expr * expr) /* Create a temporary variable for loc return value. Without this, we get an error an ICE in gcc/expr.c(expand_expr_addr_expr_1). */ temp_var = gfc_create_var (gfc_get_int_type (gfc_index_integer_kind), NULL); - gfc_add_modify_expr (&se->pre, temp_var, se->expr); + gfc_add_modify (&se->pre, temp_var, se->expr); se->expr = temp_var; } diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 3d17a4c77da..e304d1687bf 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -450,7 +450,7 @@ set_parameter_const (stmtblock_t *block, tree var, enum iofield type, var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE); tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (p->field), var, p->field, NULL_TREE); - gfc_add_modify_expr (block, tmp, build_int_cst (TREE_TYPE (p->field), val)); + gfc_add_modify (block, tmp, build_int_cst (TREE_TYPE (p->field), val)); return p->mask; } @@ -505,7 +505,7 @@ set_parameter_value (stmtblock_t *block, tree var, enum iofield type, var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE); tmp = fold_build3 (COMPONENT_REF, dest_type, var, p->field, NULL_TREE); - gfc_add_modify_expr (block, tmp, se.expr); + gfc_add_modify (block, tmp, se.expr); return p->mask; } @@ -535,7 +535,7 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock, /* If this is for the iostat variable initialize the user variable to LIBERROR_OK which is zero. */ if (type == IOPARM_common_iostat) - gfc_add_modify_expr (block, se.expr, + gfc_add_modify (block, se.expr, build_int_cst (TREE_TYPE (se.expr), LIBERROR_OK)); } else @@ -549,13 +549,13 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock, /* If this is for the iostat variable, initialize the user variable to LIBERROR_OK which is zero. */ if (type == IOPARM_common_iostat) - gfc_add_modify_expr (block, tmpvar, + gfc_add_modify (block, tmpvar, build_int_cst (TREE_TYPE (tmpvar), LIBERROR_OK)); addr = build_fold_addr_expr (tmpvar); /* After the I/O operation, we set the variable from the temporary. */ tmp = convert (TREE_TYPE (se.expr), tmpvar); - gfc_add_modify_expr (postblock, se.expr, tmp); + gfc_add_modify (postblock, se.expr, tmp); } if (p->param_type == IOPARM_ptype_common) @@ -563,7 +563,7 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock, var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE); tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (p->field), var, p->field, NULL_TREE); - gfc_add_modify_expr (block, tmp, addr); + gfc_add_modify (block, tmp, addr); return p->mask; } @@ -672,9 +672,9 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var, fold_convert (long_integer_type_node, tmp)); gfc_free (msg); - gfc_add_modify_expr (&se.pre, io, + gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr))); - gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr)); + gfc_add_modify (&se.pre, len, GFC_DECL_STRING_LEN (se.expr)); } else { @@ -688,8 +688,8 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var, gcc_unreachable (); gfc_conv_string_parameter (&se); - gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr)); - gfc_add_modify_expr (&se.pre, len, se.string_length); + gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr)); + gfc_add_modify (&se.pre, len, se.string_length); } gfc_add_block_to_block (block, &se.pre); @@ -764,10 +764,10 @@ set_internal_unit (stmtblock_t * block, stmtblock_t * post_block, /* The cast is needed for character substrings and the descriptor data. */ - gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), tmp)); - gfc_add_modify_expr (&se.pre, len, + gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), tmp)); + gfc_add_modify (&se.pre, len, fold_convert (TREE_TYPE (len), se.string_length)); - gfc_add_modify_expr (&se.pre, desc, se.expr); + gfc_add_modify (&se.pre, desc, se.expr); gfc_add_block_to_block (block, &se.pre); gfc_add_block_to_block (post_block, &se.post); @@ -865,7 +865,7 @@ set_error_locus (stmtblock_t * block, tree var, locus * where) str = gfc_build_cstring_const (f->filename); str = gfc_build_addr_expr (pchar_type_node, str); - gfc_add_modify_expr (block, locus_file, str); + gfc_add_modify (block, locus_file, str); line = LOCATION_LINE (where->lb->location); set_parameter_const (block, var, IOPARM_common_line, line); diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 06329a98554..49fd1f6152f 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -147,7 +147,7 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) gfc_init_block (&cond_block); - gfc_add_modify_expr (&cond_block, decl, outer); + gfc_add_modify (&cond_block, decl, outer); rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; size = gfc_conv_descriptor_ubound (decl, rank); size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size, @@ -164,11 +164,11 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) ptr = gfc_allocate_array_with_status (&cond_block, build_int_cst (pvoid_type_node, 0), size, NULL); - gfc_conv_descriptor_data_set_tuples (&cond_block, decl, ptr); + gfc_conv_descriptor_data_set (&cond_block, decl, ptr); then_b = gfc_finish_block (&cond_block); gfc_init_block (&cond_block); - gfc_conv_descriptor_data_set_tuples (&cond_block, decl, null_pointer_node); + gfc_conv_descriptor_data_set (&cond_block, decl, null_pointer_node); else_b = gfc_finish_block (&cond_block); cond = fold_build2 (NE_EXPR, boolean_type_node, @@ -191,7 +191,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) if (! GFC_DESCRIPTOR_TYPE_P (type) || GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE) - return build_gimple_modify_stmt (dest, src); + return build2_v (MODIFY_EXPR, dest, src); gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_FIRSTPRIVATE); @@ -199,7 +199,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) and copied from SRC. */ gfc_start_block (&block); - gfc_add_modify_expr (&block, dest, src); + gfc_add_modify (&block, dest, src); rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; size = gfc_conv_descriptor_ubound (dest, rank); size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size, @@ -216,7 +216,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) ptr = gfc_allocate_array_with_status (&block, build_int_cst (pvoid_type_node, 0), size, NULL); - gfc_conv_descriptor_data_set_tuples (&block, dest, ptr); + gfc_conv_descriptor_data_set (&block, dest, ptr); call = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, ptr, fold_convert (pvoid_type_node, gfc_conv_descriptor_data_get (src)), @@ -236,7 +236,7 @@ gfc_omp_clause_assign_op (tree clause ATTRIBUTE_UNUSED, tree dest, tree src) if (! GFC_DESCRIPTOR_TYPE_P (type) || GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE) - return build_gimple_modify_stmt (dest, src); + return build2_v (MODIFY_EXPR, dest, src); /* Handle copying allocatable arrays. */ gfc_start_block (&block); @@ -602,7 +602,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where) gfc_start_block (&block); - gfc_add_modify_expr (&block, decl, outer_sym.backend_decl); + gfc_add_modify (&block, decl, outer_sym.backend_decl); rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; size = gfc_conv_descriptor_ubound (decl, rank); size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size, @@ -619,7 +619,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where) ptr = gfc_allocate_array_with_status (&block, build_int_cst (pvoid_type_node, 0), size, NULL); - gfc_conv_descriptor_data_set_tuples (&block, decl, ptr); + gfc_conv_descriptor_data_set (&block, decl, ptr); gfc_add_expr_to_block (&block, gfc_trans_assignment (e1, e2, false)); stmt = gfc_finish_block (&block); } @@ -1062,7 +1062,7 @@ gfc_trans_omp_atomic (gfc_code *code) tree accum = gfc_create_var (TREE_TYPE (rse.expr), NULL); gfc_actual_arglist *arg; - gfc_add_modify_stmt (&block, accum, rse.expr); + gfc_add_modify (&block, accum, rse.expr); for (arg = expr2->value.function.actual->next->next; arg; arg = arg->next) { @@ -1070,7 +1070,7 @@ gfc_trans_omp_atomic (gfc_code *code) gfc_conv_expr (&rse, arg->expr); gfc_add_block_to_block (&block, &rse.pre); x = fold_build2 (op, TREE_TYPE (accum), accum, rse.expr); - gfc_add_modify_stmt (&block, accum, x); + gfc_add_modify (&block, accum, x); } rse.expr = accum; @@ -1204,11 +1204,11 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, /* Loop body. */ if (simple) { - TREE_VEC_ELT (init, i) = build2_v (GIMPLE_MODIFY_STMT, dovar, from); + TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, dovar, from); TREE_VEC_ELT (cond, i) = fold_build2 (simple > 0 ? LE_EXPR : GE_EXPR, boolean_type_node, dovar, to); TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, dovar, step); - TREE_VEC_ELT (incr, i) = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar, + TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type, dovar, TREE_VEC_ELT (incr, i)); } else @@ -1225,13 +1225,13 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, tmp = fold_build2 (TRUNC_DIV_EXPR, type, tmp, step); tmp = gfc_evaluate_now (tmp, pblock); count = gfc_create_var (type, "count"); - TREE_VEC_ELT (init, i) = build2_v (GIMPLE_MODIFY_STMT, count, + TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, count, build_int_cst (type, 0)); TREE_VEC_ELT (cond, i) = fold_build2 (LT_EXPR, boolean_type_node, count, tmp); TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, count, build_int_cst (type, 1)); - TREE_VEC_ELT (incr, i) = fold_build2 (GIMPLE_MODIFY_STMT, type, + TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type, count, TREE_VEC_ELT (incr, i)); /* Initialize DOVAR. */ @@ -1260,7 +1260,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, than value after iterator increment. */ tmp = gfc_evaluate_now (step, pblock); tmp = fold_build2 (PLUS_EXPR, type, dovar, tmp); - tmp = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar, tmp); + tmp = fold_build2 (MODIFY_EXPR, type, dovar, tmp); for (c = omp_clauses; c ; c = OMP_CLAUSE_CHAIN (c)) if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE && OMP_CLAUSE_DECL (c) == dovar) @@ -1308,7 +1308,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, dovar_init = nreverse (dovar_init); while (dovar_init) { - gfc_add_modify_stmt (&body, TREE_PURPOSE (dovar_init), + gfc_add_modify (&body, TREE_PURPOSE (dovar_init), TREE_VALUE (dovar_init)); dovar_init = TREE_CHAIN (dovar_init); } @@ -1381,7 +1381,7 @@ gfc_trans_omp_parallel (gfc_code *code) omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); stmt = gfc_trans_omp_code (code->block->next, true); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); } @@ -1421,7 +1421,7 @@ gfc_trans_omp_parallel_do (gfc_code *code) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0)); else poplevel (0, 0, 0); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1446,7 +1446,7 @@ gfc_trans_omp_parallel_sections (gfc_code *code) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0)); else poplevel (0, 0, 0); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1471,7 +1471,7 @@ gfc_trans_omp_parallel_workshare (gfc_code *code) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0)); else poplevel (0, 0, 0); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1503,7 +1503,7 @@ gfc_trans_omp_sections (gfc_code *code, gfc_omp_clauses *clauses) } stmt = gfc_finish_block (&body); - stmt = build3_v (OMP_SECTIONS, stmt, omp_clauses, NULL_TREE); + stmt = build2 (OMP_SECTIONS, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1522,16 +1522,13 @@ static tree gfc_trans_omp_task (gfc_code *code) { stmtblock_t block; - tree stmt, body_stmt, omp_clauses; + tree stmt, omp_clauses; gfc_start_block (&block); omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); - body_stmt = gfc_trans_omp_code (code->block->next, true); - stmt = make_node (OMP_TASK); - TREE_TYPE (stmt) = void_type_node; - OMP_TASK_CLAUSES (stmt) = omp_clauses; - OMP_TASK_BODY (stmt) = body_stmt; + stmt = gfc_trans_omp_code (code->block->next, true); + stmt = build2 (OMP_TASK, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); } diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 79a1446ebf1..bf4305ba9c3 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -127,8 +127,8 @@ gfc_trans_label_assign (gfc_code * code) label_tree = gfc_build_addr_expr (pvoid_type_node, label_tree); } - gfc_add_modify_expr (&se.pre, len, len_tree); - gfc_add_modify_expr (&se.pre, addr, label_tree); + gfc_add_modify (&se.pre, len, len_tree); + gfc_add_modify (&se.pre, addr, label_tree); return gfc_finish_block (&se.pre); } @@ -271,9 +271,9 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse, &tmp_loop, info, tmp, false, true, false, & arg->expr->where); - gfc_add_modify_expr (&se->pre, size, tmp); + gfc_add_modify (&se->pre, size, tmp); tmp = fold_convert (pvoid_type_node, info->data); - gfc_add_modify_expr (&se->pre, data, tmp); + gfc_add_modify (&se->pre, data, tmp); gfc_merge_block_scope (&block); /* Obtain the argument descriptor for unpacking. */ @@ -294,7 +294,7 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse, offset, tmp); } info->offset = gfc_create_var (gfc_array_index_type, NULL); - gfc_add_modify_expr (&se->pre, info->offset, offset); + gfc_add_modify (&se->pre, info->offset, offset); /* Copy the result back using unpack. */ tmp = build_call_expr (gfor_fndecl_in_unpack, 2, parmse.expr, data); @@ -349,7 +349,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check) se.expr = convert (gfc_typenode_for_spec (&sym->ts), se.expr); if (sym->backend_decl == NULL) sym->backend_decl = gfc_get_symbol_decl (sym); - gfc_add_modify_expr (&se.pre, sym->backend_decl, se.expr); + gfc_add_modify (&se.pre, sym->backend_decl, se.expr); } else gfc_add_expr_to_block (&se.pre, se.expr); @@ -734,7 +734,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar, type = TREE_TYPE (dovar); /* Initialize the DO variable: dovar = from. */ - gfc_add_modify_expr (pblock, dovar, from); + gfc_add_modify (pblock, dovar, from); /* Cycle and exit statements are implemented with gotos. */ cycle_label = gfc_build_label_decl (NULL_TREE); @@ -763,7 +763,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar, /* Increment the loop variable. */ tmp = fold_build2 (PLUS_EXPR, type, dovar, step); - gfc_add_modify_expr (&body, dovar, tmp); + gfc_add_modify (&body, dovar, tmp); /* The loop exit. */ tmp = build1_v (GOTO_EXPR, exit_label); @@ -911,7 +911,7 @@ gfc_trans_do (gfc_code * code) tmp = fold_build1 (FIX_TRUNC_EXPR, utype, tmp); } countm1 = gfc_create_var (utype, "countm1"); - gfc_add_modify_expr (&block, countm1, tmp); + gfc_add_modify (&block, countm1, tmp); /* Cycle and exit statements are implemented with gotos. */ cycle_label = gfc_build_label_decl (NULL_TREE); @@ -919,7 +919,7 @@ gfc_trans_do (gfc_code * code) TREE_USED (exit_label) = 1; /* Initialize the DO variable: dovar = from. */ - gfc_add_modify_expr (&block, dovar, from); + gfc_add_modify (&block, dovar, from); /* If the loop is empty, go directly to the exit label. */ tmp = fold_build3 (COND_EXPR, void_type_node, empty, @@ -949,7 +949,7 @@ gfc_trans_do (gfc_code * code) /* Increment the loop variable. */ tmp = fold_build2 (PLUS_EXPR, type, dovar, step); - gfc_add_modify_expr (&body, dovar, tmp); + gfc_add_modify (&body, dovar, tmp); /* End with the loop condition. Loop until countm1 == 0. */ cond = fold_build2 (EQ_EXPR, boolean_type_node, countm1, @@ -961,7 +961,7 @@ gfc_trans_do (gfc_code * code) /* Decrement the loop count. */ tmp = fold_build2 (MINUS_EXPR, utype, countm1, build_int_cst (utype, 1)); - gfc_add_modify_expr (&body, countm1, tmp); + gfc_add_modify (&body, countm1, tmp); /* End of loop body. */ tmp = gfc_finish_block (&body); @@ -1479,7 +1479,7 @@ gfc_trans_character_select (gfc_code *code) tmp = build_call_expr (fndecl, 4, init, build_int_cst (NULL_TREE, n), se.expr, se.string_length); case_num = gfc_create_var (integer_type_node, "case_num"); - gfc_add_modify_expr (&block, case_num, tmp); + gfc_add_modify (&block, case_num, tmp); gfc_add_block_to_block (&block, &se.post); @@ -1609,7 +1609,7 @@ forall_make_variable_temp (gfc_code *c, stmtblock_t *pre, stmtblock_t *post) { /* Use the variable offset for the temporary. */ tmp = gfc_conv_descriptor_offset (tse.expr); - gfc_add_modify_expr (pre, tmp, + gfc_add_modify (pre, tmp, gfc_conv_array_offset (old_sym->backend_decl)); } } @@ -1765,7 +1765,7 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body, /* Initialize the mask index outside the FORALL nest. */ if (mask_flag && forall_tmp->mask) - gfc_add_modify_expr (outer, forall_tmp->maskindex, gfc_index_zero_node); + gfc_add_modify (outer, forall_tmp->maskindex, gfc_index_zero_node); iter = forall_tmp->this_loop; nvar = forall_tmp->nvar; @@ -1798,7 +1798,7 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body, /* Increment the loop variable. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (var), var, step); - gfc_add_modify_expr (&block, var, tmp); + gfc_add_modify (&block, var, tmp); /* Advance to the next mask element. Only do this for the innermost loop. */ @@ -1807,26 +1807,26 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body, tree maskindex = forall_tmp->maskindex; tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, maskindex, gfc_index_one_node); - gfc_add_modify_expr (&block, maskindex, tmp); + gfc_add_modify (&block, maskindex, tmp); } /* Decrement the loop counter. */ tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (var), count, build_int_cst (TREE_TYPE (var), 1)); - gfc_add_modify_expr (&block, count, tmp); + gfc_add_modify (&block, count, tmp); body = gfc_finish_block (&block); /* Loop var initialization. */ gfc_init_block (&block); - gfc_add_modify_expr (&block, var, start); + gfc_add_modify (&block, var, start); /* Initialize the loop counter. */ tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (var), step, start); tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (var), end, tmp); tmp = fold_build2 (TRUNC_DIV_EXPR, TREE_TYPE (var), tmp, step); - gfc_add_modify_expr (&block, count, tmp); + gfc_add_modify (&block, count, tmp); /* The loop expression. */ tmp = build1_v (LOOP_EXPR, body); @@ -1918,7 +1918,7 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock, *pdata = convert (pvoid_type_node, tmpvar); tmp = gfc_call_malloc (pblock, TREE_TYPE (tmpvar), bytesize); - gfc_add_modify_expr (pblock, tmpvar, tmp); + gfc_add_modify (pblock, tmpvar, tmp); } return tmpvar; } @@ -1954,13 +1954,13 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, /* Use the scalar assignment as is. */ gfc_add_block_to_block (&block, &lse.pre); - gfc_add_modify_expr (&block, lse.expr, tmp); + gfc_add_modify (&block, lse.expr, tmp); gfc_add_block_to_block (&block, &lse.post); /* Increment the count1. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (count1), count1, gfc_index_one_node); - gfc_add_modify_expr (&block, count1, tmp); + gfc_add_modify (&block, count1, tmp); tmp = gfc_finish_block (&block); } @@ -2016,14 +2016,14 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); /* Increment count3. */ if (count3) { tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count3, gfc_index_one_node); - gfc_add_modify_expr (&body, count3, tmp); + gfc_add_modify (&body, count3, tmp); } /* Generate the copying loops. */ @@ -2117,21 +2117,21 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3, /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (count1), count1, gfc_index_one_node); - gfc_add_modify_expr (&block, count1, tmp); + gfc_add_modify (&block, count1, tmp); } else { /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body1, count1, tmp); + gfc_add_modify (&body1, count1, tmp); /* Increment count3. */ if (count3) { tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count3, gfc_index_one_node); - gfc_add_modify_expr (&body1, count3, tmp); + gfc_add_modify (&body1, count3, tmp); } /* Generate the copying loops. */ @@ -2257,7 +2257,7 @@ compute_overall_iter_number (forall_info *nested_forall_info, tree inner_size, /* Otherwise, create a temporary variable to compute the result. */ number = gfc_create_var (gfc_array_index_type, "num"); - gfc_add_modify_expr (block, number, gfc_index_zero_node); + gfc_add_modify (block, number, gfc_index_zero_node); gfc_start_block (&body); if (inner_size_body) @@ -2267,7 +2267,7 @@ compute_overall_iter_number (forall_info *nested_forall_info, tree inner_size, number, inner_size); else tmp = inner_size; - gfc_add_modify_expr (&body, number, tmp); + gfc_add_modify (&body, number, tmp); tmp = gfc_finish_block (&body); /* Generate loops. */ @@ -2378,13 +2378,13 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, if (wheremask) { count = gfc_create_var (gfc_array_index_type, "count"); - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); } else count = NULL; /* Initialize count1. */ - gfc_add_modify_expr (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); /* Calculate the size of temporary needed in the assignment. Return loop, lss and rss which are used in function generate_loop_for_rhs_to_temp(). */ @@ -2423,11 +2423,11 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_add_expr_to_block (block, tmp); /* Reset count1. */ - gfc_add_modify_expr (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); /* Reset count. */ if (wheremask) - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); /* Generate codes to copy the temporary to lhs. */ tmp = generate_loop_for_temp_to_lhs (expr1, tmp1, count, count1, @@ -2469,7 +2469,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, tree tmp, tmp1, ptemp1; count = gfc_create_var (gfc_array_index_type, "count"); - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); inner_size = integer_one_node; lss = gfc_walk_expr (expr1); @@ -2490,14 +2490,14 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, rse.want_pointer = 1; gfc_conv_expr (&rse, expr2); gfc_add_block_to_block (&body, &rse.pre); - gfc_add_modify_expr (&body, lse.expr, + gfc_add_modify (&body, lse.expr, fold_convert (TREE_TYPE (lse.expr), rse.expr)); gfc_add_block_to_block (&body, &rse.post); /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); @@ -2507,7 +2507,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_add_expr_to_block (block, tmp); /* Reset count. */ - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); gfc_start_block (&body); gfc_init_se (&lse, NULL); @@ -2516,12 +2516,12 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, lse.want_pointer = 1; gfc_conv_expr (&lse, expr1); gfc_add_block_to_block (&body, &lse.pre); - gfc_add_modify_expr (&body, lse.expr, rse.expr); + gfc_add_modify (&body, lse.expr, rse.expr); gfc_add_block_to_block (&body, &lse.post); /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); /* Generate body and loops according to the information in @@ -2566,7 +2566,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); @@ -2576,13 +2576,13 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_add_expr_to_block (block, tmp); /* Reset count. */ - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); parm = gfc_build_array_ref (tmp1, count, NULL); lss = gfc_walk_expr (expr1); gfc_init_se (&lse, NULL); gfc_conv_expr_descriptor (&lse, expr1, lss); - gfc_add_modify_expr (&lse.pre, lse.expr, parm); + gfc_add_modify (&lse.pre, lse.expr, parm); gfc_start_block (&body); gfc_add_block_to_block (&body, &lse.pre); gfc_add_block_to_block (&body, &lse.post); @@ -2590,7 +2590,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); @@ -2822,7 +2822,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) /* As the mask array can be very big, prefer compact boolean types. */ tree mask_type = gfc_get_logical_type (gfc_logical_kinds[0].kind); - gfc_add_modify_expr (&block, maskindex, gfc_index_zero_node); + gfc_add_modify (&block, maskindex, gfc_index_zero_node); /* Start of mask assignment loop body. */ gfc_start_block (&body); @@ -2836,12 +2836,12 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) se.expr = convert (mask_type, se.expr); tmp = gfc_build_array_ref (mask, maskindex, NULL); - gfc_add_modify_expr (&body, tmp, se.expr); + gfc_add_modify (&body, tmp, se.expr); /* Advance to the next mask element. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, maskindex, gfc_index_one_node); - gfc_add_modify_expr (&body, maskindex, tmp); + gfc_add_modify (&body, maskindex, tmp); /* Generate the loops. */ tmp = gfc_finish_block (&body); @@ -2999,7 +2999,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, /* Variable to index the temporary. */ count = gfc_create_var (gfc_array_index_type, "count"); /* Initialize count. */ - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); gfc_start_block (&body); @@ -3041,14 +3041,14 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, gfc_add_block_to_block (&body1, &lse.pre); gfc_add_block_to_block (&body1, &rse.pre); - gfc_add_modify_expr (&body1, cond, fold_convert (mask_type, rse.expr)); + gfc_add_modify (&body1, cond, fold_convert (mask_type, rse.expr)); if (mask && (cmask || pmask)) { tmp = gfc_build_array_ref (mask, count, NULL); if (invert) tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, tmp); - gfc_add_modify_expr (&body1, mtmp, tmp); + gfc_add_modify (&body1, mtmp, tmp); } if (cmask) @@ -3057,7 +3057,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, tmp = cond; if (mask) tmp = fold_build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp); - gfc_add_modify_expr (&body1, tmp1, tmp); + gfc_add_modify (&body1, tmp1, tmp); } if (pmask) @@ -3066,7 +3066,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, cond); if (mask) tmp = fold_build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp); - gfc_add_modify_expr (&body1, tmp1, tmp); + gfc_add_modify (&body1, tmp1, tmp); } gfc_add_block_to_block (&body1, &lse.post); @@ -3081,7 +3081,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, /* Increment count. */ tmp1 = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body1, count, tmp1); + gfc_add_modify (&body1, count, tmp1); /* Generate the copying loops. */ gfc_trans_scalarizing_loops (&loop, &body1); @@ -3242,7 +3242,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); /* Use the scalar assignment as is. */ gfc_add_block_to_block (&block, &body); @@ -3258,7 +3258,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, expression. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); gfc_trans_scalarized_loop_boundary (&loop, &body); /* We need to copy the temporary to the actual lhs. */ @@ -3292,14 +3292,14 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, /* Increment count2. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count2, gfc_index_one_node); - gfc_add_modify_expr (&body, count2, tmp); + gfc_add_modify (&body, count2, tmp); } else { /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); } /* Generate the copying loops. */ @@ -3492,8 +3492,8 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert, /* Variables to control maskexpr. */ count1 = gfc_create_var (gfc_array_index_type, "count1"); count2 = gfc_create_var (gfc_array_index_type, "count2"); - gfc_add_modify_expr (block, count1, gfc_index_zero_node); - gfc_add_modify_expr (block, count2, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count2, gfc_index_zero_node); tmp = gfc_trans_where_assign (expr1, expr2, cmask, invert, @@ -3510,8 +3510,8 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert, /* Variables to control maskexpr. */ count1 = gfc_create_var (gfc_array_index_type, "count1"); count2 = gfc_create_var (gfc_array_index_type, "count2"); - gfc_add_modify_expr (block, count1, gfc_index_zero_node); - gfc_add_modify_expr (block, count2, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count2, gfc_index_zero_node); tmp = gfc_trans_where_assign (expr1, expr2, cmask, invert, @@ -3893,7 +3893,7 @@ gfc_trans_allocate (gfc_code * code) gfc_init_se (&se, NULL); gfc_conv_expr_lhs (&se, code->expr); tmp = convert (TREE_TYPE (se.expr), stat); - gfc_add_modify_expr (&block, se.expr, tmp); + gfc_add_modify (&block, se.expr, tmp); } return gfc_finish_block (&block); @@ -3942,7 +3942,7 @@ gfc_trans_deallocate (gfc_code * code) apstat = build_fold_addr_expr (astat); /* Initialize astat to 0. */ - gfc_add_modify_expr (&block, astat, build_int_cst (TREE_TYPE (astat), 0)); + gfc_add_modify (&block, astat, build_int_cst (TREE_TYPE (astat), 0)); } else pstat = apstat = stat = astat = NULL_TREE; @@ -3997,7 +3997,7 @@ gfc_trans_deallocate (gfc_code * code) if (code->expr) { apstat = fold_build2 (PLUS_EXPR, TREE_TYPE (stat), astat, stat); - gfc_add_modify_expr (&se.pre, astat, apstat); + gfc_add_modify (&se.pre, astat, apstat); } tmp = gfc_finish_block (&se.pre); @@ -4011,7 +4011,7 @@ gfc_trans_deallocate (gfc_code * code) gfc_init_se (&se, NULL); gfc_conv_expr_lhs (&se, code->expr); tmp = convert (TREE_TYPE (se.expr), astat); - gfc_add_modify_expr (&block, se.expr, tmp); + gfc_add_modify (&block, se.expr, tmp); } return gfc_finish_block (&block); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index d6aef8769e7..911e379001a 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" +#include "tree-iterator.h" #include "ggc.h" #include "toplev.h" #include "defaults.h" @@ -142,19 +143,18 @@ gfc_evaluate_now (tree expr, stmtblock_t * pblock) return expr; var = gfc_create_var (TREE_TYPE (expr), NULL); - gfc_add_modify_expr (pblock, var, expr); + gfc_add_modify (pblock, var, expr); return var; } -/* Build a MODIFY_EXPR (or GIMPLE_MODIFY_STMT) node and add it to a - given statement block PBLOCK. A MODIFY_EXPR is an assignment: +/* Build a MODIFY_EXPR node and add it to a given statement block PBLOCK. + A MODIFY_EXPR is an assignment: LHS <- RHS. */ void -gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs, - bool tuples_p) +gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs) { tree tmp; @@ -167,8 +167,7 @@ gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs, || AGGREGATE_TYPE_P (TREE_TYPE (lhs))); #endif - tmp = fold_build2 (tuples_p ? GIMPLE_MODIFY_STMT : MODIFY_EXPR, - void_type_node, lhs, rhs); + tmp = fold_build2 (MODIFY_EXPR, void_type_node, lhs, rhs); gfc_add_expr_to_block (pblock, tmp); } @@ -434,7 +433,7 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock, gfc_add_expr_to_block (&block, tmp); if (once) - gfc_add_modify_expr (&block, tmpvar, boolean_false_node); + gfc_add_modify (&block, tmpvar, boolean_false_node); body = gfc_finish_block (&block); @@ -495,7 +494,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) size = fold_build2 (MAX_EXPR, size_type_node, size, build_int_cst (size_type_node, 1)); - gfc_add_modify_expr (&block2, res, + gfc_add_modify (&block2, res, build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, size)); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, @@ -593,10 +592,10 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) stmtblock_t set_status_block; gfc_start_block (&set_status_block); - gfc_add_modify_expr (&set_status_block, + gfc_add_modify (&set_status_block, fold_build1 (INDIRECT_REF, status_type, status), build_int_cst (status_type, LIBERROR_ALLOCATION)); - gfc_add_modify_expr (&set_status_block, res, + gfc_add_modify (&set_status_block, res, build_int_cst (pvoid_type_node, 0)); tmp = fold_build2 (EQ_EXPR, boolean_type_node, status, @@ -607,7 +606,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) /* The allocation itself. */ gfc_start_block (&alloc_block); - gfc_add_modify_expr (&alloc_block, res, + gfc_add_modify (&alloc_block, res, build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, fold_build2 (MAX_EXPR, size_type_node, size, @@ -689,7 +688,7 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, /* If mem is NULL, we call gfc_allocate_with_status. */ gfc_start_block (&alloc_block); tmp = gfc_allocate_with_status (&alloc_block, size, status); - gfc_add_modify_expr (&alloc_block, res, fold_convert (type, tmp)); + gfc_add_modify (&alloc_block, res, fold_convert (type, tmp)); alloc = gfc_finish_block (&alloc_block); /* Otherwise, we issue a runtime error or set the status variable. */ @@ -708,9 +707,9 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, gfc_add_expr_to_block (&set_status_block, tmp); tmp = gfc_allocate_with_status (&set_status_block, size, status); - gfc_add_modify_expr (&set_status_block, res, fold_convert (type, tmp)); + gfc_add_modify (&set_status_block, res, fold_convert (type, tmp)); - gfc_add_modify_expr (&set_status_block, + gfc_add_modify (&set_status_block, fold_build1 (INDIRECT_REF, status_type, status), build_int_cst (status_type, LIBERROR_ALLOCATION)); @@ -885,7 +884,7 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size) /* Call realloc and check the result. */ tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2, fold_convert (pvoid_type_node, mem), size); - gfc_add_modify_expr (block, res, fold_convert (type, tmp)); + gfc_add_modify (block, res, fold_convert (type, tmp)); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, build_int_cst (pvoid_type_node, 0)); nonzero = fold_build2 (NE_EXPR, boolean_type_node, size, @@ -985,7 +984,7 @@ gfc_trans_code (gfc_code * code) gfc_start_block (&block); - /* Translate statements one by one to GIMPLE trees until we reach + /* Translate statements one by one into GENERIC trees until we reach the end of this gfc_code branch. */ for (; code; code = code->next) { @@ -1173,7 +1172,7 @@ gfc_trans_code (gfc_code * code) if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { if (TREE_CODE (res) == STATEMENT_LIST) - annotate_all_with_locus (&res, input_location); + tree_annotate_all_with_location (&res, input_location); else SET_EXPR_LOCATION (res, input_location); diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 7704748d305..6e09f24ac95 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -348,12 +348,8 @@ void gfc_trans_vla_type_sizes (gfc_symbol *, stmtblock_t *); void gfc_add_expr_to_block (stmtblock_t *, tree); /* Add a block to the end of a block. */ void gfc_add_block_to_block (stmtblock_t *, stmtblock_t *); -/* Add a MODIFY_EXPR or a GIMPLE_MODIFY_STMT to a block. */ -void gfc_add_modify (stmtblock_t *, tree, tree, bool); -#define gfc_add_modify_expr(BLOCK, LHS, RHS) \ - gfc_add_modify ((BLOCK), (LHS), (RHS), false) -#define gfc_add_modify_stmt(BLOCK, LHS, RHS) \ - gfc_add_modify ((BLOCK), (LHS), (RHS), true) +/* Add a MODIFY_EXPR to a block. */ +void gfc_add_modify (stmtblock_t *, tree, tree); /* Initialize a statement block. */ void gfc_init_block (stmtblock_t *); diff --git a/gcc/function.c b/gcc/function.c index fa2a84d804f..532a94f34c4 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "target.h" #include "cfglayout.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-pass.h" #include "predict.h" #include "df.h" @@ -1547,7 +1547,7 @@ static tree instantiate_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) { tree t = *tp; - if (! EXPR_P (t) && ! GIMPLE_STMT_P (t)) + if (! EXPR_P (t)) { *walk_subtrees = 0; if (DECL_P (t) && DECL_RTL_SET_P (t)) @@ -3092,7 +3092,7 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data) else if (TYPE_SIZE (t) && !TREE_CONSTANT (TYPE_SIZE (t)) && !TYPE_SIZES_GIMPLIFIED (t)) { - gimplify_type_sizes (t, (tree *) data); + gimplify_type_sizes (t, (gimple_seq *) data); *walk_subtrees = 1; } } @@ -3102,15 +3102,15 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data) /* Gimplify the parameter list for current_function_decl. This involves evaluating SAVE_EXPRs of variable sized parameters and generating code - to implement callee-copies reference parameters. Returns a list of - statements to add to the beginning of the function, or NULL if nothing - to do. */ + to implement callee-copies reference parameters. Returns a sequence of + statements to add to the beginning of the function. */ -tree +gimple_seq gimplify_parameters (void) { struct assign_parm_data_all all; - tree fnargs, parm, stmts = NULL; + tree fnargs, parm; + gimple_seq stmts = NULL; assign_parms_initialize_all (&all); fnargs = assign_parms_augmented_arg_list (&all); @@ -3170,12 +3170,11 @@ gimplify_parameters (void) t = built_in_decls[BUILT_IN_ALLOCA]; t = build_call_expr (t, 1, DECL_SIZE_UNIT (parm)); t = fold_convert (ptr_type, t); - t = build_gimple_modify_stmt (addr, t); + t = build2 (MODIFY_EXPR, TREE_TYPE (addr), addr, t); gimplify_and_add (t, &stmts); } - t = build_gimple_modify_stmt (local, parm); - gimplify_and_add (t, &stmts); + gimplify_assign (local, parm, &stmts); SET_DECL_VALUE_EXPR (parm, local); DECL_HAS_VALUE_EXPR_P (parm) = 1; diff --git a/gcc/function.h b/gcc/function.h index ece44fdc7ac..9de018100d9 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -428,6 +428,10 @@ struct function GTY(()) /* The control flow graph for this function. */ struct control_flow_graph *cfg; + + /* GIMPLE body for this function. */ + struct gimple_seq_d *gimple_body; + /* SSA and dataflow information. */ struct gimple_df *gimple_df; diff --git a/gcc/gengtype.c b/gcc/gengtype.c index f7309b16c88..adc355a3881 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1537,7 +1537,7 @@ open_base_files (void) "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", - "cfglayout.h", "except.h", "output.h", "cfgloop.h", NULL + "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", NULL }; const char *const *ifp; outf_p gtype_desc_c; diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 98a6c280ef3..0afe0d815dd 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -172,7 +172,6 @@ along with GCC; see the file COPYING3. If not see thing you need to do to add a new special allocation size. */ static const size_t extra_order_size_table[] = { - sizeof (struct stmt_ann_d), sizeof (struct var_ann_d), sizeof (struct tree_decl_non_common), sizeof (struct tree_field_decl), @@ -184,9 +183,6 @@ static const size_t extra_order_size_table[] = { sizeof (struct basic_block_def), sizeof (bitmap_element), sizeof (bitmap_head), - /* PHI nodes with one to three arguments are already covered by the - above sizes. */ - sizeof (struct tree_phi_node) + sizeof (struct phi_arg_d) * 3, TREE_EXP_SIZE (2), RTL_SIZE (2), /* MEM, PLUS, etc. */ RTL_SIZE (9), /* INSN */ diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c new file mode 100644 index 00000000000..a52c83072b4 --- /dev/null +++ b/gcc/gimple-iterator.c @@ -0,0 +1,771 @@ +/* Iterator routines for GIMPLE statements. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Contributed by Aldy Hernandez + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "gimple.h" +#include "tree-flow.h" +#include "value-prof.h" + + +/* Mark the statement STMT as modified, and update it. */ + +static inline void +update_modified_stmt (gimple stmt) +{ + if (!ssa_operands_active ()) + return; + update_stmt_if_modified (stmt); +} + + +/* Mark the statements in SEQ as modified, and update them. */ + +static void +update_modified_stmts (gimple_seq seq) +{ + gimple_stmt_iterator gsi; + + if (!ssa_operands_active ()) + return; + for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi)) + update_stmt_if_modified (gsi_stmt (gsi)); +} + + +/* Set BB to be the basic block for all the statements in the list + starting at FIRST and LAST. */ + +static void +update_bb_for_stmts (gimple_seq_node first, basic_block bb) +{ + gimple_seq_node n; + + for (n = first; n; n = n->next) + gimple_set_bb (n->stmt, bb); +} + + +/* Insert the sequence delimited by nodes FIRST and LAST before + iterator I. M specifies how to update iterator I after insertion + (see enum gsi_iterator_update). + + This routine assumes that there is a forward and backward path + between FIRST and LAST (i.e., they are linked in a doubly-linked + list). Additionally, if FIRST == LAST, this routine will properly + insert a single node. */ + +static void +gsi_insert_seq_nodes_before (gimple_stmt_iterator *i, + gimple_seq_node first, + gimple_seq_node last, + enum gsi_iterator_update mode) +{ + basic_block bb; + gimple_seq_node cur = i->ptr; + + if ((bb = gsi_bb (*i)) != NULL) + update_bb_for_stmts (first, bb); + + /* Link SEQ before CUR in the sequence. */ + if (cur) + { + first->prev = cur->prev; + if (first->prev) + first->prev->next = first; + else + gimple_seq_set_first (i->seq, first); + last->next = cur; + cur->prev = last; + } + else + { + gimple_seq_node itlast = gimple_seq_last (i->seq); + + /* If CUR is NULL, we link at the end of the sequence (this case happens + when gsi_after_labels is called for a basic block that contains only + labels, so it returns an iterator after the end of the block, and + we need to insert before it; it might be cleaner to add a flag to the + iterator saying whether we are at the start or end of the list). */ + first->prev = itlast; + if (itlast) + itlast->next = first; + else + gimple_seq_set_first (i->seq, first); + gimple_seq_set_last (i->seq, last); + } + + /* Update the iterator, if requested. */ + switch (mode) + { + case GSI_NEW_STMT: + case GSI_CONTINUE_LINKING: + i->ptr = first; + break; + case GSI_SAME_STMT: + break; + default: + gcc_unreachable (); + } +} + + +/* Inserts the sequence of statements SEQ before the statement pointed + by iterator I. MODE indicates what to do with the iterator after + insertion (see enum gsi_iterator_update). + + This function does not scan for new operands. It is provided for + the use of the gimplifier, which manipulates statements for which + def/use information has not yet been constructed. Most callers + should use gsi_insert_seq_before. */ + +void +gsi_insert_seq_before_without_update (gimple_stmt_iterator *i, gimple_seq seq, + enum gsi_iterator_update mode) +{ + gimple_seq_node first, last; + + if (seq == NULL) + return; + + /* Don't allow inserting a sequence into itself. */ + gcc_assert (seq != i->seq); + + first = gimple_seq_first (seq); + last = gimple_seq_last (seq); + + gimple_seq_set_first (seq, NULL); + gimple_seq_set_last (seq, NULL); + gimple_seq_free (seq); + + /* Empty sequences need no work. */ + if (!first || !last) + { + gcc_assert (first == last); + return; + } + + gsi_insert_seq_nodes_before (i, first, last, mode); +} + + +/* Inserts the sequence of statements SEQ before the statement pointed + by iterator I. MODE indicates what to do with the iterator after + insertion (see enum gsi_iterator_update). Scan the statements in SEQ + for new operands. */ + +void +gsi_insert_seq_before (gimple_stmt_iterator *i, gimple_seq seq, + enum gsi_iterator_update mode) +{ + update_modified_stmts (seq); + gsi_insert_seq_before_without_update (i, seq, mode); +} + + +/* Insert the sequence delimited by nodes FIRST and LAST after + iterator I. M specifies how to update iterator I after insertion + (see enum gsi_iterator_update). + + This routine assumes that there is a forward and backward path + between FIRST and LAST (i.e., they are linked in a doubly-linked + list). Additionally, if FIRST == LAST, this routine will properly + insert a single node. */ + +static void +gsi_insert_seq_nodes_after (gimple_stmt_iterator *i, + gimple_seq_node first, + gimple_seq_node last, + enum gsi_iterator_update m) +{ + basic_block bb; + gimple_seq_node cur = i->ptr; + + /* If the iterator is inside a basic block, we need to update the + basic block information for all the nodes between FIRST and LAST. */ + if ((bb = gsi_bb (*i)) != NULL) + update_bb_for_stmts (first, bb); + + /* Link SEQ after CUR. */ + if (cur) + { + last->next = cur->next; + if (last->next) + last->next->prev = last; + else + gimple_seq_set_last (i->seq, last); + first->prev = cur; + cur->next = first; + } + else + { + gcc_assert (!gimple_seq_last (i->seq)); + gimple_seq_set_first (i->seq, first); + gimple_seq_set_last (i->seq, last); + } + + /* Update the iterator, if requested. */ + switch (m) + { + case GSI_NEW_STMT: + i->ptr = first; + break; + case GSI_CONTINUE_LINKING: + i->ptr = last; + break; + case GSI_SAME_STMT: + gcc_assert (cur); + break; + default: + gcc_unreachable (); + } +} + + +/* Links sequence SEQ after the statement pointed-to by iterator I. + MODE is as in gsi_insert_after. + + This function does not scan for new operands. It is provided for + the use of the gimplifier, which manipulates statements for which + def/use information has not yet been constructed. Most callers + should use gsi_insert_seq_after. */ + +void +gsi_insert_seq_after_without_update (gimple_stmt_iterator *i, gimple_seq seq, + enum gsi_iterator_update mode) +{ + gimple_seq_node first, last; + + if (seq == NULL) + return; + + /* Don't allow inserting a sequence into itself. */ + gcc_assert (seq != i->seq); + + first = gimple_seq_first (seq); + last = gimple_seq_last (seq); + + gimple_seq_set_first (seq, NULL); + gimple_seq_set_last (seq, NULL); + gimple_seq_free (seq); + + /* Empty sequences need no work. */ + if (!first || !last) + { + gcc_assert (first == last); + return; + } + + gsi_insert_seq_nodes_after (i, first, last, mode); +} + + +/* Links sequence SEQ after the statement pointed-to by iterator I. + MODE is as in gsi_insert_after. Scan the statements in SEQ + for new operands. */ + +void +gsi_insert_seq_after (gimple_stmt_iterator *i, gimple_seq seq, + enum gsi_iterator_update mode) +{ + update_modified_stmts (seq); + gsi_insert_seq_after_without_update (i, seq, mode); +} + + +/* Move all statements in the sequence after I to a new sequence. + Return this new sequence. */ + +gimple_seq +gsi_split_seq_after (gimple_stmt_iterator i) +{ + gimple_seq_node cur, next; + gimple_seq old_seq, new_seq; + + cur = i.ptr; + + /* How can we possibly split after the end, or before the beginning? */ + gcc_assert (cur && cur->next); + next = cur->next; + + old_seq = i.seq; + new_seq = gimple_seq_alloc (); + + gimple_seq_set_first (new_seq, next); + gimple_seq_set_last (new_seq, gimple_seq_last (old_seq)); + gimple_seq_set_last (old_seq, cur); + cur->next = NULL; + next->prev = NULL; + + return new_seq; +} + + +/* Move all statements in the sequence before I to a new sequence. + Return this new sequence. I is set to the head of the new list. */ + +gimple_seq +gsi_split_seq_before (gimple_stmt_iterator *i) +{ + gimple_seq_node cur, prev; + gimple_seq old_seq, new_seq; + + cur = i->ptr; + + /* How can we possibly split after the end? */ + gcc_assert (cur); + prev = cur->prev; + + old_seq = i->seq; + new_seq = gimple_seq_alloc (); + i->seq = new_seq; + + /* Set the limits on NEW_SEQ. */ + gimple_seq_set_first (new_seq, cur); + gimple_seq_set_last (new_seq, gimple_seq_last (old_seq)); + + /* Cut OLD_SEQ before I. */ + gimple_seq_set_last (old_seq, prev); + cur->prev = NULL; + if (prev) + prev->next = NULL; + else + gimple_seq_set_first (old_seq, NULL); + + return new_seq; +} + + +/* Replace the statement pointed-to by GSI to STMT. If UPDATE_EH_INFO + is true, the exception handling information of the original + statement is moved to the new statement. */ + +void +gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info) +{ + int eh_region; + gimple orig_stmt = gsi_stmt (*gsi); + + if (stmt == orig_stmt) + return; + + gimple_set_location (stmt, gimple_location (orig_stmt)); + gimple_set_bb (stmt, gsi_bb (*gsi)); + + /* Preserve EH region information from the original statement, if + requested by the caller. */ + if (update_eh_info) + { + eh_region = lookup_stmt_eh_region (orig_stmt); + if (eh_region >= 0) + { + remove_stmt_from_eh_region (orig_stmt); + add_stmt_to_eh_region (stmt, eh_region); + } + } + + gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt); + gimple_remove_stmt_histograms (cfun, orig_stmt); + delink_stmt_imm_use (orig_stmt); + *gsi_stmt_ptr (gsi) = stmt; + gimple_set_modified (stmt, true); + update_modified_stmt (stmt); +} + + +/* Insert statement STMT before the statement pointed-to by iterator I. + M specifies how to update iterator I after insertion (see enum + gsi_iterator_update). + + This function does not scan for new operands. It is provided for + the use of the gimplifier, which manipulates statements for which + def/use information has not yet been constructed. Most callers + should use gsi_insert_before. */ + +void +gsi_insert_before_without_update (gimple_stmt_iterator *i, gimple stmt, + enum gsi_iterator_update m) +{ + gimple_seq_node n; + + n = GGC_NEW (struct gimple_seq_node_d); + n->prev = n->next = NULL; + n->stmt = stmt; + gsi_insert_seq_nodes_before (i, n, n, m); +} + +/* Insert statement STMT before the statement pointed-to by iterator I. + Update STMT's basic block and scan it for new operands. M + specifies how to update iterator I after insertion (see enum + gsi_iterator_update). */ + +void +gsi_insert_before (gimple_stmt_iterator *i, gimple stmt, + enum gsi_iterator_update m) +{ + update_modified_stmt (stmt); + gsi_insert_before_without_update (i, stmt, m); +} + + +/* Insert statement STMT after the statement pointed-to by iterator I. + M specifies how to update iterator I after insertion (see enum + gsi_iterator_update). + + This function does not scan for new operands. It is provided for + the use of the gimplifier, which manipulates statements for which + def/use information has not yet been constructed. Most callers + should use gsi_insert_after. */ + +void +gsi_insert_after_without_update (gimple_stmt_iterator *i, gimple stmt, + enum gsi_iterator_update m) +{ + gimple_seq_node n; + + n = GGC_NEW (struct gimple_seq_node_d); + n->prev = n->next = NULL; + n->stmt = stmt; + gsi_insert_seq_nodes_after (i, n, n, m); +} + + +/* Insert statement STMT after the statement pointed-to by iterator I. + Update STMT's basic block and scan it for new operands. M + specifies how to update iterator I after insertion (see enum + gsi_iterator_update). */ + +void +gsi_insert_after (gimple_stmt_iterator *i, gimple stmt, + enum gsi_iterator_update m) +{ + update_modified_stmt (stmt); + gsi_insert_after_without_update (i, stmt, m); +} + + +/* Remove the current stmt from the sequence. The iterator is updated + to point to the next statement. + + REMOVE_PERMANENTLY is true when the statement is going to be removed + from the IL and not reinserted elsewhere. In that case we remove the + statement pointed to by iterator I from the EH tables, and free its + operand caches. Otherwise we do not modify this information. */ + +void +gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) +{ + gimple_seq_node cur, next, prev; + gimple stmt = gsi_stmt (*i); + + /* Free all the data flow information for STMT. */ + gimple_set_bb (stmt, NULL); + delink_stmt_imm_use (stmt); + gimple_set_modified (stmt, true); + + if (remove_permanently) + { + remove_stmt_from_eh_region (stmt); + gimple_remove_stmt_histograms (cfun, stmt); + } + + /* Update the iterator and re-wire the links in I->SEQ. */ + cur = i->ptr; + next = cur->next; + prev = cur->prev; + + if (prev) + prev->next = next; + else + gimple_seq_set_first (i->seq, next); + + if (next) + next->prev = prev; + else + gimple_seq_set_last (i->seq, prev); + + i->ptr = next; +} + + +/* Finds iterator for STMT. */ + +gimple_stmt_iterator +gsi_for_stmt (gimple stmt) +{ + gimple_stmt_iterator i; + basic_block bb = gimple_bb (stmt); + + if (gimple_code (stmt) == GIMPLE_PHI) + i = gsi_start_phis (bb); + else + i = gsi_start_bb (bb); + + for (; !gsi_end_p (i); gsi_next (&i)) + if (gsi_stmt (i) == stmt) + return i; + + gcc_unreachable (); +} + + +/* Move the statement at FROM so it comes right after the statement at TO. */ + +void +gsi_move_after (gimple_stmt_iterator *from, gimple_stmt_iterator *to) +{ + gimple stmt = gsi_stmt (*from); + gsi_remove (from, false); + + /* We must have GSI_NEW_STMT here, as gsi_move_after is sometimes used to + move statements to an empty block. */ + gsi_insert_after (to, stmt, GSI_NEW_STMT); +} + + +/* Move the statement at FROM so it comes right before the statement + at TO. */ + +void +gsi_move_before (gimple_stmt_iterator *from, gimple_stmt_iterator *to) +{ + gimple stmt = gsi_stmt (*from); + gsi_remove (from, false); + + /* For consistency with gsi_move_after, it might be better to have + GSI_NEW_STMT here; however, that breaks several places that expect + that TO does not change. */ + gsi_insert_before (to, stmt, GSI_SAME_STMT); +} + + +/* Move the statement at FROM to the end of basic block BB. */ + +void +gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb) +{ + gimple_stmt_iterator last = gsi_last_bb (bb); +#ifdef ENABLE_CHECKING + gcc_assert (gsi_bb (last) == bb); +#endif + + /* Have to check gsi_end_p because it could be an empty block. */ + if (!gsi_end_p (last) && is_ctrl_stmt (gsi_stmt (last))) + gsi_move_before (from, &last); + else + gsi_move_after (from, &last); +} + + +/* Add STMT to the pending list of edge E. No actual insertion is + made until a call to gsi_commit_edge_inserts () is made. */ + +void +gsi_insert_on_edge (edge e, gimple stmt) +{ + gimple_seq_add_stmt (&PENDING_STMT (e), stmt); +} + +/* Add the sequence of statements SEQ to the pending list of edge E. + No actual insertion is made until a call to gsi_commit_edge_inserts + is made. */ + +void +gsi_insert_seq_on_edge (edge e, gimple_seq seq) +{ + gimple_seq_add_seq (&PENDING_STMT (e), seq); +} + + +/* Insert the statement pointed-to by GSI into edge E. Every attempt + is made to place the statement in an existing basic block, but + sometimes that isn't possible. When it isn't possible, the edge is + split and the statement is added to the new block. + + In all cases, the returned *GSI points to the correct location. The + return value is true if insertion should be done after the location, + or false if it should be done before the location. If new basic block + has to be created, it is stored in *NEW_BB. */ + +static bool +gimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi, + basic_block *new_bb) +{ + basic_block dest, src; + gimple tmp; + + dest = e->dest; + + /* If the destination has one predecessor which has no PHI nodes, + insert there. Except for the exit block. + + The requirement for no PHI nodes could be relaxed. Basically we + would have to examine the PHIs to prove that none of them used + the value set by the statement we want to insert on E. That + hardly seems worth the effort. */ +restart: + if (single_pred_p (dest) + && ! phi_nodes (dest) + && dest != EXIT_BLOCK_PTR) + { + *gsi = gsi_start_bb (dest); + if (gsi_end_p (*gsi)) + return true; + + /* Make sure we insert after any leading labels. */ + tmp = gsi_stmt (*gsi); + while (gimple_code (tmp) == GIMPLE_LABEL) + { + gsi_next (gsi); + if (gsi_end_p (*gsi)) + break; + tmp = gsi_stmt (*gsi); + } + + if (gsi_end_p (*gsi)) + { + *gsi = gsi_last_bb (dest); + return true; + } + else + return false; + } + + /* If the source has one successor, the edge is not abnormal and + the last statement does not end a basic block, insert there. + Except for the entry block. */ + src = e->src; + if ((e->flags & EDGE_ABNORMAL) == 0 + && single_succ_p (src) + && src != ENTRY_BLOCK_PTR) + { + *gsi = gsi_last_bb (src); + if (gsi_end_p (*gsi)) + return true; + + tmp = gsi_stmt (*gsi); + if (!stmt_ends_bb_p (tmp)) + return true; + + if (gimple_code (tmp) == GIMPLE_RETURN) + { + gsi_prev (gsi); + return true; + } + } + + /* Otherwise, create a new basic block, and split this edge. */ + dest = split_edge (e); + if (new_bb) + *new_bb = dest; + e = single_pred_edge (dest); + goto restart; +} + + +/* Similar to gsi_insert_on_edge+gsi_commit_edge_inserts. If a new + block has to be created, it is returned. */ + +basic_block +gsi_insert_on_edge_immediate (edge e, gimple stmt) +{ + gimple_stmt_iterator gsi; + basic_block new_bb = NULL; + + gcc_assert (!PENDING_STMT (e)); + + if (gimple_find_edge_insert_loc (e, &gsi, &new_bb)) + gsi_insert_after (&gsi, stmt, GSI_NEW_STMT); + else + gsi_insert_before (&gsi, stmt, GSI_NEW_STMT); + + return new_bb; +} + +/* Insert STMTS on edge E. If a new block has to be created, it + is returned. */ + +basic_block +gsi_insert_seq_on_edge_immediate (edge e, gimple_seq stmts) +{ + gimple_stmt_iterator gsi; + basic_block new_bb = NULL; + + gcc_assert (!PENDING_STMT (e)); + + if (gimple_find_edge_insert_loc (e, &gsi, &new_bb)) + gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT); + else + gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT); + + return new_bb; +} + +/* This routine will commit all pending edge insertions, creating any new + basic blocks which are necessary. */ + +void +gsi_commit_edge_inserts (void) +{ + basic_block bb; + edge e; + edge_iterator ei; + + gsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR), NULL); + + FOR_EACH_BB (bb) + FOR_EACH_EDGE (e, ei, bb->succs) + gsi_commit_one_edge_insert (e, NULL); +} + + +/* Commit insertions pending at edge E. If a new block is created, set NEW_BB + to this block, otherwise set it to NULL. */ + +void +gsi_commit_one_edge_insert (edge e, basic_block *new_bb) +{ + if (new_bb) + *new_bb = NULL; + + if (PENDING_STMT (e)) + { + gimple_stmt_iterator gsi; + gimple_seq seq = PENDING_STMT (e); + + PENDING_STMT (e) = NULL; + + if (gimple_find_edge_insert_loc (e, &gsi, new_bb)) + gsi_insert_seq_after (&gsi, seq, GSI_NEW_STMT); + else + gsi_insert_seq_before (&gsi, seq, GSI_NEW_STMT); + } +} + +/* Returns iterator at the start of the list of phi nodes of BB. */ + +gimple_stmt_iterator +gsi_start_phis (basic_block bb) +{ + return gsi_start (phi_nodes (bb)); +} diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 99175d5b2f1..cc77874b849 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -1,4 +1,4 @@ -/* Tree lowering pass. Lowers GIMPLE into unstructured form. +/* GIMPLE lowering pass. Converts High GIMPLE into Low GIMPLE. Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -25,7 +25,8 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "rtl.h" #include "varray.h" -#include "tree-gimple.h" +#include "gimple.h" +#include "tree-iterator.h" #include "tree-inline.h" #include "diagnostic.h" #include "langhooks.h" @@ -40,76 +41,123 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "tree-pass.h" +/* The differences between High GIMPLE and Low GIMPLE are the + following: + + 1- Lexical scopes are removed (i.e., GIMPLE_BIND disappears). + + 2- GIMPLE_TRY and GIMPLE_CATCH are converted to abnormal control + flow and exception regions are built as an on-the-side region + hierarchy (See tree-eh.c:lower_eh_constructs). + + 3- Multiple identical return statements are grouped into a single + return and gotos to the unique return site. */ + +/* Match a return statement with a label. During lowering, we identify + identical return statements and replace duplicates with a jump to + the corresponding label. */ +struct return_statements_t +{ + tree label; + gimple stmt; +}; +typedef struct return_statements_t return_statements_t; + +DEF_VEC_O(return_statements_t); +DEF_VEC_ALLOC_O(return_statements_t,heap); + struct lower_data { /* Block the current statement belongs to. */ tree block; - /* A TREE_LIST of label and return statements to be moved to the end + /* A vector of label and return statements to be moved to the end of the function. */ - tree return_statements; + VEC(return_statements_t,heap) *return_statements; /* True if the function calls __builtin_setjmp. */ bool calls_builtin_setjmp; }; -static void lower_stmt (tree_stmt_iterator *, struct lower_data *); -static void lower_bind_expr (tree_stmt_iterator *, struct lower_data *); -static void lower_cond_expr (tree_stmt_iterator *, struct lower_data *); -static void lower_return_expr (tree_stmt_iterator *, struct lower_data *); -static void lower_builtin_setjmp (tree_stmt_iterator *); +static void lower_stmt (gimple_stmt_iterator *, struct lower_data *); +static void lower_gimple_bind (gimple_stmt_iterator *, struct lower_data *); +static void lower_gimple_return (gimple_stmt_iterator *, struct lower_data *); +static void lower_builtin_setjmp (gimple_stmt_iterator *); -/* Lower the body of current_function_decl. */ + +/* Lower the body of current_function_decl from High GIMPLE into Low + GIMPLE. */ static unsigned int lower_function_body (void) { struct lower_data data; - tree *body_p = &DECL_SAVED_TREE (current_function_decl); - tree bind = *body_p; - tree_stmt_iterator i; - tree t, x; - - gcc_assert (TREE_CODE (bind) == BIND_EXPR); + gimple_seq body = gimple_body (current_function_decl); + gimple_seq lowered_body; + gimple_stmt_iterator i; + gimple bind; + tree t; + gimple x; + + /* The gimplifier should've left a body of exactly one statement, + namely a GIMPLE_BIND. */ + gcc_assert (gimple_seq_first (body) == gimple_seq_last (body) + && gimple_code (gimple_seq_first_stmt (body)) == GIMPLE_BIND); memset (&data, 0, sizeof (data)); data.block = DECL_INITIAL (current_function_decl); BLOCK_SUBBLOCKS (data.block) = NULL_TREE; BLOCK_CHAIN (data.block) = NULL_TREE; TREE_ASM_WRITTEN (data.block) = 1; + data.return_statements = VEC_alloc (return_statements_t, heap, 8); + + bind = gimple_seq_first_stmt (body); + lowered_body = NULL; + gimple_seq_add_stmt (&lowered_body, bind); + i = gsi_start (lowered_body); + lower_gimple_bind (&i, &data); - *body_p = alloc_stmt_list (); - i = tsi_start (*body_p); - tsi_link_after (&i, bind, TSI_NEW_STMT); - lower_bind_expr (&i, &data); + /* Once the old body has been lowered, replace it with the new + lowered sequence. */ + gimple_set_body (current_function_decl, lowered_body); - i = tsi_last (*body_p); + i = gsi_last (lowered_body); /* If the function falls off the end, we need a null return statement. - If we've already got one in the return_statements list, we don't + If we've already got one in the return_statements vector, we don't need to do anything special. Otherwise build one by hand. */ - if (block_may_fallthru (*body_p) - && (data.return_statements == NULL - || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL)) + if (gimple_seq_may_fallthru (lowered_body) + && (VEC_empty (return_statements_t, data.return_statements) + || gimple_return_retval (VEC_last (return_statements_t, + data.return_statements)->stmt) != NULL)) { - x = build1 (RETURN_EXPR, void_type_node, NULL); - SET_EXPR_LOCATION (x, cfun->function_end_locus); - tsi_link_after (&i, x, TSI_CONTINUE_LINKING); + x = gimple_build_return (NULL); + gimple_set_location (x, cfun->function_end_locus); + gsi_insert_after (&i, x, GSI_CONTINUE_LINKING); } /* If we lowered any return statements, emit the representative at the end of the function. */ - for (t = data.return_statements ; t ; t = TREE_CHAIN (t)) + while (!VEC_empty (return_statements_t, data.return_statements)) { - x = build1 (LABEL_EXPR, void_type_node, TREE_PURPOSE (t)); - tsi_link_after (&i, x, TSI_CONTINUE_LINKING); + return_statements_t t; + + /* Unfortunately, we can't use VEC_pop because it returns void for + objects. */ + t = *VEC_last (return_statements_t, data.return_statements); + VEC_truncate (return_statements_t, + data.return_statements, + VEC_length (return_statements_t, + data.return_statements) - 1); + + x = gimple_build_label (t.label); + gsi_insert_after (&i, x, GSI_CONTINUE_LINKING); /* Remove the line number from the representative return statement. It now fills in for many such returns. Failure to remove this will result in incorrect results for coverage analysis. */ - x = TREE_VALUE (t); - SET_EXPR_LOCATION (x, UNKNOWN_LOCATION); - tsi_link_after (&i, x, TSI_CONTINUE_LINKING); + gimple_set_location (t.stmt, UNKNOWN_LOCATION); + gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING); } /* If the function calls __builtin_setjmp, we need to emit the computed @@ -123,21 +171,21 @@ lower_function_body (void) /* This mark will create forward edges from every call site. */ DECL_NONLOCAL (disp_label) = 1; cfun->has_nonlocal_label = 1; - x = build1 (LABEL_EXPR, void_type_node, disp_label); - tsi_link_after (&i, x, TSI_CONTINUE_LINKING); + x = gimple_build_label (disp_label); + gsi_insert_after (&i, x, GSI_CONTINUE_LINKING); /* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);' and insert. */ disp_var = create_tmp_var (ptr_type_node, "setjmpvar"); arg = build_addr (disp_label, current_function_decl); t = implicit_built_in_decls[BUILT_IN_SETJMP_DISPATCHER]; - t = build_call_expr (t, 1, arg); - x = build_gimple_modify_stmt (disp_var, t); + x = gimple_build_call (t, 1, arg); + gimple_call_set_lhs (x, disp_var); /* Build 'goto DISP_VAR;' and insert. */ - tsi_link_after (&i, x, TSI_CONTINUE_LINKING); - x = build1 (GOTO_EXPR, void_type_node, disp_var); - tsi_link_after (&i, x, TSI_CONTINUE_LINKING); + gsi_insert_after (&i, x, GSI_CONTINUE_LINKING); + x = gimple_build_goto (disp_var); + gsi_insert_after (&i, x, GSI_CONTINUE_LINKING); } gcc_assert (data.block == DECL_INITIAL (current_function_decl)); @@ -145,6 +193,7 @@ lower_function_body (void) = blocks_nreverse (BLOCK_SUBBLOCKS (data.block)); clear_block_marks (data.block); + VEC_free(return_statements_t, heap, data.return_statements); return 0; } @@ -168,134 +217,131 @@ struct gimple_opt_pass pass_lower_cf = }; -/* Lower the EXPR. Unlike gimplification the statements are not relowered +/* Lower sequence SEQ. Unlike gimplification the statements are not relowered when they are changed -- if this has to be done, the lowering routine must do it explicitly. DATA is passed through the recursion. */ static void -lower_stmt_body (tree expr, struct lower_data *data) +lower_sequence (gimple_seq seq, struct lower_data *data) { - tree_stmt_iterator tsi; + gimple_stmt_iterator gsi; - for (tsi = tsi_start (expr); !tsi_end_p (tsi); ) - lower_stmt (&tsi, data); + for (gsi = gsi_start (seq); !gsi_end_p (gsi); ) + lower_stmt (&gsi, data); } -/* Lower the OpenMP directive statement pointed by TSI. DATA is +/* Lower the OpenMP directive statement pointed by GSI. DATA is passed through the recursion. */ static void -lower_omp_directive (tree_stmt_iterator *tsi, struct lower_data *data) +lower_omp_directive (gimple_stmt_iterator *gsi, struct lower_data *data) { - tree stmt; + gimple stmt; - stmt = tsi_stmt (*tsi); + stmt = gsi_stmt (*gsi); - lower_stmt_body (OMP_BODY (stmt), data); - tsi_link_before (tsi, stmt, TSI_SAME_STMT); - tsi_link_before (tsi, OMP_BODY (stmt), TSI_SAME_STMT); - OMP_BODY (stmt) = NULL_TREE; - tsi_delink (tsi); + lower_sequence (gimple_omp_body (stmt), data); + gsi_insert_before (gsi, stmt, GSI_SAME_STMT); + gsi_insert_seq_before (gsi, gimple_omp_body (stmt), GSI_SAME_STMT); + gimple_omp_set_body (stmt, NULL); + gsi_remove (gsi, false); } -/* Lower statement TSI. DATA is passed through the recursion. */ +/* Lower statement GSI. DATA is passed through the recursion. */ static void -lower_stmt (tree_stmt_iterator *tsi, struct lower_data *data) +lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data) { - tree stmt = tsi_stmt (*tsi); + gimple stmt = gsi_stmt (*gsi); - if (EXPR_HAS_LOCATION (stmt) && data) - TREE_BLOCK (stmt) = data->block; + gimple_set_block (stmt, data->block); - switch (TREE_CODE (stmt)) + switch (gimple_code (stmt)) { - case BIND_EXPR: - lower_bind_expr (tsi, data); - return; - case COND_EXPR: - lower_cond_expr (tsi, data); - return; - case RETURN_EXPR: - lower_return_expr (tsi, data); + case GIMPLE_BIND: + lower_gimple_bind (gsi, data); return; - case TRY_FINALLY_EXPR: - case TRY_CATCH_EXPR: - lower_stmt_body (TREE_OPERAND (stmt, 0), data); - lower_stmt_body (TREE_OPERAND (stmt, 1), data); + case GIMPLE_COND: + /* The gimplifier has already lowered this into gotos. */ break; - case CATCH_EXPR: - lower_stmt_body (CATCH_BODY (stmt), data); + + case GIMPLE_RETURN: + lower_gimple_return (gsi, data); + return; + + case GIMPLE_TRY: + lower_sequence (gimple_try_eval (stmt), data); + lower_sequence (gimple_try_cleanup (stmt), data); break; - case EH_FILTER_EXPR: - lower_stmt_body (EH_FILTER_FAILURE (stmt), data); + + case GIMPLE_CATCH: + lower_sequence (gimple_catch_handler (stmt), data); break; - - case NOP_EXPR: - case ASM_EXPR: - case GOTO_EXPR: - case PREDICT_EXPR: - case LABEL_EXPR: - case SWITCH_EXPR: - case CHANGE_DYNAMIC_TYPE_EXPR: - case OMP_FOR: - case OMP_SECTIONS: - case OMP_SECTIONS_SWITCH: - case OMP_SECTION: - case OMP_SINGLE: - case OMP_MASTER: - case OMP_ORDERED: - case OMP_CRITICAL: - case OMP_RETURN: - case OMP_ATOMIC_LOAD: - case OMP_ATOMIC_STORE: - case OMP_CONTINUE: + + case GIMPLE_EH_FILTER: + lower_sequence (gimple_eh_filter_failure (stmt), data); break; - case GIMPLE_MODIFY_STMT: - if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR) - stmt = GIMPLE_STMT_OPERAND (stmt, 1); - else - break; - /* FALLTHRU */ + case GIMPLE_NOP: + case GIMPLE_ASM: + case GIMPLE_ASSIGN: + case GIMPLE_GOTO: + case GIMPLE_PREDICT: + case GIMPLE_LABEL: + case GIMPLE_SWITCH: + case GIMPLE_CHANGE_DYNAMIC_TYPE: + case GIMPLE_OMP_FOR: + case GIMPLE_OMP_SECTIONS: + case GIMPLE_OMP_SECTIONS_SWITCH: + case GIMPLE_OMP_SECTION: + case GIMPLE_OMP_SINGLE: + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_ORDERED: + case GIMPLE_OMP_CRITICAL: + case GIMPLE_OMP_RETURN: + case GIMPLE_OMP_ATOMIC_LOAD: + case GIMPLE_OMP_ATOMIC_STORE: + case GIMPLE_OMP_CONTINUE: + break; - case CALL_EXPR: + case GIMPLE_CALL: { - tree decl = get_callee_fndecl (stmt); + tree decl = gimple_call_fndecl (stmt); + if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (decl) == BUILT_IN_SETJMP) { data->calls_builtin_setjmp = true; - lower_builtin_setjmp (tsi); + lower_builtin_setjmp (gsi); return; } } break; - case OMP_PARALLEL: - case OMP_TASK: - lower_omp_directive (tsi, data); + case GIMPLE_OMP_PARALLEL: + case GIMPLE_OMP_TASK: + lower_omp_directive (gsi, data); return; default: gcc_unreachable (); } - tsi_next (tsi); + gsi_next (gsi); } /* Lower a bind_expr TSI. DATA is passed through the recursion. */ static void -lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data) +lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data) { tree old_block = data->block; - tree stmt = tsi_stmt (*tsi); - tree new_block = BIND_EXPR_BLOCK (stmt); + gimple stmt = gsi_stmt (*gsi); + tree new_block = gimple_bind_block (stmt); if (new_block) { @@ -325,8 +371,8 @@ lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data) } } - record_vars (BIND_EXPR_VARS (stmt)); - lower_stmt_body (BIND_EXPR_BODY (stmt), data); + record_vars (gimple_bind_vars (stmt)); + lower_sequence (gimple_bind_body (stmt), data); if (new_block) { @@ -337,9 +383,9 @@ lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data) data->block = old_block; } - /* The BIND_EXPR no longer carries any useful information -- kill it. */ - tsi_link_before (tsi, BIND_EXPR_BODY (stmt), TSI_SAME_STMT); - tsi_delink (tsi); + /* The GIMPLE_BIND no longer carries any useful information -- kill it. */ + gsi_insert_seq_before (gsi, gimple_bind_body (stmt), GSI_SAME_STMT); + gsi_remove (gsi, false); } /* Try to determine whether a TRY_CATCH expression can fall through. @@ -390,6 +436,58 @@ try_catch_may_fallthru (const_tree stmt) } } + +/* Same as above, but for a GIMPLE_TRY_CATCH. */ + +static bool +gimple_try_catch_may_fallthru (gimple stmt) +{ + gimple_stmt_iterator i; + + /* We don't handle GIMPLE_TRY_FINALLY. */ + gcc_assert (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH); + + /* If the TRY block can fall through, the whole TRY_CATCH can + fall through. */ + if (gimple_seq_may_fallthru (gimple_try_eval (stmt))) + return true; + + i = gsi_start (gimple_try_cleanup (stmt)); + switch (gimple_code (gsi_stmt (i))) + { + case GIMPLE_CATCH: + /* We expect to see a sequence of GIMPLE_CATCH stmts, each with a + catch expression and a body. The whole try/catch may fall + through iff any of the catch bodies falls through. */ + for (; !gsi_end_p (i); gsi_next (&i)) + { + if (gimple_seq_may_fallthru (gimple_catch_handler (gsi_stmt (i)))) + return true; + } + return false; + + case GIMPLE_EH_FILTER: + /* The exception filter expression only matters if there is an + exception. If the exception does not match EH_FILTER_TYPES, + we will execute EH_FILTER_FAILURE, and we will fall through + if that falls through. If the exception does match + EH_FILTER_TYPES, the stack unwinder will continue up the + stack, so we will not fall through. We don't know whether we + will throw an exception which matches EH_FILTER_TYPES or not, + so we just ignore EH_FILTER_TYPES and assume that we might + throw an exception which doesn't match. */ + return gimple_seq_may_fallthru (gimple_eh_filter_failure (gsi_stmt (i))); + + default: + /* This case represents statements to be executed when an + exception occurs. Those statements are implicitly followed + by a GIMPLE_RESX to resume execution after the exception. So + in this case the try/catch never falls through. */ + return false; + } +} + + /* Try to determine if we can fall out of the bottom of BLOCK. This guess need not be 100% accurate; simply be conservative and return true if we don't know. This is used only to avoid stupidly generating extra code. @@ -440,9 +538,9 @@ block_may_fallthru (const_tree block) return (block_may_fallthru (TREE_OPERAND (stmt, 0)) && block_may_fallthru (TREE_OPERAND (stmt, 1))); - case GIMPLE_MODIFY_STMT: - if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR) - stmt = GIMPLE_STMT_OPERAND (stmt, 1); + case MODIFY_EXPR: + if (TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR) + stmt = TREE_OPERAND (stmt, 1); else return true; /* FALLTHRU */ @@ -459,138 +557,110 @@ block_may_fallthru (const_tree block) } } -/* Lower a cond_expr TSI. DATA is passed through the recursion. */ -static void -lower_cond_expr (tree_stmt_iterator *tsi, struct lower_data *data) +/* Try to determine if we can continue executing the statement + immediately following STMT. This guess need not be 100% accurate; + simply be conservative and return true if we don't know. This is + used only to avoid stupidly generating extra code. If we're wrong, + we'll just delete the extra code later. */ + +bool +gimple_stmt_may_fallthru (gimple stmt) { - tree stmt = tsi_stmt (*tsi); - bool then_is_goto, else_is_goto; - tree then_branch, else_branch; - tree then_goto, else_goto; - - then_branch = COND_EXPR_THEN (stmt); - else_branch = COND_EXPR_ELSE (stmt); + if (!stmt) + return true; - lower_stmt_body (then_branch, data); - lower_stmt_body (else_branch, data); + switch (gimple_code (stmt)) + { + case GIMPLE_GOTO: + case GIMPLE_RETURN: + case GIMPLE_RESX: + /* Easy cases. If the last statement of the seq implies + control transfer, then we can't fall through. */ + return false; - then_goto = expr_only (then_branch); - then_is_goto = then_goto && simple_goto_p (then_goto); + case GIMPLE_SWITCH: + /* Switch has already been lowered and represents a + branch to a selected label and hence can not fall through. */ + return true; - else_goto = expr_only (else_branch); - else_is_goto = else_goto && simple_goto_p (else_goto); + case GIMPLE_COND: + /* GIMPLE_COND's are already lowered into a two-way branch. They + can't fall through. */ + return false; - if (!then_is_goto || !else_is_goto) - { - tree then_label, else_label, end_label, t; - - then_label = NULL_TREE; - else_label = NULL_TREE; - end_label = NULL_TREE; - - /* Replace the cond_expr with explicit gotos. */ - if (!then_is_goto) - { - t = build1 (LABEL_EXPR, void_type_node, NULL_TREE); - if (TREE_SIDE_EFFECTS (then_branch)) - then_label = t; - else - end_label = t; - then_goto = build_and_jump (&LABEL_EXPR_LABEL (t)); - } + case GIMPLE_BIND: + return gimple_seq_may_fallthru (gimple_bind_body (stmt)); - if (!else_is_goto) - { - t = build1 (LABEL_EXPR, void_type_node, NULL_TREE); - if (TREE_SIDE_EFFECTS (else_branch)) - else_label = t; - else - { - /* Both THEN and ELSE can be no-ops if one or both contained an - empty BIND_EXPR that was associated with the toplevel block - of an inlined function. In that case remove_useless_stmts - can't have cleaned things up for us; kill the whole - conditional now. */ - if (end_label) - { - tsi_delink (tsi); - return; - } - else - end_label = t; - } - else_goto = build_and_jump (&LABEL_EXPR_LABEL (t)); - } + case GIMPLE_TRY: + if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH) + return gimple_try_catch_may_fallthru (stmt); - if (then_label) - { - bool may_fallthru = block_may_fallthru (then_branch); + /* It must be a GIMPLE_TRY_FINALLY. */ - tsi_link_after (tsi, then_label, TSI_CONTINUE_LINKING); - tsi_link_after (tsi, then_branch, TSI_CONTINUE_LINKING); - - if (else_label && may_fallthru) - { - end_label = build1 (LABEL_EXPR, void_type_node, NULL_TREE); - t = build_and_jump (&LABEL_EXPR_LABEL (end_label)); - tsi_link_after (tsi, t, TSI_CONTINUE_LINKING); - } - } - - if (else_label) - { - tsi_link_after (tsi, else_label, TSI_CONTINUE_LINKING); - tsi_link_after (tsi, else_branch, TSI_CONTINUE_LINKING); - } + /* The finally clause is always executed after the try clause, + so if it does not fall through, then the try-finally will not + fall through. Otherwise, if the try clause does not fall + through, then when the finally clause falls through it will + resume execution wherever the try clause was going. So the + whole try-finally will only fall through if both the try + clause and the finally clause fall through. */ + return (gimple_seq_may_fallthru (gimple_try_eval (stmt)) + && gimple_seq_may_fallthru (gimple_try_cleanup (stmt))); + + case GIMPLE_ASSIGN: + return true; - if (end_label) - tsi_link_after (tsi, end_label, TSI_CONTINUE_LINKING); + case GIMPLE_CALL: + /* Functions that do not return do not fall through. */ + return (gimple_call_flags (stmt) & ECF_NORETURN) == 0; + + default: + return true; } +} + - COND_EXPR_THEN (stmt) = then_goto; - COND_EXPR_ELSE (stmt) = else_goto; +/* Same as gimple_stmt_may_fallthru, but for the gimple sequence SEQ. */ - tsi_next (tsi); +bool +gimple_seq_may_fallthru (gimple_seq seq) +{ + return gimple_stmt_may_fallthru (gimple_seq_last_stmt (seq)); } -/* Lower a return_expr TSI. DATA is passed through the recursion. */ + +/* Lower a GIMPLE_RETURN GSI. DATA is passed through the recursion. */ static void -lower_return_expr (tree_stmt_iterator *tsi, struct lower_data *data) +lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data) { - tree stmt = tsi_stmt (*tsi); - tree value, t, label; - - /* Extract the value being returned. */ - value = TREE_OPERAND (stmt, 0); - if (value && TREE_CODE (value) == GIMPLE_MODIFY_STMT) - value = GIMPLE_STMT_OPERAND (value, 1); + gimple stmt = gsi_stmt (*gsi); + gimple t; + int i; + return_statements_t tmp_rs; /* Match this up with an existing return statement that's been created. */ - for (t = data->return_statements; t ; t = TREE_CHAIN (t)) + for (i = VEC_length (return_statements_t, data->return_statements) - 1; + i >= 0; i--) { - tree tvalue = TREE_OPERAND (TREE_VALUE (t), 0); - if (tvalue && TREE_CODE (tvalue) == GIMPLE_MODIFY_STMT) - tvalue = GIMPLE_STMT_OPERAND (tvalue, 1); + tmp_rs = *VEC_index (return_statements_t, data->return_statements, i); - if (value == tvalue) - { - label = TREE_PURPOSE (t); - goto found; - } + if (gimple_return_retval (stmt) == gimple_return_retval (tmp_rs.stmt)) + goto found; } /* Not found. Create a new label and record the return statement. */ - label = create_artificial_label (); - data->return_statements = tree_cons (label, stmt, data->return_statements); + tmp_rs.label = create_artificial_label (); + tmp_rs.stmt = stmt; + VEC_safe_push (return_statements_t, heap, data->return_statements, &tmp_rs); /* Generate a goto statement and remove the return statement. */ found: - t = build1 (GOTO_EXPR, void_type_node, label); - SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt)); - tsi_link_before (tsi, t, TSI_SAME_STMT); - tsi_delink (tsi); + t = gimple_build_goto (tmp_rs.label); + gimple_set_location (t, gimple_location (stmt)); + gsi_insert_before (gsi, t, GSI_SAME_STMT); + gsi_remove (gsi, false); } /* Lower a __builtin_setjmp TSI. @@ -647,71 +717,66 @@ lower_return_expr (tree_stmt_iterator *tsi, struct lower_data *data) to the receivers, thus keeping the complexity explosion localized. */ static void -lower_builtin_setjmp (tree_stmt_iterator *tsi) +lower_builtin_setjmp (gimple_stmt_iterator *gsi) { - tree stmt = tsi_stmt (*tsi); + gimple stmt = gsi_stmt (*gsi); tree cont_label = create_artificial_label (); tree next_label = create_artificial_label (); tree dest, t, arg; + gimple g; /* NEXT_LABEL is the label __builtin_longjmp will jump to. Its address is passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver. */ FORCED_LABEL (next_label) = 1; - if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT) - { - dest = GIMPLE_STMT_OPERAND (stmt, 0); - stmt = GIMPLE_STMT_OPERAND (stmt, 1); - } - else - dest = NULL_TREE; + dest = gimple_call_lhs (stmt); /* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */ arg = build_addr (next_label, current_function_decl); t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP]; - t = build_call_expr (t, 2, CALL_EXPR_ARG (stmt, 0), arg); - SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt)); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg); + gimple_set_location (g, gimple_location (stmt)); + gsi_insert_before (gsi, g, GSI_SAME_STMT); /* Build 'DEST = 0' and insert. */ if (dest) { - t = build_gimple_modify_stmt (dest, fold_convert (TREE_TYPE (dest), - integer_zero_node)); - SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt)); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest), + integer_zero_node)); + gimple_set_location (g, gimple_location (stmt)); + gsi_insert_before (gsi, g, GSI_SAME_STMT); } /* Build 'goto CONT_LABEL' and insert. */ - t = build1 (GOTO_EXPR, void_type_node, cont_label); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_goto (cont_label); + gsi_insert_before (gsi, g, TSI_SAME_STMT); /* Build 'NEXT_LABEL:' and insert. */ - t = build1 (LABEL_EXPR, void_type_node, next_label); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_label (next_label); + gsi_insert_before (gsi, g, GSI_SAME_STMT); /* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */ arg = build_addr (next_label, current_function_decl); t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER]; - t = build_call_expr (t, 1, arg); - SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt)); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_call (t, 1, arg); + gimple_set_location (g, gimple_location (stmt)); + gsi_insert_before (gsi, g, GSI_SAME_STMT); /* Build 'DEST = 1' and insert. */ if (dest) { - t = build_gimple_modify_stmt (dest, fold_convert (TREE_TYPE (dest), - integer_one_node)); - SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt)); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest), + integer_one_node)); + gimple_set_location (g, gimple_location (stmt)); + gsi_insert_before (gsi, g, GSI_SAME_STMT); } /* Build 'CONT_LABEL:' and insert. */ - t = build1 (LABEL_EXPR, void_type_node, cont_label); - tsi_link_before (tsi, t, TSI_SAME_STMT); + g = gimple_build_label (cont_label); + gsi_insert_before (gsi, g, GSI_SAME_STMT); /* Remove the call to __builtin_setjmp. */ - tsi_delink (tsi); + gsi_remove (gsi, false); } diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c new file mode 100644 index 00000000000..d334d856982 --- /dev/null +++ b/gcc/gimple-pretty-print.c @@ -0,0 +1,1857 @@ +/* Pretty formatting of GIMPLE statements and expressions. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. + Contributed by Aldy Hernandez and + Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "diagnostic.h" +#include "real.h" +#include "hashtab.h" +#include "tree-flow.h" +#include "tree-pass.h" +#include "gimple.h" +#include "value-prof.h" + +#define INDENT(SPACE) \ + do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0) + +static pretty_printer buffer; +static bool initialized = false; + +#define GIMPLE_NIY do_niy (buffer,gs) + +/* Try to print on BUFFER a default message for the unrecognized + gimple statement GS. */ + +static void +do_niy (pretty_printer *buffer, gimple gs) +{ + pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n", + gimple_code_name[(int) gimple_code (gs)]); +} + + +/* Initialize the pretty printer on FILE if needed. */ + +static void +maybe_init_pretty_print (FILE *file) +{ + if (!initialized) + { + pp_construct (&buffer, NULL, 0); + pp_needs_newline (&buffer) = true; + initialized = true; + } + + buffer.buffer->stream = file; +} + + +/* Emit a newline and SPC indentantion spaces to BUFFER. */ + +static void +newline_and_indent (pretty_printer *buffer, int spc) +{ + pp_newline (buffer); + INDENT (spc); +} + + +/* Print the GIMPLE statement GS on stderr. */ + +void +debug_gimple_stmt (gimple gs) +{ + print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS); + fprintf (stderr, "\n"); +} + + +/* Dump GIMPLE statement G to FILE using SPC indentantion spaces and + FLAGS as in dump_gimple_stmt. */ + +void +print_gimple_stmt (FILE *file, gimple g, int spc, int flags) +{ + maybe_init_pretty_print (file); + dump_gimple_stmt (&buffer, g, spc, flags); + pp_flush (&buffer); +} + + +/* Dump GIMPLE statement G to FILE using SPC indentantion spaces and + FLAGS as in dump_gimple_stmt. Print only the right-hand side + of the statement. */ + +void +print_gimple_expr (FILE *file, gimple g, int spc, int flags) +{ + flags |= TDF_RHS_ONLY; + maybe_init_pretty_print (file); + dump_gimple_stmt (&buffer, g, spc, flags); +} + + +/* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion + spaces and FLAGS as in dump_gimple_stmt. */ + +static void +dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags) +{ + gimple_stmt_iterator i; + + for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) + { + gimple gs = gsi_stmt (i); + INDENT (spc); + dump_gimple_stmt (buffer, gs, spc, flags); + if (!gsi_one_before_end_p (i)) + pp_newline (buffer); + } +} + + +/* Dump GIMPLE sequence SEQ to FILE using SPC indentantion spaces and + FLAGS as in dump_gimple_stmt. */ + +void +print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags) +{ + maybe_init_pretty_print (file); + dump_gimple_seq (&buffer, seq, spc, flags); + pp_flush (&buffer); +} + + +/* Print the GIMPLE sequence SEQ on stderr. */ + +void +debug_gimple_seq (gimple_seq seq) +{ + print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS); +} + + +/* A simple helper to pretty-print some of the gimple tuples in the printf + style. The format modifiers are preceeded by '%' and are: + 'G' - outputs a string corresponding to the code of the given gimple, + 'S' - outputs a gimple_seq with indent of spc + 2, + 'T' - outputs the tree t, + 'd' - outputs an int as a decimal, + 's' - outputs a string, + 'n' - outputs a newline, + '+' - increases indent by 2 then outputs a newline, + '-' - decreases indent by 2 then outputs a newline. */ + +static void +dump_gimple_fmt (pretty_printer *buffer, int spc, int flags, + const char *fmt, ...) +{ + va_list args; + const char *c; + const char *tmp; + + va_start (args, fmt); + for (c = fmt; *c; c++) + { + if (*c == '%') + { + gimple_seq seq; + tree t; + gimple g; + switch (*++c) + { + case 'G': + g = va_arg (args, gimple); + tmp = gimple_code_name[gimple_code (g)]; + pp_string (buffer, tmp); + break; + + case 'S': + seq = va_arg (args, gimple_seq); + pp_newline (buffer); + dump_gimple_seq (buffer, seq, spc + 2, flags); + newline_and_indent (buffer, spc); + break; + + case 'T': + t = va_arg (args, tree); + if (t == NULL_TREE) + pp_string (buffer, "NULL"); + else + dump_generic_node (buffer, t, spc, flags, false); + break; + + case 'd': + pp_decimal_int (buffer, va_arg (args, int)); + break; + + case 's': + pp_string (buffer, va_arg (args, char *)); + break; + + case 'n': + newline_and_indent (buffer, spc); + break; + + case '+': + spc += 2; + newline_and_indent (buffer, spc); + break; + + case '-': + spc -= 2; + newline_and_indent (buffer, spc); + break; + + default: + gcc_unreachable (); + } + } + else + pp_character (buffer, *c); + } + va_end (args); +} + + +/* Helper for dump_gimple_assign. Print the unary RHS of the + assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */ + +static void +dump_unary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + enum tree_code rhs_code = gimple_assign_rhs_code (gs); + tree lhs = gimple_assign_lhs (gs); + tree rhs = gimple_assign_rhs1 (gs); + + switch (rhs_code) + { + case VIEW_CONVERT_EXPR: + case ASSERT_EXPR: + dump_generic_node (buffer, rhs, spc, flags, false); + break; + + case FIXED_CONVERT_EXPR: + case FIX_TRUNC_EXPR: + case FLOAT_EXPR: + CASE_CONVERT: + pp_string (buffer, "("); + dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false); + pp_string (buffer, ") "); + dump_generic_node (buffer, rhs, spc, flags, false); + break; + + case PAREN_EXPR: + pp_string (buffer, "(("); + dump_generic_node (buffer, rhs, spc, flags, false); + pp_string (buffer, "))"); + break; + + case ABS_EXPR: + pp_string (buffer, "ABS_EXPR <"); + dump_generic_node (buffer, rhs, spc, flags, false); + pp_string (buffer, ">"); + break; + + default: + if (TREE_CODE_CLASS (rhs_code) == tcc_declaration + || TREE_CODE_CLASS (rhs_code) == tcc_constant + || TREE_CODE_CLASS (rhs_code) == tcc_reference + || rhs_code == SSA_NAME + || rhs_code == ADDR_EXPR + || rhs_code == CONSTRUCTOR) + ; /* do nothing. */ + else if (rhs_code == BIT_NOT_EXPR) + pp_string (buffer, "~"); + else if (rhs_code == TRUTH_NOT_EXPR) + pp_string (buffer, "!"); + else if (rhs_code == NEGATE_EXPR) + pp_string (buffer, "-"); + else + { + pp_string (buffer, "["); + pp_string (buffer, tree_code_name [rhs_code]); + pp_string (buffer, "] "); + } + + dump_generic_node (buffer, rhs, spc, flags, false); + break; + } +} + + +/* Helper for dump_gimple_assign. Print the binary RHS of the + assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */ + +static void +dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + switch (gimple_assign_rhs_code (gs)) + { + case COMPLEX_EXPR: + pp_string (buffer, "COMPLEX_EXPR <"); + dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); + pp_string (buffer, ", "); + dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); + pp_string (buffer, ">"); + break; + + case MIN_EXPR: + pp_string (buffer, "MIN_EXPR <"); + dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); + pp_string (buffer, ", "); + dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); + pp_string (buffer, ">"); + break; + + case MAX_EXPR: + pp_string (buffer, "MAX_EXPR <"); + dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); + pp_string (buffer, ", "); + dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); + pp_string (buffer, ">"); + break; + + default: + dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); + pp_space (buffer); + pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs))); + pp_space (buffer); + dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); + } +} + + +/* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in + dump_gimple_stmt. */ + +static void +dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + { + tree last; + if (gimple_num_ops (gs) == 2) + last = NULL_TREE; + else if (gimple_num_ops (gs) == 3) + last = gimple_assign_rhs2 (gs); + else + gcc_unreachable (); + + dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T>", gs, + tree_code_name[gimple_assign_rhs_code (gs)], + gimple_assign_lhs (gs), gimple_assign_rhs1 (gs), last); + } + else + { + if (!(flags & TDF_RHS_ONLY)) + { + dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false); + pp_space (buffer); + pp_character (buffer, '='); + + if (gimple_assign_nontemporal_move_p (gs)) + pp_string (buffer, "{nt}"); + + if (gimple_has_volatile_ops (gs)) + pp_string (buffer, "{v}"); + + pp_space (buffer); + } + + if (gimple_num_ops (gs) == 2) + dump_unary_rhs (buffer, gs, spc, flags); + else if (gimple_num_ops (gs) == 3) + dump_binary_rhs (buffer, gs, spc, flags); + else + gcc_unreachable (); + if (!(flags & TDF_RHS_ONLY)) + pp_semicolon(buffer); + } +} + + +/* Dump the return statement GS. BUFFER, SPC and FLAGS are as in + dump_gimple_stmt. */ + +static void +dump_gimple_return (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + tree t; + + t = gimple_return_retval (gs); + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, t); + else + { + pp_string (buffer, "return"); + if (t) + { + pp_space (buffer); + dump_generic_node (buffer, t, spc, flags, false); + } + pp_semicolon (buffer); + } +} + + +/* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in + dump_gimple_call. */ + +static void +dump_gimple_call_args (pretty_printer *buffer, gimple gs, int flags) +{ + size_t i; + + for (i = 0; i < gimple_call_num_args (gs); i++) + { + dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false); + if (i < gimple_call_num_args (gs) - 1) + pp_string (buffer, ", "); + } + + if (gimple_call_va_arg_pack_p (gs)) + { + if (gimple_call_num_args (gs) > 0) + { + pp_character (buffer, ','); + pp_space (buffer); + } + + pp_string (buffer, "__builtin_va_arg_pack ()"); + } +} + + +/* Dump the call statement GS. BUFFER, SPC and FLAGS are as in + dump_gimple_stmt. */ + +static void +dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + tree lhs = gimple_call_lhs (gs); + + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", + gs, gimple_call_fn (gs), lhs); + if (gimple_call_num_args (gs) > 0) + { + pp_string (buffer, ", "); + dump_gimple_call_args (buffer, gs, flags); + } + pp_string (buffer, ">"); + } + else + { + if (lhs && !(flags & TDF_RHS_ONLY)) + { + dump_generic_node (buffer, lhs, spc, flags, false); + pp_string (buffer, " ="); + + if (gimple_has_volatile_ops (gs)) + pp_string (buffer, "{v}"); + + pp_space (buffer); + } + dump_generic_node (buffer, gimple_call_fn (gs), spc, flags, false); + pp_string (buffer, " ("); + dump_gimple_call_args (buffer, gs, flags); + pp_string (buffer, ")"); + if (!(flags & TDF_RHS_ONLY)) + pp_semicolon (buffer); + } + + if (gimple_call_chain (gs)) + { + pp_string (buffer, " [static-chain: "); + dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false); + pp_character (buffer, ']'); + } + + if (gimple_call_return_slot_opt_p (gs)) + pp_string (buffer, " [return slot optimization]"); + + if (gimple_call_tail_p (gs)) + pp_string (buffer, " [tail call]"); +} + + +/* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in + dump_gimple_stmt. */ + +static void +dump_gimple_switch (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + unsigned int i; + + GIMPLE_CHECK (gs, GIMPLE_SWITCH); + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs, + gimple_switch_index (gs)); + else + { + pp_string (buffer, "switch ("); + dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true); + pp_string (buffer, ") <"); + } + + for (i = 0; i < gimple_switch_num_labels (gs); i++) + { + tree case_label = gimple_switch_label (gs, i); + if (case_label == NULL_TREE) + continue; + + dump_generic_node (buffer, case_label, spc, flags, false); + pp_string (buffer, " "); + dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false); + if (i < gimple_switch_num_labels (gs) - 1) + pp_string (buffer, ", "); + } + pp_string (buffer, ">"); +} + + +/* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in + dump_gimple_stmt. */ + +static void +dump_gimple_cond (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs, + tree_code_name [gimple_cond_code (gs)], + gimple_cond_lhs (gs), gimple_cond_rhs (gs), + gimple_cond_true_label (gs), gimple_cond_false_label (gs)); + else + { + if (!(flags & TDF_RHS_ONLY)) + pp_string (buffer, "if ("); + dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false); + pp_space (buffer); + pp_string (buffer, op_symbol_code (gimple_cond_code (gs))); + pp_space (buffer); + dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false); + if (!(flags & TDF_RHS_ONLY)) + { + pp_string (buffer, ")"); + + if (gimple_cond_true_label (gs)) + { + pp_string (buffer, " goto "); + dump_generic_node (buffer, gimple_cond_true_label (gs), + spc, flags, false); + pp_semicolon (buffer); + } + if (gimple_cond_false_label (gs)) + { + pp_string (buffer, " else goto "); + dump_generic_node (buffer, gimple_cond_false_label (gs), + spc, flags, false); + pp_semicolon (buffer); + } + } + } +} + + +/* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC + spaces of indent. FLAGS specifies details to show in the dump (see + TDF_* in tree-pass.h). */ + +static void +dump_gimple_label (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + tree label = gimple_label_label (gs); + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label); + else + { + dump_generic_node (buffer, label, spc, flags, false); + pp_string (buffer, ":"); + } + if (DECL_NONLOCAL (label)) + pp_string (buffer, " [non-local]"); +} + +/* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC + spaces of indent. FLAGS specifies details to show in the dump (see + TDF_* in tree-pass.h). */ + +static void +dump_gimple_goto (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + tree label = gimple_goto_dest (gs); + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label); + else + dump_gimple_fmt (buffer, spc, flags, "goto %T;", label); +} + + +/* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC + spaces of indent. FLAGS specifies details to show in the dump (see + TDF_* in tree-pass.h). */ + +static void +dump_gimple_bind (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <", gs); + else + pp_character (buffer, '{'); + if (!(flags & TDF_SLIM)) + { + tree var; + + for (var = gimple_bind_vars (gs); var; var = TREE_CHAIN (var)) + { + newline_and_indent (buffer, 2); + print_declaration (buffer, var, spc, flags); + } + if (gimple_bind_vars (gs)) + pp_newline (buffer); + } + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags); + newline_and_indent (buffer, spc); + if (flags & TDF_RAW) + pp_character (buffer, '>'); + else + pp_character (buffer, '}'); +} + + +/* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of + indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_try (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + { + const char *type; + if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH) + type = "GIMPLE_TRY_CATCH"; + else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY) + type = "GIMPLE_TRY_FINALLY"; + else + type = "UNKNOWN GIMPLE_TRY"; + dump_gimple_fmt (buffer, spc, flags, + "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type, + gimple_try_eval (gs), gimple_try_cleanup (gs)); + } + else + { + pp_string (buffer, "try"); + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "{"); + pp_newline (buffer); + + dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "}"); + + if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH) + { + newline_and_indent (buffer, spc); + pp_string (buffer, "catch"); + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "{"); + } + else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY) + { + newline_and_indent (buffer, spc); + pp_string (buffer, "finally"); + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "{"); + } + else + pp_string (buffer, " {"); + + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } +} + + +/* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of + indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_catch (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs, + gimple_catch_types (gs), gimple_catch_handler (gs)); + else + dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}", + gimple_catch_types (gs), gimple_catch_handler (gs)); +} + + +/* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of + indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_eh_filter (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs, + gimple_eh_filter_types (gs), + gimple_eh_filter_failure (gs)); + else + dump_gimple_fmt (buffer, spc, flags, "<<>>%+{%+%S%-}", + gimple_eh_filter_types (gs), + gimple_eh_filter_failure (gs)); +} + + +/* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of + indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_resx (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs, + gimple_resx_region (gs)); + else + dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs)); +} + +/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */ +static void +dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + size_t i; + + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, + gimple_omp_body (gs)); + dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags); + dump_gimple_fmt (buffer, spc, flags, " >,"); + for (i = 0; i < gimple_omp_for_collapse (gs); i++) + dump_gimple_fmt (buffer, spc, flags, + "%+%T, %T, %T, %s, %T,%n", + gimple_omp_for_index (gs, i), + gimple_omp_for_initial (gs, i), + gimple_omp_for_final (gs, i), + tree_code_name[gimple_omp_for_cond (gs, i)], + gimple_omp_for_incr (gs, i)); + dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->", + gimple_omp_for_pre_body (gs)); + } + else + { + pp_string (buffer, "#pragma omp for"); + dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags); + for (i = 0; i < gimple_omp_for_collapse (gs); i++) + { + if (i) + spc += 2; + newline_and_indent (buffer, spc); + pp_string (buffer, "for ("); + dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc, + flags, false); + pp_string (buffer, " = "); + dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc, + flags, false); + pp_string (buffer, "; "); + + dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc, + flags, false); + pp_space (buffer); + switch (gimple_omp_for_cond (gs, i)) + { + case LT_EXPR: + pp_character (buffer, '<'); + break; + case GT_EXPR: + pp_character (buffer, '>'); + break; + case LE_EXPR: + pp_string (buffer, "<="); + break; + case GE_EXPR: + pp_string (buffer, ">="); + break; + default: + gcc_unreachable (); + } + pp_space (buffer); + dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc, + flags, false); + pp_string (buffer, "; "); + + dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc, + flags, false); + pp_string (buffer, " = "); + dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc, + flags, false); + pp_character (buffer, ')'); + } + + if (!gimple_seq_empty_p (gimple_omp_body (gs))) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + } +} + +/* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */ + +static void +dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs, + gimple_omp_continue_control_def (gs), + gimple_omp_continue_control_use (gs)); + } + else + { + pp_string (buffer, "#pragma omp continue ("); + dump_generic_node (buffer, gimple_omp_continue_control_def (gs), + spc, flags, false); + pp_character (buffer, ','); + pp_space (buffer); + dump_generic_node (buffer, gimple_omp_continue_control_use (gs), + spc, flags, false); + pp_character (buffer, ')'); + } +} + +/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */ + +static void +dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, + gimple_omp_body (gs)); + dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags); + dump_gimple_fmt (buffer, spc, flags, " >"); + } + else + { + pp_string (buffer, "#pragma omp single"); + dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags); + if (!gimple_seq_empty_p (gimple_omp_body (gs))) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + } +} + +/* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */ + +static void +dump_gimple_omp_sections (pretty_printer *buffer, gimple gs, int spc, + int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, + gimple_omp_body (gs)); + dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags); + dump_gimple_fmt (buffer, spc, flags, " >"); + } + else + { + pp_string (buffer, "#pragma omp sections"); + if (gimple_omp_sections_control (gs)) + { + pp_string (buffer, " <"); + dump_generic_node (buffer, gimple_omp_sections_control (gs), spc, + flags, false); + pp_character (buffer, '>'); + } + dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags); + if (!gimple_seq_empty_p (gimple_omp_body (gs))) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + } +} + +/* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the pretty_printer + BUFFER. */ + +static void +dump_gimple_omp_block (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs, + gimple_omp_body (gs)); + else + { + switch (gimple_code (gs)) + { + case GIMPLE_OMP_MASTER: + pp_string (buffer, "#pragma omp master"); + break; + case GIMPLE_OMP_ORDERED: + pp_string (buffer, "#pragma omp ordered"); + break; + case GIMPLE_OMP_SECTION: + pp_string (buffer, "#pragma omp section"); + break; + default: + gcc_unreachable (); + } + if (!gimple_seq_empty_p (gimple_omp_body (gs))) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + } +} + +/* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */ + +static void +dump_gimple_omp_critical (pretty_printer *buffer, gimple gs, int spc, + int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs, + gimple_omp_body (gs)); + else + { + pp_string (buffer, "#pragma omp critical"); + if (gimple_omp_critical_name (gs)) + { + pp_string (buffer, " ("); + dump_generic_node (buffer, gimple_omp_critical_name (gs), spc, + flags, false); + pp_character (buffer, ')'); + } + if (!gimple_seq_empty_p (gimple_omp_body (gs))) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + } +} + +/* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */ + +static void +dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G ", gs, + (int) gimple_omp_return_nowait_p (gs)); + } + else + { + pp_string (buffer, "#pragma omp return"); + if (gimple_omp_return_nowait_p (gs)) + pp_string (buffer, "(nowait)"); + } +} + +/* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of + indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + unsigned int i; + + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs, + gimple_asm_string (gs)); + else + { + pp_string (buffer, "__asm__"); + if (gimple_asm_volatile_p (gs)) + pp_string (buffer, " __volatile__"); + pp_string (buffer, "(\""); + pp_string (buffer, gimple_asm_string (gs)); + pp_string (buffer, "\""); + } + + if (gimple_asm_ninputs (gs) + || gimple_asm_noutputs (gs) + || gimple_asm_nclobbers (gs)) + { + if (gimple_asm_noutputs (gs)) + { + if (flags & TDF_RAW) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "OUTPUT: "); + } + else + pp_string (buffer, " : "); + } + + for (i = 0; i < gimple_asm_noutputs (gs); i++) + { + dump_generic_node (buffer, gimple_asm_output_op (gs, i), spc, flags, + false); + if ( i < gimple_asm_noutputs (gs) -1) + pp_string (buffer, ", "); + } + + if (gimple_asm_ninputs (gs)) + { + if (flags & TDF_RAW) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "INPUT: "); + } + else + pp_string (buffer, " : "); + } + + for (i = 0; i < gimple_asm_ninputs (gs); i++) + { + dump_generic_node (buffer, gimple_asm_input_op (gs, i), spc, flags, + false); + if (i < gimple_asm_ninputs (gs) -1) + pp_string (buffer, " : "); + } + + if (gimple_asm_nclobbers (gs)) + { + if (flags & TDF_RAW) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "CLOBBER: "); + } + else + pp_string (buffer, " : "); + } + + for (i = 0; i < gimple_asm_nclobbers (gs); i++) + { + dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), spc, flags, + false); + if ( i < gimple_asm_nclobbers (gs) -1) + pp_string (buffer, ", "); + } + } + if (flags & TDF_RAW) + { + newline_and_indent (buffer, spc); + pp_character (buffer, '>'); + } + else + pp_string (buffer, ");"); +} + + +/* Dump the set of decls SYMS. BUFFER, SPC and FLAGS are as in + dump_generic_node. */ + +static void +dump_symbols (pretty_printer *buffer, bitmap syms, int flags) +{ + unsigned i; + bitmap_iterator bi; + + if (syms == NULL) + pp_string (buffer, "NIL"); + else + { + pp_string (buffer, " { "); + + EXECUTE_IF_SET_IN_BITMAP (syms, 0, i, bi) + { + tree sym = referenced_var_lookup (i); + dump_generic_node (buffer, sym, 0, flags, false); + pp_string (buffer, " "); + } + + pp_string (buffer, "}"); + } +} + + +/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in + dump_gimple_stmt. */ + +static void +dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags) +{ + size_t i; + + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi, + gimple_phi_result (phi)); + else + { + dump_generic_node (buffer, gimple_phi_result (phi), spc, flags, false); + pp_string (buffer, " = PHI <"); + } + for (i = 0; i < gimple_phi_num_args (phi); i++) + { + dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags, + false); + pp_string (buffer, "("); + pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index); + pp_string (buffer, ")"); + if (i < gimple_phi_num_args (phi) - 1) + pp_string (buffer, ", "); + } + pp_string (buffer, ">"); +} + + +/* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces + of indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_omp_parallel (pretty_printer *buffer, gimple gs, int spc, + int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, + gimple_omp_body (gs)); + dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags); + dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>", + gimple_omp_parallel_child_fn (gs), + gimple_omp_parallel_data_arg (gs)); + } + else + { + gimple_seq body; + pp_string (buffer, "#pragma omp parallel"); + dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags); + if (gimple_omp_parallel_child_fn (gs)) + { + pp_string (buffer, " [child fn: "); + dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs), + spc, flags, false); + pp_string (buffer, " ("); + if (gimple_omp_parallel_data_arg (gs)) + dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs), + spc, flags, false); + else + pp_string (buffer, "???"); + pp_string (buffer, ")]"); + } + body = gimple_omp_body (gs); + if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, body, spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + else if (body) + { + pp_newline (buffer); + dump_gimple_seq (buffer, body, spc + 2, flags); + } + } +} + + +/* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces + of indent. FLAGS specifies details to show in the dump (see TDF_* in + tree-pass.h). */ + +static void +dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc, + int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, + gimple_omp_body (gs)); + dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags); + dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>", + gimple_omp_task_child_fn (gs), + gimple_omp_task_data_arg (gs), + gimple_omp_task_copy_fn (gs), + gimple_omp_task_arg_size (gs), + gimple_omp_task_arg_size (gs)); + } + else + { + gimple_seq body; + pp_string (buffer, "#pragma omp task"); + dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags); + if (gimple_omp_task_child_fn (gs)) + { + pp_string (buffer, " [child fn: "); + dump_generic_node (buffer, gimple_omp_task_child_fn (gs), + spc, flags, false); + pp_string (buffer, " ("); + if (gimple_omp_task_data_arg (gs)) + dump_generic_node (buffer, gimple_omp_task_data_arg (gs), + spc, flags, false); + else + pp_string (buffer, "???"); + pp_string (buffer, ")]"); + } + body = gimple_omp_body (gs); + if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND) + { + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '{'); + pp_newline (buffer); + dump_gimple_seq (buffer, body, spc + 4, flags); + newline_and_indent (buffer, spc + 2); + pp_character (buffer, '}'); + } + else if (body) + { + pp_newline (buffer); + dump_gimple_seq (buffer, body, spc + 2, flags); + } + } +} + + +/* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC + spaces of indent. FLAGS specifies details to show in the dump (see TDF_* + in tree-pass.h). */ + +static void +dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple gs, int spc, + int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs, + gimple_omp_atomic_load_lhs (gs), + gimple_omp_atomic_load_rhs (gs)); + } + else + { + pp_string (buffer, "#pragma omp atomic_load"); + newline_and_indent (buffer, spc + 2); + dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs), + spc, flags, false); + pp_space (buffer); + pp_character (buffer, '='); + pp_space (buffer); + pp_character (buffer, '*'); + dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs), + spc, flags, false); + } +} + +/* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC + spaces of indent. FLAGS specifies details to show in the dump (see TDF_* + in tree-pass.h). */ + +static void +dump_gimple_omp_atomic_store (pretty_printer *buffer, gimple gs, int spc, + int flags) +{ + if (flags & TDF_RAW) + { + dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, + gimple_omp_atomic_store_val (gs)); + } + else + { + pp_string (buffer, "#pragma omp atomic_store ("); + dump_generic_node (buffer, gimple_omp_atomic_store_val (gs), + spc, flags, false); + pp_character (buffer, ')'); + } +} + +/* Dump a GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. BUFFER, SPC and + FLAGS are as in dump_gimple_stmt. */ + +static void +dump_gimple_cdt (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (flags & TDF_RAW) + dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs, + gimple_cdt_new_type (gs), gimple_cdt_location (gs)); + else + { + pp_string (buffer, "<<>>"); + } +} + + +/* Dump all the memory operands for statement GS. BUFFER, SPC and + FLAGS are as in dump_gimple_stmt. */ + +static void +dump_gimple_mem_ops (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + struct voptype_d *vdefs; + struct voptype_d *vuses; + int i, n; + + if (!ssa_operands_active () || !gimple_references_memory_p (gs)) + return; + + /* Even if the statement doesn't have virtual operators yet, it may + contain symbol information (this happens before aliases have been + computed). */ + if ((flags & TDF_MEMSYMS) + && gimple_vuse_ops (gs) == NULL + && gimple_vdef_ops (gs) == NULL) + { + if (gimple_loaded_syms (gs)) + { + pp_string (buffer, "# LOADS: "); + dump_symbols (buffer, gimple_loaded_syms (gs), flags); + newline_and_indent (buffer, spc); + } + + if (gimple_stored_syms (gs)) + { + pp_string (buffer, "# STORES: "); + dump_symbols (buffer, gimple_stored_syms (gs), flags); + newline_and_indent (buffer, spc); + } + + return; + } + + vuses = gimple_vuse_ops (gs); + while (vuses) + { + pp_string (buffer, "# VUSE <"); + + n = VUSE_NUM (vuses); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, VUSE_OP (vuses, i), spc + 2, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + + pp_string (buffer, ">"); + + if (flags & TDF_MEMSYMS) + dump_symbols (buffer, gimple_loaded_syms (gs), flags); + + newline_and_indent (buffer, spc); + vuses = vuses->next; + } + + vdefs = gimple_vdef_ops (gs); + while (vdefs) + { + pp_string (buffer, "# "); + dump_generic_node (buffer, VDEF_RESULT (vdefs), spc + 2, flags, false); + pp_string (buffer, " = VDEF <"); + + n = VDEF_NUM (vdefs); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, VDEF_OP (vdefs, i), spc + 2, flags, 0); + if (i < n - 1) + pp_string (buffer, ", "); + } + + pp_string (buffer, ">"); + + if ((flags & TDF_MEMSYMS) && vdefs->next == NULL) + dump_symbols (buffer, gimple_stored_syms (gs), flags); + + newline_and_indent (buffer, spc); + vdefs = vdefs->next; + } +} + + +/* Dump the gimple statement GS on the pretty printer BUFFER, SPC + spaces of indent. FLAGS specifies details to show in the dump (see + TDF_* in tree-pass.h). */ + +void +dump_gimple_stmt (pretty_printer *buffer, gimple gs, int spc, int flags) +{ + if (!gs) + return; + + if (flags & TDF_STMTADDR) + pp_printf (buffer, "<&%p> ", (void *) gs); + + if ((flags & TDF_LINENO) && gimple_has_location (gs)) + { + expanded_location xloc = expand_location (gimple_location (gs)); + pp_character (buffer, '['); + if (xloc.file) + { + pp_string (buffer, xloc.file); + pp_string (buffer, " : "); + } + pp_decimal_int (buffer, xloc.line); + pp_string (buffer, "] "); + } + + if ((flags & (TDF_VOPS|TDF_MEMSYMS)) + && gimple_has_mem_ops (gs)) + dump_gimple_mem_ops (buffer, gs, spc, flags); + + switch (gimple_code (gs)) + { + case GIMPLE_ASM: + dump_gimple_asm (buffer, gs, spc, flags); + break; + + case GIMPLE_ASSIGN: + dump_gimple_assign (buffer, gs, spc, flags); + break; + + case GIMPLE_BIND: + dump_gimple_bind (buffer, gs, spc, flags); + break; + + case GIMPLE_CALL: + dump_gimple_call (buffer, gs, spc, flags); + break; + + case GIMPLE_COND: + dump_gimple_cond (buffer, gs, spc, flags); + break; + + case GIMPLE_LABEL: + dump_gimple_label (buffer, gs, spc, flags); + break; + + case GIMPLE_GOTO: + dump_gimple_goto (buffer, gs, spc, flags); + break; + + case GIMPLE_NOP: + pp_string (buffer, "GIMPLE_NOP"); + break; + + case GIMPLE_RETURN: + dump_gimple_return (buffer, gs, spc, flags); + break; + + case GIMPLE_SWITCH: + dump_gimple_switch (buffer, gs, spc, flags); + break; + + case GIMPLE_TRY: + dump_gimple_try (buffer, gs, spc, flags); + break; + + case GIMPLE_PHI: + dump_gimple_phi (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_PARALLEL: + dump_gimple_omp_parallel (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_TASK: + dump_gimple_omp_task (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_ATOMIC_LOAD: + dump_gimple_omp_atomic_load (buffer, gs, spc, flags); + + break; + + case GIMPLE_OMP_ATOMIC_STORE: + dump_gimple_omp_atomic_store (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_FOR: + dump_gimple_omp_for (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_CONTINUE: + dump_gimple_omp_continue (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_SINGLE: + dump_gimple_omp_single (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_RETURN: + dump_gimple_omp_return (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_SECTIONS: + dump_gimple_omp_sections (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_SECTIONS_SWITCH: + pp_string (buffer, "GIMPLE_SECTIONS_SWITCH"); + break; + + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_ORDERED: + case GIMPLE_OMP_SECTION: + dump_gimple_omp_block (buffer, gs, spc, flags); + break; + + case GIMPLE_OMP_CRITICAL: + dump_gimple_omp_critical (buffer, gs, spc, flags); + break; + + case GIMPLE_CHANGE_DYNAMIC_TYPE: + dump_gimple_cdt (buffer, gs, spc, flags); + break; + + case GIMPLE_CATCH: + dump_gimple_catch (buffer, gs, spc, flags); + break; + + case GIMPLE_EH_FILTER: + dump_gimple_eh_filter (buffer, gs, spc, flags); + break; + + case GIMPLE_RESX: + dump_gimple_resx (buffer, gs, spc, flags); + break; + + case GIMPLE_PREDICT: + pp_string (buffer, "// predicted "); + if (gimple_predict_outcome (gs)) + pp_string (buffer, "likely by "); + else + pp_string (buffer, "unlikely by "); + pp_string (buffer, predictor_name (gimple_predict_predictor (gs))); + pp_string (buffer, " predictor."); + break; + + default: + GIMPLE_NIY; + } + + /* If we're building a diagnostic, the formatted text will be + written into BUFFER's stream by the caller; otherwise, write it + now. */ + if (!(flags & TDF_DIAGNOSTIC)) + pp_write_text_to_stream (buffer); +} + + +/* Dumps header of basic block BB to buffer BUFFER indented by INDENT + spaces and details described by flags. */ + +static void +dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags) +{ + edge e; + gimple stmt; + edge_iterator ei; + + if (flags & TDF_BLOCKS) + { + INDENT (indent); + pp_string (buffer, "# BLOCK "); + pp_decimal_int (buffer, bb->index); + if (bb->frequency) + { + pp_string (buffer, " freq:"); + pp_decimal_int (buffer, bb->frequency); + } + if (bb->count) + { + pp_string (buffer, " count:"); + pp_widest_integer (buffer, bb->count); + } + + if (flags & TDF_LINENO) + { + gimple_stmt_iterator gsi; + + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + if (get_lineno (gsi_stmt (gsi)) != -1) + { + pp_string (buffer, ", starting at line "); + pp_decimal_int (buffer, get_lineno (gsi_stmt (gsi))); + break; + } + } + newline_and_indent (buffer, indent); + + pp_string (buffer, "# PRED:"); + pp_write_text_to_stream (buffer); + FOR_EACH_EDGE (e, ei, bb->preds) + if (flags & TDF_SLIM) + { + pp_string (buffer, " "); + if (e->src == ENTRY_BLOCK_PTR) + pp_string (buffer, "ENTRY"); + else + pp_decimal_int (buffer, e->src->index); + } + else + dump_edge_info (buffer->buffer->stream, e, 0); + pp_newline (buffer); + } + else + { + stmt = first_stmt (bb); + if (!stmt || gimple_code (stmt) != GIMPLE_LABEL) + { + INDENT (indent - 2); + pp_string (buffer, "index); + pp_string (buffer, ">:"); + pp_newline (buffer); + } + } + pp_write_text_to_stream (buffer); + check_bb_profile (bb, buffer->buffer->stream); +} + + +/* Dumps end of basic block BB to buffer BUFFER indented by INDENT + spaces. */ + +static void +dump_bb_end (pretty_printer *buffer, basic_block bb, int indent, int flags) +{ + edge e; + edge_iterator ei; + + INDENT (indent); + pp_string (buffer, "# SUCC:"); + pp_write_text_to_stream (buffer); + FOR_EACH_EDGE (e, ei, bb->succs) + if (flags & TDF_SLIM) + { + pp_string (buffer, " "); + if (e->dest == EXIT_BLOCK_PTR) + pp_string (buffer, "EXIT"); + else + pp_decimal_int (buffer, e->dest->index); + } + else + dump_edge_info (buffer->buffer->stream, e, 1); + pp_newline (buffer); +} + + +/* Dump PHI nodes of basic block BB to BUFFER with details described + by FLAGS and indented by INDENT spaces. */ + +static void +dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags) +{ + gimple_stmt_iterator i; + + for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i)) + { + gimple phi = gsi_stmt (i); + if (is_gimple_reg (gimple_phi_result (phi)) || (flags & TDF_VOPS)) + { + INDENT (indent); + pp_string (buffer, "# "); + dump_gimple_phi (buffer, phi, indent, flags); + pp_newline (buffer); + } + } +} + + +/* Dump jump to basic block BB that is represented implicitly in the cfg + to BUFFER. */ + +static void +pp_cfg_jump (pretty_printer *buffer, basic_block bb) +{ + gimple stmt; + + stmt = first_stmt (bb); + + pp_string (buffer, "goto index); + pp_string (buffer, ">"); + if (stmt && gimple_code (stmt) == GIMPLE_LABEL) + { + pp_string (buffer, " ("); + dump_generic_node (buffer, gimple_label_label (stmt), 0, 0, false); + pp_string (buffer, ")"); + pp_semicolon (buffer); + } + else + pp_semicolon (buffer); +} + + +/* Dump edges represented implicitly in basic block BB to BUFFER, indented + by INDENT spaces, with details given by FLAGS. */ + +static void +dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent, + int flags) +{ + edge e; + edge_iterator ei; + gimple stmt; + + stmt = last_stmt (bb); + + if (stmt && gimple_code (stmt) == GIMPLE_COND) + { + edge true_edge, false_edge; + + /* When we are emitting the code or changing CFG, it is possible that + the edges are not yet created. When we are using debug_bb in such + a situation, we do not want it to crash. */ + if (EDGE_COUNT (bb->succs) != 2) + return; + extract_true_false_edges_from_block (bb, &true_edge, &false_edge); + + INDENT (indent + 2); + pp_cfg_jump (buffer, true_edge->dest); + newline_and_indent (buffer, indent); + pp_string (buffer, "else"); + newline_and_indent (buffer, indent + 2); + pp_cfg_jump (buffer, false_edge->dest); + pp_newline (buffer); + return; + } + + /* If there is a fallthru edge, we may need to add an artificial + goto to the dump. */ + FOR_EACH_EDGE (e, ei, bb->succs) + if (e->flags & EDGE_FALLTHRU) + break; + + if (e && e->dest != bb->next_bb) + { + INDENT (indent); + + if ((flags & TDF_LINENO) + && e->goto_locus != UNKNOWN_LOCATION + ) + { + expanded_location goto_xloc; + goto_xloc = expand_location (e->goto_locus); + pp_character (buffer, '['); + if (goto_xloc.file) + { + pp_string (buffer, goto_xloc.file); + pp_string (buffer, " : "); + } + pp_decimal_int (buffer, goto_xloc.line); + pp_string (buffer, "] "); + } + + pp_cfg_jump (buffer, e->dest); + pp_newline (buffer); + } +} + + +/* Dumps basic block BB to buffer BUFFER with details described by FLAGS and + indented by INDENT spaces. */ + +static void +gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent, + int flags) +{ + gimple_stmt_iterator gsi; + gimple stmt; + int label_indent = indent - 2; + + if (label_indent < 0) + label_indent = 0; + + dump_bb_header (buffer, bb, indent, flags); + dump_phi_nodes (buffer, bb, indent, flags); + + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + int curr_indent; + + stmt = gsi_stmt (gsi); + + curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent; + + INDENT (curr_indent); + dump_gimple_stmt (buffer, stmt, curr_indent, flags); + pp_newline (buffer); + dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt); + } + + dump_implicit_edges (buffer, bb, indent, flags); + + if (flags & TDF_BLOCKS) + dump_bb_end (buffer, bb, indent, flags); +} + + +/* Dumps basic block BB to FILE with details described by FLAGS and + indented by INDENT spaces. */ + +void +gimple_dump_bb (basic_block bb, FILE *file, int indent, int flags) +{ + maybe_init_pretty_print (file); + gimple_dump_bb_buff (&buffer, bb, indent, flags); + pp_flush (&buffer); +} diff --git a/gcc/gimple.c b/gcc/gimple.c new file mode 100644 index 00000000000..69cfd4e1db8 --- /dev/null +++ b/gcc/gimple.c @@ -0,0 +1,3144 @@ +/* Gimple IR support functions. + + Copyright 2007, 2008 Free Software Foundation, Inc. + Contributed by Aldy Hernandez + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "ggc.h" +#include "errors.h" +#include "hard-reg-set.h" +#include "basic-block.h" +#include "gimple.h" +#include "diagnostic.h" +#include "tree-flow.h" +#include "value-prof.h" +#include "flags.h" + +#define DEFGSCODE(SYM, NAME, STRUCT) NAME, +const char *const gimple_code_name[] = { +#include "gimple.def" +}; +#undef DEFGSCODE + +/* All the tuples have their operand vector at the very bottom + of the structure. Therefore, the offset required to find the + operands vector the size of the structure minus the size of the 1 + element tree array at the end (see gimple_ops). */ +#define DEFGSCODE(SYM, NAME, STRUCT) (sizeof (STRUCT) - sizeof (tree)), +const size_t gimple_ops_offset_[] = { +#include "gimple.def" +}; +#undef DEFGSCODE + +#ifdef GATHER_STATISTICS +/* Gimple stats. */ + +int gimple_alloc_counts[(int) gimple_alloc_kind_all]; +int gimple_alloc_sizes[(int) gimple_alloc_kind_all]; + +/* Keep in sync with gimple.h:enum gimple_alloc_kind. */ +static const char * const gimple_alloc_kind_names[] = { + "assignments", + "phi nodes", + "conditionals", + "sequences", + "everything else" +}; + +#endif /* GATHER_STATISTICS */ + +/* A cache of gimple_seq objects. Sequences are created and destroyed + fairly often during gimplification. */ +static GTY ((deletable)) struct gimple_seq_d *gimple_seq_cache; + +/* Private API manipulation functions shared only with some + other files. */ +extern void gimple_set_stored_syms (gimple, bitmap, bitmap_obstack *); +extern void gimple_set_loaded_syms (gimple, bitmap, bitmap_obstack *); + +/* Gimple tuple constructors. + Note: Any constructor taking a ``gimple_seq'' as a parameter, can + be passed a NULL to start with an empty sequence. */ + +/* Set the code for statement G to CODE. */ + +static inline void +gimple_set_code (gimple g, enum gimple_code code) +{ + g->gsbase.code = code; +} + + +/* Return the GSS_* identifier for the given GIMPLE statement CODE. */ + +static enum gimple_statement_structure_enum +gss_for_code (enum gimple_code code) +{ + switch (code) + { + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + case GIMPLE_RETURN: return GSS_WITH_MEM_OPS; + case GIMPLE_COND: + case GIMPLE_GOTO: + case GIMPLE_LABEL: + case GIMPLE_CHANGE_DYNAMIC_TYPE: + case GIMPLE_SWITCH: return GSS_WITH_OPS; + case GIMPLE_ASM: return GSS_ASM; + case GIMPLE_BIND: return GSS_BIND; + case GIMPLE_CATCH: return GSS_CATCH; + case GIMPLE_EH_FILTER: return GSS_EH_FILTER; + case GIMPLE_NOP: return GSS_BASE; + case GIMPLE_PHI: return GSS_PHI; + case GIMPLE_RESX: return GSS_RESX; + case GIMPLE_TRY: return GSS_TRY; + case GIMPLE_WITH_CLEANUP_EXPR: return GSS_WCE; + case GIMPLE_OMP_CRITICAL: return GSS_OMP_CRITICAL; + case GIMPLE_OMP_FOR: return GSS_OMP_FOR; + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_ORDERED: + case GIMPLE_OMP_SECTION: return GSS_OMP; + case GIMPLE_OMP_RETURN: + case GIMPLE_OMP_SECTIONS_SWITCH: return GSS_BASE; + case GIMPLE_OMP_CONTINUE: return GSS_OMP_CONTINUE; + case GIMPLE_OMP_PARALLEL: return GSS_OMP_PARALLEL; + case GIMPLE_OMP_TASK: return GSS_OMP_TASK; + case GIMPLE_OMP_SECTIONS: return GSS_OMP_SECTIONS; + case GIMPLE_OMP_SINGLE: return GSS_OMP_SINGLE; + case GIMPLE_OMP_ATOMIC_LOAD: return GSS_OMP_ATOMIC_LOAD; + case GIMPLE_OMP_ATOMIC_STORE: return GSS_OMP_ATOMIC_STORE; + case GIMPLE_PREDICT: return GSS_BASE; + default: gcc_unreachable (); + } +} + + +/* Return the number of bytes needed to hold a GIMPLE statement with + code CODE. */ + +static size_t +gimple_size (enum gimple_code code) +{ + enum gimple_statement_structure_enum gss = gss_for_code (code); + + if (gss == GSS_WITH_OPS) + return sizeof (struct gimple_statement_with_ops); + else if (gss == GSS_WITH_MEM_OPS) + return sizeof (struct gimple_statement_with_memory_ops); + + switch (code) + { + case GIMPLE_ASM: + return sizeof (struct gimple_statement_asm); + case GIMPLE_NOP: + return sizeof (struct gimple_statement_base); + case GIMPLE_BIND: + return sizeof (struct gimple_statement_bind); + case GIMPLE_CATCH: + return sizeof (struct gimple_statement_catch); + case GIMPLE_EH_FILTER: + return sizeof (struct gimple_statement_eh_filter); + case GIMPLE_TRY: + return sizeof (struct gimple_statement_try); + case GIMPLE_RESX: + return sizeof (struct gimple_statement_resx); + case GIMPLE_OMP_CRITICAL: + return sizeof (struct gimple_statement_omp_critical); + case GIMPLE_OMP_FOR: + return sizeof (struct gimple_statement_omp_for); + case GIMPLE_OMP_PARALLEL: + return sizeof (struct gimple_statement_omp_parallel); + case GIMPLE_OMP_TASK: + return sizeof (struct gimple_statement_omp_task); + case GIMPLE_OMP_SECTION: + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_ORDERED: + return sizeof (struct gimple_statement_omp); + case GIMPLE_OMP_RETURN: + return sizeof (struct gimple_statement_base); + case GIMPLE_OMP_CONTINUE: + return sizeof (struct gimple_statement_omp_continue); + case GIMPLE_OMP_SECTIONS: + return sizeof (struct gimple_statement_omp_sections); + case GIMPLE_OMP_SECTIONS_SWITCH: + return sizeof (struct gimple_statement_base); + case GIMPLE_OMP_SINGLE: + return sizeof (struct gimple_statement_omp_single); + case GIMPLE_OMP_ATOMIC_LOAD: + return sizeof (struct gimple_statement_omp_atomic_load); + case GIMPLE_OMP_ATOMIC_STORE: + return sizeof (struct gimple_statement_omp_atomic_store); + case GIMPLE_WITH_CLEANUP_EXPR: + return sizeof (struct gimple_statement_wce); + case GIMPLE_CHANGE_DYNAMIC_TYPE: + return sizeof (struct gimple_statement_with_ops); + case GIMPLE_PREDICT: + return sizeof (struct gimple_statement_base); + default: + break; + } + + gcc_unreachable (); +} + + +/* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS + operands. */ + +#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO) +static gimple +gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL) +{ + size_t size; + gimple stmt; + + size = gimple_size (code); + if (num_ops > 0) + size += sizeof (tree) * (num_ops - 1); + +#ifdef GATHER_STATISTICS + { + enum gimple_alloc_kind kind = gimple_alloc_kind (code); + gimple_alloc_counts[(int) kind]++; + gimple_alloc_sizes[(int) kind] += size; + } +#endif + + stmt = (gimple) ggc_alloc_cleared_stat (size PASS_MEM_STAT); + gimple_set_code (stmt, code); + gimple_set_num_ops (stmt, num_ops); + + /* Do not call gimple_set_modified here as it has other side + effects and this tuple is still not completely built. */ + stmt->gsbase.modified = 1; + + return stmt; +} + +/* Set SUBCODE to be the code of the expression computed by statement G. */ + +static inline void +gimple_set_subcode (gimple g, unsigned subcode) +{ + /* We only have 16 bits for the RHS code. Assert that we are not + overflowing it. */ + gcc_assert (subcode < (1 << 16)); + g->gsbase.subcode = subcode; +} + + + +/* Build a tuple with operands. CODE is the statement to build (which + must be one of the GIMPLE_WITH_OPS tuples). SUBCODE is the sub-code + for the new tuple. NUM_OPS is the number of operands to allocate. */ + +#define gimple_build_with_ops(c, s, n) \ + gimple_build_with_ops_stat (c, s, n MEM_STAT_INFO) + +static gimple +gimple_build_with_ops_stat (enum gimple_code code, enum tree_code subcode, + unsigned num_ops MEM_STAT_DECL) +{ + gimple s = gimple_alloc_stat (code, num_ops PASS_MEM_STAT); + gimple_set_subcode (s, subcode); + + return s; +} + + +/* Build a GIMPLE_RETURN statement returning RETVAL. */ + +gimple +gimple_build_return (tree retval) +{ + gimple s = gimple_build_with_ops (GIMPLE_RETURN, 0, 1); + if (retval) + gimple_return_set_retval (s, retval); + return s; +} + +/* Helper for gimple_build_call, gimple_build_call_vec and + gimple_build_call_from_tree. Build the basic components of a + GIMPLE_CALL statement to function FN with NARGS arguments. */ + +static inline gimple +gimple_build_call_1 (tree fn, unsigned nargs) +{ + gimple s = gimple_build_with_ops (GIMPLE_CALL, 0, nargs + 3); + gimple_set_op (s, 1, fn); + return s; +} + + +/* Build a GIMPLE_CALL statement to function FN with the arguments + specified in vector ARGS. */ + +gimple +gimple_build_call_vec (tree fn, VEC(tree, heap) *args) +{ + unsigned i; + unsigned nargs = VEC_length (tree, args); + gimple call = gimple_build_call_1 (fn, nargs); + + for (i = 0; i < nargs; i++) + gimple_call_set_arg (call, i, VEC_index (tree, args, i)); + + return call; +} + + +/* Build a GIMPLE_CALL statement to function FN. NARGS is the number of + arguments. The ... are the arguments. */ + +gimple +gimple_build_call (tree fn, unsigned nargs, ...) +{ + va_list ap; + gimple call; + unsigned i; + + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL || is_gimple_call_addr (fn)); + + call = gimple_build_call_1 (fn, nargs); + + va_start (ap, nargs); + for (i = 0; i < nargs; i++) + gimple_call_set_arg (call, i, va_arg (ap, tree)); + va_end (ap); + + return call; +} + + +/* Build a GIMPLE_CALL statement from CALL_EXPR T. Note that T is + assumed to be in GIMPLE form already. Minimal checking is done of + this fact. */ + +gimple +gimple_build_call_from_tree (tree t) +{ + unsigned i, nargs; + gimple call; + tree fndecl = get_callee_fndecl (t); + + gcc_assert (TREE_CODE (t) == CALL_EXPR); + + nargs = call_expr_nargs (t); + call = gimple_build_call_1 (fndecl ? fndecl : CALL_EXPR_FN (t), nargs); + + for (i = 0; i < nargs; i++) + gimple_call_set_arg (call, i, CALL_EXPR_ARG (t, i)); + + gimple_set_block (call, TREE_BLOCK (t)); + + /* Carry all the CALL_EXPR flags to the new GIMPLE_CALL. */ + gimple_call_set_chain (call, CALL_EXPR_STATIC_CHAIN (t)); + gimple_call_set_tail (call, CALL_EXPR_TAILCALL (t)); + gimple_call_set_cannot_inline (call, CALL_CANNOT_INLINE_P (t)); + gimple_call_set_return_slot_opt (call, CALL_EXPR_RETURN_SLOT_OPT (t)); + gimple_call_set_from_thunk (call, CALL_FROM_THUNK_P (t)); + gimple_call_set_va_arg_pack (call, CALL_EXPR_VA_ARG_PACK (t)); + + return call; +} + + +/* Extract the operands and code for expression EXPR into *SUBCODE_P, + *OP1_P and *OP2_P respectively. */ + +void +extract_ops_from_tree (tree expr, enum tree_code *subcode_p, tree *op1_p, + tree *op2_p) +{ + enum gimple_rhs_class class; + + *subcode_p = TREE_CODE (expr); + class = get_gimple_rhs_class (*subcode_p); + + if (class == GIMPLE_BINARY_RHS) + { + *op1_p = TREE_OPERAND (expr, 0); + *op2_p = TREE_OPERAND (expr, 1); + } + else if (class == GIMPLE_UNARY_RHS) + { + *op1_p = TREE_OPERAND (expr, 0); + *op2_p = NULL_TREE; + } + else if (class == GIMPLE_SINGLE_RHS) + { + *op1_p = expr; + *op2_p = NULL_TREE; + } + else + gcc_unreachable (); +} + + +/* Build a GIMPLE_ASSIGN statement. + + LHS of the assignment. + RHS of the assignment which can be unary or binary. */ + +gimple +gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL) +{ + enum tree_code subcode; + tree op1, op2; + + extract_ops_from_tree (rhs, &subcode, &op1, &op2); + return gimple_build_assign_with_ops_stat (subcode, lhs, op1, op2 + PASS_MEM_STAT); +} + + +/* Build a GIMPLE_ASSIGN statement with sub-code SUBCODE and operands + OP1 and OP2. If OP2 is NULL then SUBCODE must be of class + GIMPLE_UNARY_RHS or GIMPLE_SINGLE_RHS. */ + +gimple +gimple_build_assign_with_ops_stat (enum tree_code subcode, tree lhs, tree op1, + tree op2 MEM_STAT_DECL) +{ + unsigned num_ops; + gimple p; + + /* Need 1 operand for LHS and 1 or 2 for the RHS (depending on the + code). */ + num_ops = get_gimple_rhs_num_ops (subcode) + 1; + + p = gimple_build_with_ops_stat (GIMPLE_ASSIGN, subcode, num_ops + PASS_MEM_STAT); + gimple_assign_set_lhs (p, lhs); + gimple_assign_set_rhs1 (p, op1); + if (op2) + { + gcc_assert (num_ops > 2); + gimple_assign_set_rhs2 (p, op2); + } + + return p; +} + + +/* Build a new GIMPLE_ASSIGN tuple and append it to the end of *SEQ_P. + + DST/SRC are the destination and source respectively. You can pass + ungimplified trees in DST or SRC, in which case they will be + converted to a gimple operand if necessary. + + This function returns the newly created GIMPLE_ASSIGN tuple. */ + +inline gimple +gimplify_assign (tree dst, tree src, gimple_seq *seq_p) +{ + tree t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); + gimplify_and_add (t, seq_p); + ggc_free (t); + return gimple_seq_last_stmt (*seq_p); +} + + +/* Build a GIMPLE_COND statement. + + PRED is the condition used to compare LHS and the RHS. + T_LABEL is the label to jump to if the condition is true. + F_LABEL is the label to jump to otherwise. */ + +gimple +gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs, + tree t_label, tree f_label) +{ + gimple p; + + gcc_assert (TREE_CODE_CLASS (pred_code) == tcc_comparison); + p = gimple_build_with_ops (GIMPLE_COND, pred_code, 4); + gimple_cond_set_lhs (p, lhs); + gimple_cond_set_rhs (p, rhs); + gimple_cond_set_true_label (p, t_label); + gimple_cond_set_false_label (p, f_label); + return p; +} + + +/* Extract operands for a GIMPLE_COND statement out of COND_EXPR tree COND. */ + +void +gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p, + tree *lhs_p, tree *rhs_p) +{ + gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison + || TREE_CODE (cond) == TRUTH_NOT_EXPR + || is_gimple_min_invariant (cond) + || SSA_VAR_P (cond)); + + extract_ops_from_tree (cond, code_p, lhs_p, rhs_p); + + /* Canonicalize conditionals of the form 'if (!VAL)'. */ + if (*code_p == TRUTH_NOT_EXPR) + { + *code_p = EQ_EXPR; + gcc_assert (*lhs_p && *rhs_p == NULL_TREE); + *rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node); + } + /* Canonicalize conditionals of the form 'if (VAL)' */ + else if (TREE_CODE_CLASS (*code_p) != tcc_comparison) + { + *code_p = NE_EXPR; + gcc_assert (*lhs_p && *rhs_p == NULL_TREE); + *rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node); + } +} + + +/* Build a GIMPLE_COND statement from the conditional expression tree + COND. T_LABEL and F_LABEL are as in gimple_build_cond. */ + +gimple +gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label) +{ + enum tree_code code; + tree lhs, rhs; + + gimple_cond_get_ops_from_tree (cond, &code, &lhs, &rhs); + return gimple_build_cond (code, lhs, rhs, t_label, f_label); +} + +/* Set code, lhs, and rhs of a GIMPLE_COND from a suitable + boolean expression tree COND. */ + +void +gimple_cond_set_condition_from_tree (gimple stmt, tree cond) +{ + enum tree_code code; + tree lhs, rhs; + + gimple_cond_get_ops_from_tree (cond, &code, &lhs, &rhs); + gimple_cond_set_condition (stmt, code, lhs, rhs); +} + +/* Build a GIMPLE_LABEL statement for LABEL. */ + +gimple +gimple_build_label (tree label) +{ + gimple p = gimple_build_with_ops (GIMPLE_LABEL, 0, 1); + gimple_label_set_label (p, label); + return p; +} + +/* Build a GIMPLE_GOTO statement to label DEST. */ + +gimple +gimple_build_goto (tree dest) +{ + gimple p = gimple_build_with_ops (GIMPLE_GOTO, 0, 1); + gimple_goto_set_dest (p, dest); + return p; +} + + +/* Build a GIMPLE_NOP statement. */ + +gimple +gimple_build_nop (void) +{ + return gimple_alloc (GIMPLE_NOP, 0); +} + + +/* Build a GIMPLE_BIND statement. + VARS are the variables in BODY. + BLOCK is the containing block. */ + +gimple +gimple_build_bind (tree vars, gimple_seq body, tree block) +{ + gimple p = gimple_alloc (GIMPLE_BIND, 0); + gimple_bind_set_vars (p, vars); + if (body) + gimple_bind_set_body (p, body); + if (block) + gimple_bind_set_block (p, block); + return p; +} + +/* Helper function to set the simple fields of a asm stmt. + + STRING is a pointer to a string that is the asm blocks assembly code. + NINPUT is the number of register inputs. + NOUTPUT is the number of register outputs. + NCLOBBERS is the number of clobbered registers. + */ + +static inline gimple +gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs, + unsigned nclobbers) +{ + gimple p; + int size = strlen (string); + + p = gimple_build_with_ops (GIMPLE_ASM, 0, ninputs + noutputs + nclobbers); + + p->gimple_asm.ni = ninputs; + p->gimple_asm.no = noutputs; + p->gimple_asm.nc = nclobbers; + p->gimple_asm.string = ggc_alloc_string (string, size); + +#ifdef GATHER_STATISTICS + gimple_alloc_sizes[(int) gimple_alloc_kind (GIMPLE_ASM)] += size; +#endif + + return p; +} + +/* Build a GIMPLE_ASM statement. + + STRING is the assembly code. + NINPUT is the number of register inputs. + NOUTPUT is the number of register outputs. + NCLOBBERS is the number of clobbered registers. + INPUTS is a vector of the input register parameters. + OUTPUTS is a vector of the output register parameters. + CLOBBERS is a vector of the clobbered register parameters. */ + +gimple +gimple_build_asm_vec (const char *string, VEC(tree,gc)* inputs, + VEC(tree,gc)* outputs, VEC(tree,gc)* clobbers) +{ + gimple p; + unsigned i; + + p = gimple_build_asm_1 (string, + VEC_length (tree, inputs), + VEC_length (tree, outputs), + VEC_length (tree, clobbers)); + + for (i = 0; i < VEC_length (tree, inputs); i++) + gimple_asm_set_input_op (p, i, VEC_index (tree, inputs, i)); + + for (i = 0; i < VEC_length (tree, outputs); i++) + gimple_asm_set_output_op (p, i, VEC_index (tree, outputs, i)); + + for (i = 0; i < VEC_length (tree, clobbers); i++) + gimple_asm_set_clobber_op (p, i, VEC_index (tree, clobbers, i)); + + return p; +} + +/* Build a GIMPLE_ASM statement. + + STRING is the assembly code. + NINPUT is the number of register inputs. + NOUTPUT is the number of register outputs. + NCLOBBERS is the number of clobbered registers. + ... are trees for each input, output and clobbered register. */ + +gimple +gimple_build_asm (const char *string, unsigned ninputs, unsigned noutputs, + unsigned nclobbers, ...) +{ + gimple p; + unsigned i; + va_list ap; + + p = gimple_build_asm_1 (string, ninputs, noutputs, nclobbers); + + va_start (ap, nclobbers); + + for (i = 0; i < ninputs; i++) + gimple_asm_set_input_op (p, i, va_arg (ap, tree)); + + for (i = 0; i < noutputs; i++) + gimple_asm_set_output_op (p, i, va_arg (ap, tree)); + + for (i = 0; i < nclobbers; i++) + gimple_asm_set_clobber_op (p, i, va_arg (ap, tree)); + + va_end (ap); + + return p; +} + +/* Build a GIMPLE_CATCH statement. + + TYPES are the catch types. + HANDLER is the exception handler. */ + +gimple +gimple_build_catch (tree types, gimple_seq handler) +{ + gimple p = gimple_alloc (GIMPLE_CATCH, 0); + gimple_catch_set_types (p, types); + if (handler) + gimple_catch_set_handler (p, handler); + + return p; +} + +/* Build a GIMPLE_EH_FILTER statement. + + TYPES are the filter's types. + FAILURE is the filter's failure action. */ + +gimple +gimple_build_eh_filter (tree types, gimple_seq failure) +{ + gimple p = gimple_alloc (GIMPLE_EH_FILTER, 0); + gimple_eh_filter_set_types (p, types); + if (failure) + gimple_eh_filter_set_failure (p, failure); + + return p; +} + +/* Build a GIMPLE_TRY statement. + + EVAL is the expression to evaluate. + CLEANUP is the cleanup expression. + KIND is either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY depending on + whether this is a try/catch or a try/finally respectively. */ + +gimple +gimple_build_try (gimple_seq eval, gimple_seq cleanup, + enum gimple_try_flags kind) +{ + gimple p; + + gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY); + p = gimple_alloc (GIMPLE_TRY, 0); + gimple_set_subcode (p, kind); + if (eval) + gimple_try_set_eval (p, eval); + if (cleanup) + gimple_try_set_cleanup (p, cleanup); + + return p; +} + +/* Construct a GIMPLE_WITH_CLEANUP_EXPR statement. + + CLEANUP is the cleanup expression. */ + +gimple +gimple_build_wce (gimple_seq cleanup) +{ + gimple p = gimple_alloc (GIMPLE_WITH_CLEANUP_EXPR, 0); + if (cleanup) + gimple_wce_set_cleanup (p, cleanup); + + return p; +} + + +/* Build a GIMPLE_RESX statement. + + REGION is the region number from which this resx causes control flow to + leave. */ + +gimple +gimple_build_resx (int region) +{ + gimple p = gimple_alloc (GIMPLE_RESX, 0); + gimple_resx_set_region (p, region); + return p; +} + + +/* The helper for constructing a gimple switch statement. + INDEX is the switch's index. + NLABELS is the number of labels in the switch excluding the default. + DEFAULT_LABEL is the default label for the switch statement. */ + +static inline gimple +gimple_build_switch_1 (unsigned nlabels, tree index, tree default_label) +{ + /* nlabels + 1 default label + 1 index. */ + gimple p = gimple_build_with_ops (GIMPLE_SWITCH, 0, nlabels + 1 + 1); + gimple_switch_set_index (p, index); + gimple_switch_set_default_label (p, default_label); + return p; +} + + +/* Build a GIMPLE_SWITCH statement. + + INDEX is the switch's index. + NLABELS is the number of labels in the switch excluding the DEFAULT_LABEL. + ... are the labels excluding the default. */ + +gimple +gimple_build_switch (unsigned nlabels, tree index, tree default_label, ...) +{ + va_list al; + unsigned i; + gimple p; + + p = gimple_build_switch_1 (nlabels, index, default_label); + + /* Store the rest of the labels. */ + va_start (al, default_label); + for (i = 1; i <= nlabels; i++) + gimple_switch_set_label (p, i, va_arg (al, tree)); + va_end (al); + + return p; +} + + +/* Build a GIMPLE_SWITCH statement. + + INDEX is the switch's index. + DEFAULT_LABEL is the default label + ARGS is a vector of labels excluding the default. */ + +gimple +gimple_build_switch_vec (tree index, tree default_label, VEC(tree, heap) *args) +{ + unsigned i; + unsigned nlabels = VEC_length (tree, args); + gimple p = gimple_build_switch_1 (nlabels, index, default_label); + + /* Put labels in labels[1 - (nlabels + 1)]. + Default label is in labels[0]. */ + for (i = 1; i <= nlabels; i++) + gimple_switch_set_label (p, i, VEC_index (tree, args, i - 1)); + + return p; +} + + +/* Build a GIMPLE_OMP_CRITICAL statement. + + BODY is the sequence of statements for which only one thread can execute. + NAME is optional identifier for this critical block. */ + +gimple +gimple_build_omp_critical (gimple_seq body, tree name) +{ + gimple p = gimple_alloc (GIMPLE_OMP_CRITICAL, 0); + gimple_omp_critical_set_name (p, name); + if (body) + gimple_omp_set_body (p, body); + + return p; +} + +/* Build a GIMPLE_OMP_FOR statement. + + BODY is sequence of statements inside the for loop. + CLAUSES, are any of the OMP loop construct's clauses: private, firstprivate, + lastprivate, reductions, ordered, schedule, and nowait. + COLLAPSE is the collapse count. + PRE_BODY is the sequence of statements that are loop invariant. */ + +gimple +gimple_build_omp_for (gimple_seq body, tree clauses, size_t collapse, + gimple_seq pre_body) +{ + gimple p = gimple_alloc (GIMPLE_OMP_FOR, 0); + if (body) + gimple_omp_set_body (p, body); + gimple_omp_for_set_clauses (p, clauses); + p->gimple_omp_for.collapse = collapse; + p->gimple_omp_for.iter = GGC_CNEWVEC (struct gimple_omp_for_iter, collapse); + if (pre_body) + gimple_omp_for_set_pre_body (p, pre_body); + + return p; +} + + +/* Build a GIMPLE_OMP_PARALLEL statement. + + BODY is sequence of statements which are executed in parallel. + CLAUSES, are the OMP parallel construct's clauses. + CHILD_FN is the function created for the parallel threads to execute. + DATA_ARG are the shared data argument(s). */ + +gimple +gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn, + tree data_arg) +{ + gimple p = gimple_alloc (GIMPLE_OMP_PARALLEL, 0); + if (body) + gimple_omp_set_body (p, body); + gimple_omp_parallel_set_clauses (p, clauses); + gimple_omp_parallel_set_child_fn (p, child_fn); + gimple_omp_parallel_set_data_arg (p, data_arg); + + return p; +} + + +/* Build a GIMPLE_OMP_TASK statement. + + BODY is sequence of statements which are executed by the explicit task. + CLAUSES, are the OMP parallel construct's clauses. + CHILD_FN is the function created for the parallel threads to execute. + DATA_ARG are the shared data argument(s). + COPY_FN is the optional function for firstprivate initialization. + ARG_SIZE and ARG_ALIGN are size and alignment of the data block. */ + +gimple +gimple_build_omp_task (gimple_seq body, tree clauses, tree child_fn, + tree data_arg, tree copy_fn, tree arg_size, + tree arg_align) +{ + gimple p = gimple_alloc (GIMPLE_OMP_TASK, 0); + if (body) + gimple_omp_set_body (p, body); + gimple_omp_task_set_clauses (p, clauses); + gimple_omp_task_set_child_fn (p, child_fn); + gimple_omp_task_set_data_arg (p, data_arg); + gimple_omp_task_set_copy_fn (p, copy_fn); + gimple_omp_task_set_arg_size (p, arg_size); + gimple_omp_task_set_arg_align (p, arg_align); + + return p; +} + + +/* Build a GIMPLE_OMP_SECTION statement for a sections statement. + + BODY is the sequence of statements in the section. */ + +gimple +gimple_build_omp_section (gimple_seq body) +{ + gimple p = gimple_alloc (GIMPLE_OMP_SECTION, 0); + if (body) + gimple_omp_set_body (p, body); + + return p; +} + + +/* Build a GIMPLE_OMP_MASTER statement. + + BODY is the sequence of statements to be executed by just the master. */ + +gimple +gimple_build_omp_master (gimple_seq body) +{ + gimple p = gimple_alloc (GIMPLE_OMP_MASTER, 0); + if (body) + gimple_omp_set_body (p, body); + + return p; +} + + +/* Build a GIMPLE_OMP_CONTINUE statement. + + CONTROL_DEF is the definition of the control variable. + CONTROL_USE is the use of the control variable. */ + +gimple +gimple_build_omp_continue (tree control_def, tree control_use) +{ + gimple p = gimple_alloc (GIMPLE_OMP_CONTINUE, 0); + gimple_omp_continue_set_control_def (p, control_def); + gimple_omp_continue_set_control_use (p, control_use); + return p; +} + +/* Build a GIMPLE_OMP_ORDERED statement. + + BODY is the sequence of statements inside a loop that will executed in + sequence. */ + +gimple +gimple_build_omp_ordered (gimple_seq body) +{ + gimple p = gimple_alloc (GIMPLE_OMP_ORDERED, 0); + if (body) + gimple_omp_set_body (p, body); + + return p; +} + + +/* Build a GIMPLE_OMP_RETURN statement. + WAIT_P is true if this is a non-waiting return. */ + +gimple +gimple_build_omp_return (bool wait_p) +{ + gimple p = gimple_alloc (GIMPLE_OMP_RETURN, 0); + if (wait_p) + gimple_omp_return_set_nowait (p); + + return p; +} + + +/* Build a GIMPLE_OMP_SECTIONS statement. + + BODY is a sequence of section statements. + CLAUSES are any of the OMP sections contsruct's clauses: private, + firstprivate, lastprivate, reduction, and nowait. */ + +gimple +gimple_build_omp_sections (gimple_seq body, tree clauses) +{ + gimple p = gimple_alloc (GIMPLE_OMP_SECTIONS, 0); + if (body) + gimple_omp_set_body (p, body); + gimple_omp_sections_set_clauses (p, clauses); + + return p; +} + + +/* Build a GIMPLE_OMP_SECTIONS_SWITCH. */ + +gimple +gimple_build_omp_sections_switch (void) +{ + return gimple_alloc (GIMPLE_OMP_SECTIONS_SWITCH, 0); +} + + +/* Build a GIMPLE_OMP_SINGLE statement. + + BODY is the sequence of statements that will be executed once. + CLAUSES are any of the OMP single construct's clauses: private, firstprivate, + copyprivate, nowait. */ + +gimple +gimple_build_omp_single (gimple_seq body, tree clauses) +{ + gimple p = gimple_alloc (GIMPLE_OMP_SINGLE, 0); + if (body) + gimple_omp_set_body (p, body); + gimple_omp_single_set_clauses (p, clauses); + + return p; +} + + +/* Build a GIMPLE_CHANGE_DYNAMIC_TYPE statement. TYPE is the new type + for the location PTR. */ + +gimple +gimple_build_cdt (tree type, tree ptr) +{ + gimple p = gimple_build_with_ops (GIMPLE_CHANGE_DYNAMIC_TYPE, 0, 2); + gimple_cdt_set_new_type (p, type); + gimple_cdt_set_location (p, ptr); + + return p; +} + + +/* Build a GIMPLE_OMP_ATOMIC_LOAD statement. */ + +gimple +gimple_build_omp_atomic_load (tree lhs, tree rhs) +{ + gimple p = gimple_alloc (GIMPLE_OMP_ATOMIC_LOAD, 0); + gimple_omp_atomic_load_set_lhs (p, lhs); + gimple_omp_atomic_load_set_rhs (p, rhs); + return p; +} + +/* Build a GIMPLE_OMP_ATOMIC_STORE statement. + + VAL is the value we are storing. */ + +gimple +gimple_build_omp_atomic_store (tree val) +{ + gimple p = gimple_alloc (GIMPLE_OMP_ATOMIC_STORE, 0); + gimple_omp_atomic_store_set_val (p, val); + return p; +} + +/* Build a GIMPLE_PREDICT statement. PREDICT is one of the predictors from + predict.def, OUTCOME is NOT_TAKEN or TAKEN. */ + +gimple +gimple_build_predict (enum br_predictor predictor, enum prediction outcome) +{ + gimple p = gimple_alloc (GIMPLE_PREDICT, 0); + /* Ensure all the predictors fit into the lower bits of the subcode. */ + gcc_assert (END_PREDICTORS <= GF_PREDICT_TAKEN); + gimple_predict_set_predictor (p, predictor); + gimple_predict_set_outcome (p, outcome); + return p; +} + +/* Return which gimple structure is used by T. The enums here are defined + in gsstruct.def. */ + +enum gimple_statement_structure_enum +gimple_statement_structure (gimple gs) +{ + return gss_for_code (gimple_code (gs)); +} + +#if defined ENABLE_GIMPLE_CHECKING && (GCC_VERSION >= 2007) +/* Complain of a gimple type mismatch and die. */ + +void +gimple_check_failed (const_gimple gs, const char *file, int line, + const char *function, enum gimple_code code, + enum tree_code subcode) +{ + internal_error ("gimple check: expected %s(%s), have %s(%s) in %s, at %s:%d", + gimple_code_name[code], + tree_code_name[subcode], + gimple_code_name[gimple_code (gs)], + gs->gsbase.subcode > 0 + ? tree_code_name[gs->gsbase.subcode] + : "", + function, trim_filename (file), line); +} + + +/* Similar to gimple_check_failed, except that instead of specifying a + dozen codes, use the knowledge that they're all sequential. */ + +void +gimple_range_check_failed (const_gimple gs, const char *file, int line, + const char *function, enum gimple_code c1, + enum gimple_code c2) +{ + char *buffer; + unsigned length = 0; + enum gimple_code c; + + for (c = c1; c <= c2; ++c) + length += 4 + strlen (gimple_code_name[c]); + + length += strlen ("expected "); + buffer = XALLOCAVAR (char, length); + length = 0; + + for (c = c1; c <= c2; ++c) + { + const char *prefix = length ? " or " : "expected "; + + strcpy (buffer + length, prefix); + length += strlen (prefix); + strcpy (buffer + length, gimple_code_name[c]); + length += strlen (gimple_code_name[c]); + } + + internal_error ("gimple check: %s, have %s in %s, at %s:%d", + buffer, gimple_code_name[gimple_code (gs)], + function, trim_filename (file), line); +} +#endif /* ENABLE_GIMPLE_CHECKING */ + + +/* Allocate a new GIMPLE sequence in GC memory and return it. If + there are free sequences in GIMPLE_SEQ_CACHE return one of those + instead. */ + +gimple_seq +gimple_seq_alloc (void) +{ + gimple_seq seq = gimple_seq_cache; + if (seq) + { + gimple_seq_cache = gimple_seq_cache->next_free; + gcc_assert (gimple_seq_cache != seq); + memset (seq, 0, sizeof (*seq)); + } + else + { + seq = (gimple_seq) ggc_alloc_cleared (sizeof (*seq)); +#ifdef GATHER_STATISTICS + gimple_alloc_counts[(int) gimple_alloc_kind_seq]++; + gimple_alloc_sizes[(int) gimple_alloc_kind_seq] += sizeof (*seq); +#endif + } + + return seq; +} + +/* Return SEQ to the free pool of GIMPLE sequences. */ + +void +gimple_seq_free (gimple_seq seq) +{ + if (seq == NULL) + return; + + gcc_assert (gimple_seq_first (seq) == NULL); + gcc_assert (gimple_seq_last (seq) == NULL); + + /* If this triggers, it's a sign that the same list is being freed + twice. */ + gcc_assert (seq != gimple_seq_cache || gimple_seq_cache == NULL); + + /* Add SEQ to the pool of free sequences. */ + seq->next_free = gimple_seq_cache; + gimple_seq_cache = seq; +} + + +/* Link gimple statement GS to the end of the sequence *SEQ_P. If + *SEQ_P is NULL, a new sequence is allocated. */ + +void +gimple_seq_add_stmt (gimple_seq *seq_p, gimple gs) +{ + gimple_stmt_iterator si; + + if (gs == NULL) + return; + + if (*seq_p == NULL) + *seq_p = gimple_seq_alloc (); + + si = gsi_last (*seq_p); + gsi_insert_after (&si, gs, GSI_NEW_STMT); +} + + +/* Append sequence SRC to the end of sequence *DST_P. If *DST_P is + NULL, a new sequence is allocated. */ + +void +gimple_seq_add_seq (gimple_seq *dst_p, gimple_seq src) +{ + gimple_stmt_iterator si; + + if (src == NULL) + return; + + if (*dst_p == NULL) + *dst_p = gimple_seq_alloc (); + + si = gsi_last (*dst_p); + gsi_insert_seq_after (&si, src, GSI_NEW_STMT); +} + + +/* Helper function of empty_body_p. Return true if STMT is an empty + statement. */ + +static bool +empty_stmt_p (gimple stmt) +{ + if (gimple_code (stmt) == GIMPLE_NOP) + return true; + if (gimple_code (stmt) == GIMPLE_BIND) + return empty_body_p (gimple_bind_body (stmt)); + return false; +} + + +/* Return true if BODY contains nothing but empty statements. */ + +bool +empty_body_p (gimple_seq body) +{ + gimple_stmt_iterator i; + + + if (gimple_seq_empty_p (body)) + return true; + for (i = gsi_start (body); !gsi_end_p (i); gsi_next (&i)) + if (!empty_stmt_p (gsi_stmt (i))) + return false; + + return true; +} + + +/* Perform a deep copy of sequence SRC and return the result. */ + +gimple_seq +gimple_seq_copy (gimple_seq src) +{ + gimple_stmt_iterator gsi; + gimple_seq new = gimple_seq_alloc (); + gimple stmt; + + for (gsi = gsi_start (src); !gsi_end_p (gsi); gsi_next (&gsi)) + { + stmt = gimple_copy (gsi_stmt (gsi)); + gimple_seq_add_stmt (&new, stmt); + } + + return new; +} + + +/* Walk all the statements in the sequence SEQ calling walk_gimple_stmt + on each one. WI is as in walk_gimple_stmt. + + If walk_gimple_stmt returns non-NULL, the walk is stopped, the + value is stored in WI->CALLBACK_RESULT and the statement that + produced the value is returned. + + Otherwise, all the statements are walked and NULL returned. */ + +gimple +walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt, + walk_tree_fn callback_op, struct walk_stmt_info *wi) +{ + gimple_stmt_iterator gsi; + + for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi)) + { + tree ret = walk_gimple_stmt (&gsi, callback_stmt, callback_op, wi); + if (ret) + { + /* If CALLBACK_STMT or CALLBACK_OP return a value, WI must exist + to hold it. */ + gcc_assert (wi); + wi->callback_result = ret; + return gsi_stmt (gsi); + } + } + + if (wi) + wi->callback_result = NULL_TREE; + + return NULL; +} + + +/* Helper function for walk_gimple_stmt. Walk operands of a GIMPLE_ASM. */ + +static tree +walk_gimple_asm (gimple stmt, walk_tree_fn callback_op, + struct walk_stmt_info *wi) +{ + tree ret; + unsigned noutputs; + const char **oconstraints; + unsigned i; + const char *constraint; + bool allows_mem, allows_reg, is_inout; + + noutputs = gimple_asm_noutputs (stmt); + oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *)); + + if (wi) + wi->is_lhs = true; + + for (i = 0; i < noutputs; i++) + { + tree op = gimple_asm_output_op (stmt, i); + constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); + oconstraints[i] = constraint; + parse_output_constraint (&constraint, i, 0, 0, &allows_mem, &allows_reg, + &is_inout); + if (wi) + wi->val_only = (allows_reg || !allows_mem); + ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL); + if (ret) + return ret; + } + + for (i = 0; i < gimple_asm_ninputs (stmt); i++) + { + tree op = gimple_asm_input_op (stmt, i); + constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); + parse_input_constraint (&constraint, 0, 0, noutputs, 0, + oconstraints, &allows_mem, &allows_reg); + if (wi) + wi->val_only = (allows_reg || !allows_mem); + + /* Although input "m" is not really a LHS, we need a lvalue. */ + if (wi) + wi->is_lhs = !wi->val_only; + ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL); + if (ret) + return ret; + } + + if (wi) + { + wi->is_lhs = false; + wi->val_only = true; + } + + return NULL_TREE; +} + + +/* Helper function of WALK_GIMPLE_STMT. Walk every tree operand in + STMT. CALLBACK_OP and WI are as in WALK_GIMPLE_STMT. + + CALLBACK_OP is called on each operand of STMT via walk_tree. + Additional parameters to walk_tree must be stored in WI. For each operand + OP, walk_tree is called as: + + walk_tree (&OP, CALLBACK_OP, WI, WI->PSET) + + If CALLBACK_OP returns non-NULL for an operand, the remaining + operands are not scanned. + + The return value is that returned by the last call to walk_tree, or + NULL_TREE if no CALLBACK_OP is specified. */ + +inline tree +walk_gimple_op (gimple stmt, walk_tree_fn callback_op, + struct walk_stmt_info *wi) +{ + struct pointer_set_t *pset = (wi) ? wi->pset : NULL; + unsigned i; + tree ret = NULL_TREE; + + switch (gimple_code (stmt)) + { + case GIMPLE_ASSIGN: + /* Walk the RHS operands. A formal temporary LHS may use a + COMPONENT_REF RHS. */ + if (wi) + wi->val_only = !is_gimple_formal_tmp_var (gimple_assign_lhs (stmt)); + + for (i = 1; i < gimple_num_ops (stmt); i++) + { + ret = walk_tree (gimple_op_ptr (stmt, i), callback_op, wi, + pset); + if (ret) + return ret; + } + + /* Walk the LHS. If the RHS is appropriate for a memory, we + may use a COMPONENT_REF on the LHS. */ + if (wi) + { + /* If the RHS has more than 1 operand, it is not appropriate + for the memory. */ + wi->val_only = !is_gimple_mem_rhs (gimple_assign_rhs1 (stmt)) + || !gimple_assign_single_p (stmt); + wi->is_lhs = true; + } + + ret = walk_tree (gimple_op_ptr (stmt, 0), callback_op, wi, pset); + if (ret) + return ret; + + if (wi) + { + wi->val_only = true; + wi->is_lhs = false; + } + break; + + case GIMPLE_CALL: + if (wi) + wi->is_lhs = false; + + ret = walk_tree (gimple_call_chain_ptr (stmt), callback_op, wi, pset); + if (ret) + return ret; + + ret = walk_tree (gimple_call_fn_ptr (stmt), callback_op, wi, pset); + if (ret) + return ret; + + for (i = 0; i < gimple_call_num_args (stmt); i++) + { + ret = walk_tree (gimple_call_arg_ptr (stmt, i), callback_op, wi, + pset); + if (ret) + return ret; + } + + if (wi) + wi->is_lhs = true; + + ret = walk_tree (gimple_call_lhs_ptr (stmt), callback_op, wi, pset); + if (ret) + return ret; + + if (wi) + wi->is_lhs = false; + break; + + case GIMPLE_CATCH: + ret = walk_tree (gimple_catch_types_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + break; + + case GIMPLE_EH_FILTER: + ret = walk_tree (gimple_eh_filter_types_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + break; + + case GIMPLE_CHANGE_DYNAMIC_TYPE: + ret = walk_tree (gimple_cdt_location_ptr (stmt), callback_op, wi, pset); + if (ret) + return ret; + + ret = walk_tree (gimple_cdt_new_type_ptr (stmt), callback_op, wi, pset); + if (ret) + return ret; + break; + + case GIMPLE_ASM: + ret = walk_gimple_asm (stmt, callback_op, wi); + if (ret) + return ret; + break; + + case GIMPLE_OMP_CONTINUE: + ret = walk_tree (gimple_omp_continue_control_def_ptr (stmt), + callback_op, wi, pset); + if (ret) + return ret; + + ret = walk_tree (gimple_omp_continue_control_use_ptr (stmt), + callback_op, wi, pset); + if (ret) + return ret; + break; + + case GIMPLE_OMP_CRITICAL: + ret = walk_tree (gimple_omp_critical_name_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + break; + + case GIMPLE_OMP_FOR: + ret = walk_tree (gimple_omp_for_clauses_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + for (i = 0; i < gimple_omp_for_collapse (stmt); i++) + { + ret = walk_tree (gimple_omp_for_index_ptr (stmt, i), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_for_initial_ptr (stmt, i), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_for_final_ptr (stmt, i), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_for_incr_ptr (stmt, i), callback_op, + wi, pset); + } + if (ret) + return ret; + break; + + case GIMPLE_OMP_PARALLEL: + ret = walk_tree (gimple_omp_parallel_clauses_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_parallel_child_fn_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_parallel_data_arg_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + break; + + case GIMPLE_OMP_TASK: + ret = walk_tree (gimple_omp_task_clauses_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_task_child_fn_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_task_data_arg_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_task_copy_fn_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_task_arg_size_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + ret = walk_tree (gimple_omp_task_arg_align_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + break; + + case GIMPLE_OMP_SECTIONS: + ret = walk_tree (gimple_omp_sections_clauses_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + + ret = walk_tree (gimple_omp_sections_control_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + + break; + + case GIMPLE_OMP_SINGLE: + ret = walk_tree (gimple_omp_single_clauses_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + break; + + case GIMPLE_OMP_ATOMIC_LOAD: + ret = walk_tree (gimple_omp_atomic_load_lhs_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + + ret = walk_tree (gimple_omp_atomic_load_rhs_ptr (stmt), callback_op, wi, + pset); + if (ret) + return ret; + break; + + case GIMPLE_OMP_ATOMIC_STORE: + ret = walk_tree (gimple_omp_atomic_store_val_ptr (stmt), callback_op, + wi, pset); + if (ret) + return ret; + break; + + /* Tuples that do not have operands. */ + case GIMPLE_NOP: + case GIMPLE_RESX: + case GIMPLE_OMP_RETURN: + case GIMPLE_PREDICT: + break; + + default: + { + enum gimple_statement_structure_enum gss; + gss = gimple_statement_structure (stmt); + if (gss == GSS_WITH_OPS || gss == GSS_WITH_MEM_OPS) + for (i = 0; i < gimple_num_ops (stmt); i++) + { + ret = walk_tree (gimple_op_ptr (stmt, i), callback_op, wi, pset); + if (ret) + return ret; + } + } + break; + } + + return NULL_TREE; +} + + +/* Walk the current statement in GSI (optionally using traversal state + stored in WI). If WI is NULL, no state is kept during traversal. + The callback CALLBACK_STMT is called. If CALLBACK_STMT indicates + that it has handled all the operands of the statement, its return + value is returned. Otherwise, the return value from CALLBACK_STMT + is discarded and its operands are scanned. + + If CALLBACK_STMT is NULL or it didn't handle the operands, + CALLBACK_OP is called on each operand of the statement via + walk_gimple_op. If walk_gimple_op returns non-NULL for any + operand, the remaining operands are not scanned. In this case, the + return value from CALLBACK_OP is returned. + + In any other case, NULL_TREE is returned. */ + +tree +walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, + walk_tree_fn callback_op, struct walk_stmt_info *wi) +{ + gimple ret; + tree tree_ret; + gimple stmt = gsi_stmt (*gsi); + + if (wi) + wi->gsi = *gsi; + + if (wi && wi->want_locations && gimple_has_location (stmt)) + input_location = gimple_location (stmt); + + ret = NULL; + + /* Invoke the statement callback. Return if the callback handled + all of STMT operands by itself. */ + if (callback_stmt) + { + bool handled_ops = false; + tree_ret = callback_stmt (gsi, &handled_ops, wi); + if (handled_ops) + return tree_ret; + + /* If CALLBACK_STMT did not handle operands, it should not have + a value to return. */ + gcc_assert (tree_ret == NULL); + + /* Re-read stmt in case the callback changed it. */ + stmt = gsi_stmt (*gsi); + } + + /* If CALLBACK_OP is defined, invoke it on every operand of STMT. */ + if (callback_op) + { + tree_ret = walk_gimple_op (stmt, callback_op, wi); + if (tree_ret) + return tree_ret; + } + + /* If STMT can have statements inside (e.g. GIMPLE_BIND), walk them. */ + switch (gimple_code (stmt)) + { + case GIMPLE_BIND: + ret = walk_gimple_seq (gimple_bind_body (stmt), callback_stmt, + callback_op, wi); + if (ret) + return wi->callback_result; + break; + + case GIMPLE_CATCH: + ret = walk_gimple_seq (gimple_catch_handler (stmt), callback_stmt, + callback_op, wi); + if (ret) + return wi->callback_result; + break; + + case GIMPLE_EH_FILTER: + ret = walk_gimple_seq (gimple_eh_filter_failure (stmt), callback_stmt, + callback_op, wi); + if (ret) + return wi->callback_result; + break; + + case GIMPLE_TRY: + ret = walk_gimple_seq (gimple_try_eval (stmt), callback_stmt, callback_op, + wi); + if (ret) + return wi->callback_result; + + ret = walk_gimple_seq (gimple_try_cleanup (stmt), callback_stmt, + callback_op, wi); + if (ret) + return wi->callback_result; + break; + + case GIMPLE_OMP_FOR: + ret = walk_gimple_seq (gimple_omp_for_pre_body (stmt), callback_stmt, + callback_op, wi); + if (ret) + return wi->callback_result; + + /* FALL THROUGH. */ + case GIMPLE_OMP_CRITICAL: + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_ORDERED: + case GIMPLE_OMP_SECTION: + case GIMPLE_OMP_PARALLEL: + case GIMPLE_OMP_TASK: + case GIMPLE_OMP_SECTIONS: + case GIMPLE_OMP_SINGLE: + ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op, + wi); + if (ret) + return wi->callback_result; + break; + + case GIMPLE_WITH_CLEANUP_EXPR: + ret = walk_gimple_seq (gimple_wce_cleanup (stmt), callback_stmt, + callback_op, wi); + if (ret) + return wi->callback_result; + break; + + default: + gcc_assert (!gimple_has_substatements (stmt)); + break; + } + + return NULL; +} + + +/* Set sequence SEQ to be the GIMPLE body for function FN. */ + +void +gimple_set_body (tree fndecl, gimple_seq seq) +{ + struct function *fn = DECL_STRUCT_FUNCTION (fndecl); + if (fn == NULL) + { + /* If FNDECL still does not have a function structure associated + with it, then it does not make sense for it to receive a + GIMPLE body. */ + gcc_assert (seq == NULL); + } + else + fn->gimple_body = seq; +} + + +/* Return the body of GIMPLE statements for function FN. */ + +gimple_seq +gimple_body (tree fndecl) +{ + struct function *fn = DECL_STRUCT_FUNCTION (fndecl); + return fn ? fn->gimple_body : NULL; +} + + +/* Detect flags from a GIMPLE_CALL. This is just like + call_expr_flags, but for gimple tuples. */ + +int +gimple_call_flags (const_gimple stmt) +{ + int flags; + tree decl = gimple_call_fndecl (stmt); + tree t; + + if (decl) + flags = flags_from_decl_or_type (decl); + else + { + t = TREE_TYPE (gimple_call_fn (stmt)); + if (t && TREE_CODE (t) == POINTER_TYPE) + flags = flags_from_decl_or_type (TREE_TYPE (t)); + else + flags = 0; + } + + return flags; +} + + +/* Return true if GS is a copy assignment. */ + +bool +gimple_assign_copy_p (gimple gs) +{ + return gimple_code (gs) == GIMPLE_ASSIGN + && get_gimple_rhs_class (gimple_assign_rhs_code (gs)) + == GIMPLE_SINGLE_RHS + && is_gimple_val (gimple_op (gs, 1)); +} + + +/* Return true if GS is a SSA_NAME copy assignment. */ + +bool +gimple_assign_ssa_name_copy_p (gimple gs) +{ + return (gimple_code (gs) == GIMPLE_ASSIGN + && (get_gimple_rhs_class (gimple_assign_rhs_code (gs)) + == GIMPLE_SINGLE_RHS) + && TREE_CODE (gimple_assign_lhs (gs)) == SSA_NAME + && TREE_CODE (gimple_assign_rhs1 (gs)) == SSA_NAME); +} + + +/* Return true if GS is an assignment with a singleton RHS, i.e., + there is no operator associated with the assignment itself. + Unlike gimple_assign_copy_p, this predicate returns true for + any RHS operand, including those that perform an operation + and do not have the semantics of a copy, such as COND_EXPR. */ + +bool +gimple_assign_single_p (gimple gs) +{ + return (gimple_code (gs) == GIMPLE_ASSIGN + && get_gimple_rhs_class (gimple_assign_rhs_code (gs)) + == GIMPLE_SINGLE_RHS); +} + +/* Return true if GS is an assignment with a unary RHS, but the + operator has no effect on the assigned value. The logic is adapted + from STRIP_NOPS. This predicate is intended to be used in tuplifying + instances in which STRIP_NOPS was previously applied to the RHS of + an assignment. + + NOTE: In the use cases that led to the creation of this function + and of gimple_assign_single_p, it is typical to test for either + condition and to proceed in the same manner. In each case, the + assigned value is represented by the single RHS operand of the + assignment. I suspect there may be cases where gimple_assign_copy_p, + gimple_assign_single_p, or equivalent logic is used where a similar + treatment of unary NOPs is appropriate. */ + +bool +gimple_assign_unary_nop_p (gimple gs) +{ + return (gimple_code (gs) == GIMPLE_ASSIGN + && (gimple_assign_rhs_code (gs) == NOP_EXPR + || gimple_assign_rhs_code (gs) == CONVERT_EXPR + || gimple_assign_rhs_code (gs) == NON_LVALUE_EXPR) + && gimple_assign_rhs1 (gs) != error_mark_node + && (TYPE_MODE (TREE_TYPE (gimple_assign_lhs (gs))) + == TYPE_MODE (TREE_TYPE (gimple_assign_rhs1 (gs))))); +} + +/* Set BB to be the basic block holding G. */ + +void +gimple_set_bb (gimple stmt, basic_block bb) +{ + stmt->gsbase.bb = bb; + + /* If the statement is a label, add the label to block-to-labels map + so that we can speed up edge creation for GIMPLE_GOTOs. */ + if (cfun->cfg && gimple_code (stmt) == GIMPLE_LABEL) + { + tree t; + int uid; + + t = gimple_label_label (stmt); + uid = LABEL_DECL_UID (t); + if (uid == -1) + { + unsigned old_len = VEC_length (basic_block, label_to_block_map); + LABEL_DECL_UID (t) = uid = cfun->cfg->last_label_uid++; + if (old_len <= (unsigned) uid) + { + unsigned new_len = 3 * uid / 2; + + VEC_safe_grow_cleared (basic_block, gc, label_to_block_map, + new_len); + } + } + + VEC_replace (basic_block, label_to_block_map, uid, bb); + } +} + + +/* Fold the expression computed by STMT. If the expression can be + folded, return the folded result, otherwise return NULL. STMT is + not modified. */ + +tree +gimple_fold (const_gimple stmt) +{ + switch (gimple_code (stmt)) + { + case GIMPLE_COND: + return fold_binary (gimple_cond_code (stmt), + boolean_type_node, + gimple_cond_lhs (stmt), + gimple_cond_rhs (stmt)); + + case GIMPLE_ASSIGN: + switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) + { + case GIMPLE_UNARY_RHS: + return fold_unary (gimple_assign_rhs_code (stmt), + TREE_TYPE (gimple_assign_lhs (stmt)), + gimple_assign_rhs1 (stmt)); + case GIMPLE_BINARY_RHS: + return fold_binary (gimple_assign_rhs_code (stmt), + TREE_TYPE (gimple_assign_lhs (stmt)), + gimple_assign_rhs1 (stmt), + gimple_assign_rhs2 (stmt)); + case GIMPLE_SINGLE_RHS: + return fold (gimple_assign_rhs1 (stmt)); + default:; + } + break; + + case GIMPLE_SWITCH: + return gimple_switch_index (stmt); + + case GIMPLE_CALL: + return NULL_TREE; + + default: + break; + } + + gcc_unreachable (); +} + + +/* Modify the RHS of the assignment pointed-to by GSI using the + operands in the expression tree EXPR. + + NOTE: The statement pointed-to by GSI may be reallocated if it + did not have enough operand slots. + + This function is useful to convert an existing tree expression into + the flat representation used for the RHS of a GIMPLE assignment. + It will reallocate memory as needed to expand or shrink the number + of operand slots needed to represent EXPR. + + NOTE: If you find yourself building a tree and then calling this + function, you are most certainly doing it the slow way. It is much + better to build a new assignment or to use the function + gimple_assign_set_rhs_with_ops, which does not require an + expression tree to be built. */ + +void +gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *gsi, tree expr) +{ + enum tree_code subcode; + tree op1, op2; + + extract_ops_from_tree (expr, &subcode, &op1, &op2); + gimple_assign_set_rhs_with_ops (gsi, subcode, op1, op2); +} + + +/* Set the RHS of assignment statement pointed-to by GSI to CODE with + operands OP1 and OP2. + + NOTE: The statement pointed-to by GSI may be reallocated if it + did not have enough operand slots. */ + +void +gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, + tree op1, tree op2) +{ + unsigned new_rhs_ops = get_gimple_rhs_num_ops (code); + gimple stmt = gsi_stmt (*gsi); + + /* If the new CODE needs more operands, allocate a new statement. */ + if (gimple_num_ops (stmt) < new_rhs_ops + 1) + { + tree lhs = gimple_assign_lhs (stmt); + gimple new_stmt = gimple_alloc (gimple_code (stmt), new_rhs_ops + 1); + memcpy (new_stmt, stmt, gimple_size (gimple_code (stmt))); + gsi_replace (gsi, new_stmt, true); + stmt = new_stmt; + + /* The LHS needs to be reset as this also changes the SSA name + on the LHS. */ + gimple_assign_set_lhs (stmt, lhs); + } + + gimple_set_num_ops (stmt, new_rhs_ops + 1); + gimple_set_subcode (stmt, code); + gimple_assign_set_rhs1 (stmt, op1); + if (new_rhs_ops > 1) + gimple_assign_set_rhs2 (stmt, op2); +} + + +/* Return the LHS of a statement that performs an assignment, + either a GIMPLE_ASSIGN or a GIMPLE_CALL. Returns NULL_TREE + for a call to a function that returns no value, or for a + statement other than an assignment or a call. */ + +tree +gimple_get_lhs (const_gimple stmt) +{ + enum tree_code code = gimple_code (stmt); + + if (code == GIMPLE_ASSIGN) + return gimple_assign_lhs (stmt); + else if (code == GIMPLE_CALL) + return gimple_call_lhs (stmt); + else + return NULL_TREE; +} + + +/* Set the LHS of a statement that performs an assignment, + either a GIMPLE_ASSIGN or a GIMPLE_CALL. */ + +void +gimple_set_lhs (gimple stmt, tree lhs) +{ + enum tree_code code = gimple_code (stmt); + + if (code == GIMPLE_ASSIGN) + gimple_assign_set_lhs (stmt, lhs); + else if (code == GIMPLE_CALL) + gimple_call_set_lhs (stmt, lhs); + else + gcc_unreachable(); +} + + +/* Return a deep copy of statement STMT. All the operands from STMT + are reallocated and copied using unshare_expr. The DEF, USE, VDEF + and VUSE operand arrays are set to empty in the new copy. */ + +gimple +gimple_copy (gimple stmt) +{ + enum gimple_code code = gimple_code (stmt); + unsigned num_ops = gimple_num_ops (stmt); + gimple copy = gimple_alloc (code, num_ops); + unsigned i; + + /* Shallow copy all the fields from STMT. */ + memcpy (copy, stmt, gimple_size (code)); + + /* If STMT has sub-statements, deep-copy them as well. */ + if (gimple_has_substatements (stmt)) + { + gimple_seq new_seq; + tree t; + + switch (gimple_code (stmt)) + { + case GIMPLE_BIND: + new_seq = gimple_seq_copy (gimple_bind_body (stmt)); + gimple_bind_set_body (copy, new_seq); + gimple_bind_set_vars (copy, unshare_expr (gimple_bind_vars (stmt))); + gimple_bind_set_block (copy, gimple_bind_block (stmt)); + break; + + case GIMPLE_CATCH: + new_seq = gimple_seq_copy (gimple_catch_handler (stmt)); + gimple_catch_set_handler (copy, new_seq); + t = unshare_expr (gimple_catch_types (stmt)); + gimple_catch_set_types (copy, t); + break; + + case GIMPLE_EH_FILTER: + new_seq = gimple_seq_copy (gimple_eh_filter_failure (stmt)); + gimple_eh_filter_set_failure (copy, new_seq); + t = unshare_expr (gimple_eh_filter_types (stmt)); + gimple_eh_filter_set_types (copy, t); + break; + + case GIMPLE_TRY: + new_seq = gimple_seq_copy (gimple_try_eval (stmt)); + gimple_try_set_eval (copy, new_seq); + new_seq = gimple_seq_copy (gimple_try_cleanup (stmt)); + gimple_try_set_cleanup (copy, new_seq); + break; + + case GIMPLE_OMP_FOR: + new_seq = gimple_seq_copy (gimple_omp_for_pre_body (stmt)); + gimple_omp_for_set_pre_body (copy, new_seq); + t = unshare_expr (gimple_omp_for_clauses (stmt)); + gimple_omp_for_set_clauses (copy, t); + copy->gimple_omp_for.iter + = GGC_NEWVEC (struct gimple_omp_for_iter, + gimple_omp_for_collapse (stmt)); + for (i = 0; i < gimple_omp_for_collapse (stmt); i++) + { + gimple_omp_for_set_cond (copy, i, + gimple_omp_for_cond (stmt, i)); + gimple_omp_for_set_index (copy, i, + gimple_omp_for_index (stmt, i)); + t = unshare_expr (gimple_omp_for_initial (stmt, i)); + gimple_omp_for_set_initial (copy, i, t); + t = unshare_expr (gimple_omp_for_final (stmt, i)); + gimple_omp_for_set_final (copy, i, t); + t = unshare_expr (gimple_omp_for_incr (stmt, i)); + gimple_omp_for_set_incr (copy, i, t); + } + goto copy_omp_body; + + case GIMPLE_OMP_PARALLEL: + t = unshare_expr (gimple_omp_parallel_clauses (stmt)); + gimple_omp_parallel_set_clauses (copy, t); + t = unshare_expr (gimple_omp_parallel_child_fn (stmt)); + gimple_omp_parallel_set_child_fn (copy, t); + t = unshare_expr (gimple_omp_parallel_data_arg (stmt)); + gimple_omp_parallel_set_data_arg (copy, t); + goto copy_omp_body; + + case GIMPLE_OMP_TASK: + t = unshare_expr (gimple_omp_task_clauses (stmt)); + gimple_omp_task_set_clauses (copy, t); + t = unshare_expr (gimple_omp_task_child_fn (stmt)); + gimple_omp_task_set_child_fn (copy, t); + t = unshare_expr (gimple_omp_task_data_arg (stmt)); + gimple_omp_task_set_data_arg (copy, t); + t = unshare_expr (gimple_omp_task_copy_fn (stmt)); + gimple_omp_task_set_copy_fn (copy, t); + t = unshare_expr (gimple_omp_task_arg_size (stmt)); + gimple_omp_task_set_arg_size (copy, t); + t = unshare_expr (gimple_omp_task_arg_align (stmt)); + gimple_omp_task_set_arg_align (copy, t); + goto copy_omp_body; + + case GIMPLE_OMP_CRITICAL: + t = unshare_expr (gimple_omp_critical_name (stmt)); + gimple_omp_critical_set_name (copy, t); + goto copy_omp_body; + + case GIMPLE_OMP_SECTIONS: + t = unshare_expr (gimple_omp_sections_clauses (stmt)); + gimple_omp_sections_set_clauses (copy, t); + t = unshare_expr (gimple_omp_sections_control (stmt)); + gimple_omp_sections_set_control (copy, t); + /* FALLTHRU */ + + case GIMPLE_OMP_SINGLE: + case GIMPLE_OMP_SECTION: + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_ORDERED: + copy_omp_body: + new_seq = gimple_seq_copy (gimple_omp_body (stmt)); + gimple_omp_set_body (copy, new_seq); + break; + + case GIMPLE_WITH_CLEANUP_EXPR: + new_seq = gimple_seq_copy (gimple_wce_cleanup (stmt)); + gimple_wce_set_cleanup (copy, new_seq); + break; + + default: + gcc_unreachable (); + } + } + + /* Make copy of operands. */ + if (num_ops > 0) + { + for (i = 0; i < num_ops; i++) + gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i))); + + /* Clear out SSA operand vectors on COPY. Note that we cannot + call the API functions for setting addresses_taken, stores + and loads. These functions free the previous values, and we + cannot do that on COPY as it will affect the original + statement. */ + if (gimple_has_ops (stmt)) + { + gimple_set_def_ops (copy, NULL); + gimple_set_use_ops (copy, NULL); + copy->gsops.opbase.addresses_taken = NULL; + } + + if (gimple_has_mem_ops (stmt)) + { + gimple_set_vdef_ops (copy, NULL); + gimple_set_vuse_ops (copy, NULL); + copy->gsmem.membase.stores = NULL; + copy->gsmem.membase.loads = NULL; + } + + update_stmt (copy); + } + + return copy; +} + + +/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has + a MODIFIED field. */ + +void +gimple_set_modified (gimple s, bool modifiedp) +{ + if (gimple_has_ops (s)) + { + s->gsbase.modified = (unsigned) modifiedp; + + if (modifiedp + && cfun->gimple_df + && is_gimple_call (s) + && gimple_call_noreturn_p (s)) + VEC_safe_push (gimple, gc, MODIFIED_NORETURN_CALLS (cfun), s); + } +} + + +/* Return true if statement S has side-effects. We consider a + statement to have side effects if: + + - It is a GIMPLE_CALL not marked with ECF_PURE or ECF_CONST. + - Any of its operands are marked TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS. */ + +bool +gimple_has_side_effects (const_gimple s) +{ + unsigned i; + + /* We don't have to scan the arguments to check for + volatile arguments, though, at present, we still + do a scan to check for TREE_SIDE_EFFECTS. */ + if (gimple_has_volatile_ops (s)) + return true; + + if (is_gimple_call (s)) + { + unsigned nargs = gimple_call_num_args (s); + + if (!(gimple_call_flags (s) & (ECF_CONST | ECF_PURE))) + return true; + else if (gimple_call_flags (s) & ECF_LOOPING_CONST_OR_PURE) + /* An infinite loop is considered a side effect. */ + return true; + + if (gimple_call_lhs (s) + && TREE_SIDE_EFFECTS (gimple_call_lhs (s))) + { + gcc_assert (gimple_has_volatile_ops (s)); + return true; + } + + if (TREE_SIDE_EFFECTS (gimple_call_fn (s))) + return true; + + for (i = 0; i < nargs; i++) + if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i))) + { + gcc_assert (gimple_has_volatile_ops (s)); + return true; + } + + return false; + } + else + { + for (i = 0; i < gimple_num_ops (s); i++) + if (TREE_SIDE_EFFECTS (gimple_op (s, i))) + { + gcc_assert (gimple_has_volatile_ops (s)); + return true; + } + } + + return false; +} + +/* Return true if the RHS of statement S has side effects. + We may use it to determine if it is admissable to replace + an assignment or call with a copy of a previously-computed + value. In such cases, side-effects due the the LHS are + preserved. */ + +bool +gimple_rhs_has_side_effects (const_gimple s) +{ + unsigned i; + + if (is_gimple_call (s)) + { + unsigned nargs = gimple_call_num_args (s); + + if (!(gimple_call_flags (s) & (ECF_CONST | ECF_PURE))) + return true; + + /* We cannot use gimple_has_volatile_ops here, + because we must ignore a volatile LHS. */ + if (TREE_SIDE_EFFECTS (gimple_call_fn (s)) + || TREE_THIS_VOLATILE (gimple_call_fn (s))) + { + gcc_assert (gimple_has_volatile_ops (s)); + return true; + } + + for (i = 0; i < nargs; i++) + if (TREE_SIDE_EFFECTS (gimple_call_arg (s, i)) + || TREE_THIS_VOLATILE (gimple_call_arg (s, i))) + return true; + + return false; + } + else if (is_gimple_assign (s)) + { + /* Skip the first operand, the LHS. */ + for (i = 1; i < gimple_num_ops (s); i++) + if (TREE_SIDE_EFFECTS (gimple_op (s, i)) + || TREE_THIS_VOLATILE (gimple_op (s, i))) + { + gcc_assert (gimple_has_volatile_ops (s)); + return true; + } + } + else + { + /* For statements without an LHS, examine all arguments. */ + for (i = 0; i < gimple_num_ops (s); i++) + if (TREE_SIDE_EFFECTS (gimple_op (s, i)) + || TREE_THIS_VOLATILE (gimple_op (s, i))) + { + gcc_assert (gimple_has_volatile_ops (s)); + return true; + } + } + + return false; +} + + +/* Helper for gimple_could_trap_p and gimple_assign_rhs_could_trap_p. + Return true if S can trap. If INCLUDE_LHS is true and S is a + GIMPLE_ASSIGN, the LHS of the assignment is also checked. + Otherwise, only the RHS of the assignment is checked. */ + +static bool +gimple_could_trap_p_1 (gimple s, bool include_lhs) +{ + unsigned i, start; + tree t, div = NULL_TREE; + enum tree_code op; + + start = (is_gimple_assign (s) && !include_lhs) ? 1 : 0; + + for (i = start; i < gimple_num_ops (s); i++) + if (tree_could_trap_p (gimple_op (s, i))) + return true; + + switch (gimple_code (s)) + { + case GIMPLE_ASM: + return gimple_asm_volatile_p (s); + + case GIMPLE_CALL: + t = gimple_call_fndecl (s); + /* Assume that calls to weak functions may trap. */ + if (!t || !DECL_P (t) || DECL_WEAK (t)) + return true; + return false; + + case GIMPLE_ASSIGN: + t = gimple_expr_type (s); + op = gimple_assign_rhs_code (s); + if (get_gimple_rhs_class (op) == GIMPLE_BINARY_RHS) + div = gimple_assign_rhs2 (s); + return (operation_could_trap_p (op, FLOAT_TYPE_P (t), + (INTEGRAL_TYPE_P (t) + && TYPE_OVERFLOW_TRAPS (t)), + div)); + + default: + break; + } + + return false; + +} + + +/* Return true if statement S can trap. */ + +bool +gimple_could_trap_p (gimple s) +{ + return gimple_could_trap_p_1 (s, true); +} + + +/* Return true if RHS of a GIMPLE_ASSIGN S can trap. */ + +bool +gimple_assign_rhs_could_trap_p (gimple s) +{ + gcc_assert (is_gimple_assign (s)); + return gimple_could_trap_p_1 (s, false); +} + + +/* Print debugging information for gimple stmts generated. */ + +void +dump_gimple_statistics (void) +{ +#ifdef GATHER_STATISTICS + int i, total_tuples = 0, total_bytes = 0; + + fprintf (stderr, "\nGIMPLE statements\n"); + fprintf (stderr, "Kind Stmts Bytes\n"); + fprintf (stderr, "---------------------------------------\n"); + for (i = 0; i < (int) gimple_alloc_kind_all; ++i) + { + fprintf (stderr, "%-20s %7d %10d\n", gimple_alloc_kind_names[i], + gimple_alloc_counts[i], gimple_alloc_sizes[i]); + total_tuples += gimple_alloc_counts[i]; + total_bytes += gimple_alloc_sizes[i]; + } + fprintf (stderr, "---------------------------------------\n"); + fprintf (stderr, "%-20s %7d %10d\n", "Total", total_tuples, total_bytes); + fprintf (stderr, "---------------------------------------\n"); +#else + fprintf (stderr, "No gimple statistics\n"); +#endif +} + + +/* Deep copy SYMS into the set of symbols stored by STMT. If SYMS is + NULL or empty, the storage used is freed up. */ + +void +gimple_set_stored_syms (gimple stmt, bitmap syms, bitmap_obstack *obs) +{ + gcc_assert (gimple_has_mem_ops (stmt)); + + if (syms == NULL || bitmap_empty_p (syms)) + BITMAP_FREE (stmt->gsmem.membase.stores); + else + { + if (stmt->gsmem.membase.stores == NULL) + stmt->gsmem.membase.stores = BITMAP_ALLOC (obs); + + bitmap_copy (stmt->gsmem.membase.stores, syms); + } +} + + +/* Deep copy SYMS into the set of symbols loaded by STMT. If SYMS is + NULL or empty, the storage used is freed up. */ + +void +gimple_set_loaded_syms (gimple stmt, bitmap syms, bitmap_obstack *obs) +{ + gcc_assert (gimple_has_mem_ops (stmt)); + + if (syms == NULL || bitmap_empty_p (syms)) + BITMAP_FREE (stmt->gsmem.membase.loads); + else + { + if (stmt->gsmem.membase.loads == NULL) + stmt->gsmem.membase.loads = BITMAP_ALLOC (obs); + + bitmap_copy (stmt->gsmem.membase.loads, syms); + } +} + + +/* Return the number of operands needed on the RHS of a GIMPLE + assignment for an expression with tree code CODE. */ + +unsigned +get_gimple_rhs_num_ops (enum tree_code code) +{ + enum gimple_rhs_class rhs_class = get_gimple_rhs_class (code); + + if (rhs_class == GIMPLE_UNARY_RHS || rhs_class == GIMPLE_SINGLE_RHS) + return 1; + else if (rhs_class == GIMPLE_BINARY_RHS) + return 2; + else + gcc_unreachable (); +} + +#define DEFTREECODE(SYM, STRING, TYPE, NARGS) \ + (unsigned char) \ + ((TYPE) == tcc_unary ? GIMPLE_UNARY_RHS \ + : ((TYPE) == tcc_binary \ + || (TYPE) == tcc_comparison) ? GIMPLE_BINARY_RHS \ + : ((TYPE) == tcc_constant \ + || (TYPE) == tcc_declaration \ + || (TYPE) == tcc_reference) ? GIMPLE_SINGLE_RHS \ + : ((SYM) == TRUTH_AND_EXPR \ + || (SYM) == TRUTH_OR_EXPR \ + || (SYM) == TRUTH_XOR_EXPR) ? GIMPLE_BINARY_RHS \ + : (SYM) == TRUTH_NOT_EXPR ? GIMPLE_UNARY_RHS \ + : ((SYM) == COND_EXPR \ + || (SYM) == CONSTRUCTOR \ + || (SYM) == OBJ_TYPE_REF \ + || (SYM) == ASSERT_EXPR \ + || (SYM) == ADDR_EXPR \ + || (SYM) == WITH_SIZE_EXPR \ + || (SYM) == EXC_PTR_EXPR \ + || (SYM) == SSA_NAME \ + || (SYM) == FILTER_EXPR \ + || (SYM) == POLYNOMIAL_CHREC \ + || (SYM) == DOT_PROD_EXPR \ + || (SYM) == VEC_COND_EXPR \ + || (SYM) == REALIGN_LOAD_EXPR) ? GIMPLE_SINGLE_RHS \ + : GIMPLE_INVALID_RHS), +#define END_OF_BASE_TREE_CODES (unsigned char) GIMPLE_INVALID_RHS, + +const unsigned char gimple_rhs_class_table[] = { +#include "all-tree.def" +}; + +#undef DEFTREECODE +#undef END_OF_BASE_TREE_CODES + +/* For the definitive definition of GIMPLE, see doc/tree-ssa.texi. */ + +/* Validation of GIMPLE expressions. */ + +/* Return true if OP is an acceptable tree node to be used as a GIMPLE + operand. */ + +bool +is_gimple_operand (const_tree op) +{ + return op && get_gimple_rhs_class (TREE_CODE (op)) == GIMPLE_SINGLE_RHS; +} + + +/* Return true if T is a GIMPLE RHS for an assignment to a temporary. */ + +bool +is_gimple_formal_tmp_rhs (tree t) +{ + if (is_gimple_lvalue (t) || is_gimple_val (t)) + return true; + + return get_gimple_rhs_class (TREE_CODE (t)) != GIMPLE_INVALID_RHS; +} + +/* Returns true iff T is a valid RHS for an assignment to a renamed + user -- or front-end generated artificial -- variable. */ + +bool +is_gimple_reg_rhs (tree t) +{ + /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto + and the LHS is a user variable, then we need to introduce a formal + temporary. This way the optimizers can determine that the user + variable is only modified if evaluation of the RHS does not throw. + + Don't force a temp of a non-renamable type; the copy could be + arbitrarily expensive. Instead we will generate a VDEF for + the assignment. */ + + if (is_gimple_reg_type (TREE_TYPE (t)) && tree_could_throw_p (t)) + return false; + + return is_gimple_formal_tmp_rhs (t); +} + +/* Returns true iff T is a valid RHS for an assignment to an un-renamed + LHS, or for a call argument. */ + +bool +is_gimple_mem_rhs (tree t) +{ + /* If we're dealing with a renamable type, either source or dest must be + a renamed variable. */ + if (is_gimple_reg_type (TREE_TYPE (t))) + return is_gimple_val (t); + else + return is_gimple_formal_tmp_rhs (t); +} + +/* Return true if T is a valid LHS for a GIMPLE assignment expression. */ + +bool +is_gimple_lvalue (tree t) +{ + return (is_gimple_addressable (t) + || TREE_CODE (t) == WITH_SIZE_EXPR + /* These are complex lvalues, but don't have addresses, so they + go here. */ + || TREE_CODE (t) == BIT_FIELD_REF); +} + +/* Return true if T is a GIMPLE condition. */ + +bool +is_gimple_condexpr (tree t) +{ + return (is_gimple_val (t) || (COMPARISON_CLASS_P (t) + && !tree_could_trap_p (t) + && is_gimple_val (TREE_OPERAND (t, 0)) + && is_gimple_val (TREE_OPERAND (t, 1)))); +} + +/* Return true if T is something whose address can be taken. */ + +bool +is_gimple_addressable (tree t) +{ + return (is_gimple_id (t) || handled_component_p (t) || INDIRECT_REF_P (t)); +} + +/* Return true if T is a valid gimple constant. */ + +bool +is_gimple_constant (const_tree t) +{ + switch (TREE_CODE (t)) + { + case INTEGER_CST: + case REAL_CST: + case FIXED_CST: + case STRING_CST: + case COMPLEX_CST: + case VECTOR_CST: + return true; + + /* Vector constant constructors are gimple invariant. */ + case CONSTRUCTOR: + if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) + return TREE_CONSTANT (t); + else + return false; + + default: + return false; + } +} + +/* Return true if T is a gimple address. */ + +bool +is_gimple_address (const_tree t) +{ + tree op; + + if (TREE_CODE (t) != ADDR_EXPR) + return false; + + op = TREE_OPERAND (t, 0); + while (handled_component_p (op)) + { + if ((TREE_CODE (op) == ARRAY_REF + || TREE_CODE (op) == ARRAY_RANGE_REF) + && !is_gimple_val (TREE_OPERAND (op, 1))) + return false; + + op = TREE_OPERAND (op, 0); + } + + if (CONSTANT_CLASS_P (op) || INDIRECT_REF_P (op)) + return true; + + switch (TREE_CODE (op)) + { + case PARM_DECL: + case RESULT_DECL: + case LABEL_DECL: + case FUNCTION_DECL: + case VAR_DECL: + case CONST_DECL: + return true; + + default: + return false; + } +} + +/* Return true if T is a gimple invariant address. */ + +bool +is_gimple_invariant_address (const_tree t) +{ + tree op; + + if (TREE_CODE (t) != ADDR_EXPR) + return false; + + op = TREE_OPERAND (t, 0); + while (handled_component_p (op)) + { + switch (TREE_CODE (op)) + { + case ARRAY_REF: + case ARRAY_RANGE_REF: + if (!is_gimple_constant (TREE_OPERAND (op, 1)) + || TREE_OPERAND (op, 2) != NULL_TREE + || TREE_OPERAND (op, 3) != NULL_TREE) + return false; + break; + + case COMPONENT_REF: + if (TREE_OPERAND (op, 2) != NULL_TREE) + return false; + break; + + default:; + } + op = TREE_OPERAND (op, 0); + } + + return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op); +} + +/* Return true if T is a GIMPLE minimal invariant. It's a restricted + form of function invariant. */ + +bool +is_gimple_min_invariant (const_tree t) +{ + if (TREE_CODE (t) == ADDR_EXPR) + return is_gimple_invariant_address (t); + + return is_gimple_constant (t); +} + +/* Return true if T looks like a valid GIMPLE statement. */ + +bool +is_gimple_stmt (tree t) +{ + const enum tree_code code = TREE_CODE (t); + + switch (code) + { + case NOP_EXPR: + /* The only valid NOP_EXPR is the empty statement. */ + return IS_EMPTY_STMT (t); + + case BIND_EXPR: + case COND_EXPR: + /* These are only valid if they're void. */ + return TREE_TYPE (t) == NULL || VOID_TYPE_P (TREE_TYPE (t)); + + case SWITCH_EXPR: + case GOTO_EXPR: + case RETURN_EXPR: + case LABEL_EXPR: + case CASE_LABEL_EXPR: + case TRY_CATCH_EXPR: + case TRY_FINALLY_EXPR: + case EH_FILTER_EXPR: + case CATCH_EXPR: + case CHANGE_DYNAMIC_TYPE_EXPR: + case ASM_EXPR: + case RESX_EXPR: + case STATEMENT_LIST: + case OMP_PARALLEL: + case OMP_FOR: + case OMP_SECTIONS: + case OMP_SECTION: + case OMP_SINGLE: + case OMP_MASTER: + case OMP_ORDERED: + case OMP_CRITICAL: + case OMP_TASK: + /* These are always void. */ + return true; + + case CALL_EXPR: + case MODIFY_EXPR: + case PREDICT_EXPR: + /* These are valid regardless of their type. */ + return true; + + default: + return false; + } +} + +/* Return true if T is a variable. */ + +bool +is_gimple_variable (tree t) +{ + return (TREE_CODE (t) == VAR_DECL + || TREE_CODE (t) == PARM_DECL + || TREE_CODE (t) == RESULT_DECL + || TREE_CODE (t) == SSA_NAME); +} + +/* Return true if T is a GIMPLE identifier (something with an address). */ + +bool +is_gimple_id (tree t) +{ + return (is_gimple_variable (t) + || TREE_CODE (t) == FUNCTION_DECL + || TREE_CODE (t) == LABEL_DECL + || TREE_CODE (t) == CONST_DECL + /* Allow string constants, since they are addressable. */ + || TREE_CODE (t) == STRING_CST); +} + +/* Return true if TYPE is a suitable type for a scalar register variable. */ + +bool +is_gimple_reg_type (tree type) +{ + /* In addition to aggregate types, we also exclude complex types if not + optimizing because they can be subject to partial stores in GNU C by + means of the __real__ and __imag__ operators and we cannot promote + them to total stores (see gimplify_modify_expr_complex_part). */ + return !(AGGREGATE_TYPE_P (type) + || (TREE_CODE (type) == COMPLEX_TYPE && !optimize)); + +} + +/* Return true if T is a non-aggregate register variable. */ + +bool +is_gimple_reg (tree t) +{ + if (TREE_CODE (t) == SSA_NAME) + t = SSA_NAME_VAR (t); + + if (MTAG_P (t)) + return false; + + if (!is_gimple_variable (t)) + return false; + + if (!is_gimple_reg_type (TREE_TYPE (t))) + return false; + + /* A volatile decl is not acceptable because we can't reuse it as + needed. We need to copy it into a temp first. */ + if (TREE_THIS_VOLATILE (t)) + return false; + + /* We define "registers" as things that can be renamed as needed, + which with our infrastructure does not apply to memory. */ + if (needs_to_live_in_memory (t)) + return false; + + /* Hard register variables are an interesting case. For those that + are call-clobbered, we don't know where all the calls are, since + we don't (want to) take into account which operations will turn + into libcalls at the rtl level. For those that are call-saved, + we don't currently model the fact that calls may in fact change + global hard registers, nor do we examine ASM_CLOBBERS at the tree + level, and so miss variable changes that might imply. All around, + it seems safest to not do too much optimization with these at the + tree level at all. We'll have to rely on the rtl optimizers to + clean this up, as there we've got all the appropriate bits exposed. */ + if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)) + return false; + + /* Complex and vector values must have been put into SSA-like form. + That is, no assignments to the individual components. */ + if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) + return DECL_GIMPLE_REG_P (t); + + return true; +} + + +/* Returns true if T is a GIMPLE formal temporary variable. */ + +bool +is_gimple_formal_tmp_var (tree t) +{ + if (TREE_CODE (t) == SSA_NAME) + return true; + + return TREE_CODE (t) == VAR_DECL && DECL_GIMPLE_FORMAL_TEMP_P (t); +} + +/* Returns true if T is a GIMPLE formal temporary register variable. */ + +bool +is_gimple_formal_tmp_reg (tree t) +{ + /* The intent of this is to get hold of a value that won't change. + An SSA_NAME qualifies no matter if its of a user variable or not. */ + if (TREE_CODE (t) == SSA_NAME) + return true; + + /* We don't know the lifetime characteristics of user variables. */ + if (!is_gimple_formal_tmp_var (t)) + return false; + + /* Finally, it must be capable of being placed in a register. */ + return is_gimple_reg (t); +} + +/* Return true if T is a GIMPLE variable whose address is not needed. */ + +bool +is_gimple_non_addressable (tree t) +{ + if (TREE_CODE (t) == SSA_NAME) + t = SSA_NAME_VAR (t); + + return (is_gimple_variable (t) && ! needs_to_live_in_memory (t)); +} + +/* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant. */ + +bool +is_gimple_val (tree t) +{ + /* Make loads from volatiles and memory vars explicit. */ + if (is_gimple_variable (t) + && is_gimple_reg_type (TREE_TYPE (t)) + && !is_gimple_reg (t)) + return false; + + /* FIXME make these decls. That can happen only when we expose the + entire landing-pad construct at the tree level. */ + if (TREE_CODE (t) == EXC_PTR_EXPR || TREE_CODE (t) == FILTER_EXPR) + return true; + + return (is_gimple_variable (t) || is_gimple_min_invariant (t)); +} + +/* Similarly, but accept hard registers as inputs to asm statements. */ + +bool +is_gimple_asm_val (tree t) +{ + if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)) + return true; + + return is_gimple_val (t); +} + +/* Return true if T is a GIMPLE minimal lvalue. */ + +bool +is_gimple_min_lval (tree t) +{ + return (is_gimple_id (t) || TREE_CODE (t) == INDIRECT_REF); +} + +/* Return true if T is a typecast operation. */ + +bool +is_gimple_cast (tree t) +{ + return (CONVERT_EXPR_P (t) + || TREE_CODE (t) == FIX_TRUNC_EXPR); +} + +/* Return true if T is a valid function operand of a CALL_EXPR. */ + +bool +is_gimple_call_addr (tree t) +{ + return (TREE_CODE (t) == OBJ_TYPE_REF || is_gimple_val (t)); +} + +/* If T makes a function call, return the corresponding CALL_EXPR operand. + Otherwise, return NULL_TREE. */ + +tree +get_call_expr_in (tree t) +{ + if (TREE_CODE (t) == MODIFY_EXPR) + t = TREE_OPERAND (t, 1); + if (TREE_CODE (t) == WITH_SIZE_EXPR) + t = TREE_OPERAND (t, 0); + if (TREE_CODE (t) == CALL_EXPR) + return t; + return NULL_TREE; +} + + +/* Given a memory reference expression T, return its base address. + The base address of a memory reference expression is the main + object being referenced. For instance, the base address for + 'array[i].fld[j]' is 'array'. You can think of this as stripping + away the offset part from a memory address. + + This function calls handled_component_p to strip away all the inner + parts of the memory reference until it reaches the base object. */ + +tree +get_base_address (tree t) +{ + while (handled_component_p (t)) + t = TREE_OPERAND (t, 0); + + if (SSA_VAR_P (t) + || TREE_CODE (t) == STRING_CST + || TREE_CODE (t) == CONSTRUCTOR + || INDIRECT_REF_P (t)) + return t; + else + return NULL_TREE; +} + +void +recalculate_side_effects (tree t) +{ + enum tree_code code = TREE_CODE (t); + int len = TREE_OPERAND_LENGTH (t); + int i; + + switch (TREE_CODE_CLASS (code)) + { + case tcc_expression: + switch (code) + { + case INIT_EXPR: + case MODIFY_EXPR: + case VA_ARG_EXPR: + case PREDECREMENT_EXPR: + case PREINCREMENT_EXPR: + case POSTDECREMENT_EXPR: + case POSTINCREMENT_EXPR: + /* All of these have side-effects, no matter what their + operands are. */ + return; + + default: + break; + } + /* Fall through. */ + + case tcc_comparison: /* a comparison expression */ + case tcc_unary: /* a unary arithmetic expression */ + case tcc_binary: /* a binary arithmetic expression */ + case tcc_reference: /* a reference */ + case tcc_vl_exp: /* a function call */ + TREE_SIDE_EFFECTS (t) = TREE_THIS_VOLATILE (t); + for (i = 0; i < len; ++i) + { + tree op = TREE_OPERAND (t, i); + if (op && TREE_SIDE_EFFECTS (op)) + TREE_SIDE_EFFECTS (t) = 1; + } + break; + + default: + /* Can never be used with non-expressions. */ + gcc_unreachable (); + } +} + +/* Canonicalize a tree T for use in a COND_EXPR as conditional. Returns + a canonicalized tree that is valid for a COND_EXPR or NULL_TREE, if + we failed to create one. */ + +tree +canonicalize_cond_expr_cond (tree t) +{ + /* For (bool)x use x != 0. */ + if (TREE_CODE (t) == NOP_EXPR + && TREE_TYPE (t) == boolean_type_node) + { + tree top0 = TREE_OPERAND (t, 0); + t = build2 (NE_EXPR, TREE_TYPE (t), + top0, build_int_cst (TREE_TYPE (top0), 0)); + } + /* For !x use x == 0. */ + else if (TREE_CODE (t) == TRUTH_NOT_EXPR) + { + tree top0 = TREE_OPERAND (t, 0); + t = build2 (EQ_EXPR, TREE_TYPE (t), + top0, build_int_cst (TREE_TYPE (top0), 0)); + } + /* For cmp ? 1 : 0 use cmp. */ + else if (TREE_CODE (t) == COND_EXPR + && COMPARISON_CLASS_P (TREE_OPERAND (t, 0)) + && integer_onep (TREE_OPERAND (t, 1)) + && integer_zerop (TREE_OPERAND (t, 2))) + { + tree top0 = TREE_OPERAND (t, 0); + t = build2 (TREE_CODE (top0), TREE_TYPE (t), + TREE_OPERAND (top0, 0), TREE_OPERAND (top0, 1)); + } + + if (is_gimple_condexpr (t)) + return t; + + return NULL_TREE; +} + +#include "gt-gimple.h" diff --git a/gcc/gimple.def b/gcc/gimple.def new file mode 100644 index 00000000000..23eaae2e86e --- /dev/null +++ b/gcc/gimple.def @@ -0,0 +1,357 @@ +/* This file contains the definitions of the GIMPLE IR tuples used in GCC. + + Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Contributed by Aldy Hernandez + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* The format of this file is + DEFGSCODE(GIMPLE_symbol, printable name, structure). + + Where symbol is the enumeration name without the ``GIMPLE_''. + The argument STRUCTURE is used to compute offsets into each of the + tuple structures that contain operands. Since vector operands + are at different offsets depending on the particular structure + used, these offsets are computed at compile time for efficient + lookup at runtime. See gimple_ops(). + + If a code does not use operand vectors, STRUCTURE should be NULL. */ + +/* Error marker. This is used in similar ways as ERROR_MARK in tree.def. */ +DEFGSCODE(GIMPLE_ERROR_MARK, "gimple_error_mark", NULL) + +/* IMPORTANT. Do not rearrange the codes between GIMPLE_COND and + GIMPLE_RETURN. The ordering is exposed by gimple_has_ops calls. + These are all the GIMPLE statements with register operands. */ + +/* GIMPLE_COND + represents the conditional jump: + + if (OP1 COND_CODE OP2) goto TRUE_LABEL else goto FALSE_LABEL + + COND_CODE is the tree code used as the comparison predicate. It + must be of class tcc_comparison. + + OP1 and OP2 are the operands used in the comparison. They must be + accepted by is_gimple_operand. + + TRUE_LABEL and FALSE_LABEL are the LABEL_DECL nodes used as the + jump target for the comparison. */ +DEFGSCODE(GIMPLE_COND, "gimple_cond", struct gimple_statement_with_ops) + +/* GIMPLE_GOTO represents unconditional jumps. + TARGET is a LABEL_DECL or an expression node for computed GOTOs. */ +DEFGSCODE(GIMPLE_GOTO, "gimple_goto", struct gimple_statement_with_ops) + +/* GIMPLE_LABEL