[jit] Clean out state within ipa-cp.c

2014-07-14 Thread David Malcolm
/ChangeLog.jit b/gcc/ChangeLog.jit index f8235f1..3a6ea52 100644 --- a/gcc/ChangeLog.jit +++ b/gcc/ChangeLog.jit @@ -1,3 +1,9 @@ +2014-07-14 David Malcolm + + * cgraph.h (ipa_cp_c_finalize): Add prototype. + * ipa-cp.c (ipa_cp_c_finalize): New. + * toplev.c (toplev::finalize): Add

[jit] Add type-checking for API calls that expect numeric types

2014-07-25 Thread David Malcolm
alue-not-a-numeric-type.c diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index 65fba51..3db15e8 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,3 +1,16 @@ +2014-07-25 David Malcolm + + * TODO.rst (error-checking): Remove various items that either + al

Re: [GSoC][match-and-simplify] include is-a.h

2014-07-28 Thread David Malcolm
On Mon, 2014-07-28 at 02:35 +0530, Prathamesh Kulkarni wrote: > - if (o->type == operand::OP_CAPTURE) > + if (is_a (o)) > { > - capture *c = static_cast (o); > - fprintf (f, "@%s", (static_cast (o))->where); > + capture *c = as_a (o); FWIW, if you're doing an is_a followed b

Re: Warn when returning the address of a temporary (middle-end) v2

2014-07-29 Thread David Malcolm
On Tue, 2014-07-29 at 19:36 +0200, Marc Glisse wrote: > On Sun, 27 Jul 2014, Richard Sandiford wrote: > > > Marc Glisse writes: > >> Hello, > >> > >> I followed the advice in this discussion: > >> https://gcc.gnu.org/ml/gcc-patches/2014-04/msg00269.html > >> > >> and here is a new patch. I made a

Re: Warn when returning the address of a temporary (middle-end) v2

2014-07-29 Thread David Malcolm
On Tue, 2014-07-29 at 21:13 +0200, Marek Polacek wrote: > On Tue, Jul 29, 2014 at 02:58:03PM -0400, David Malcolm wrote: > > This is possibly a dumb question, but what happens for a static local, > > rather than an auto local? e.g. > > > > int *f (void) > > { >

[PATCH] Making it easier to set breakpoints in gdb on pass->execute methods

2014-07-29 Thread David Malcolm
A complaint I heard at Cauldron with the C++ification of GCC passes is that it's become much more difficult to set breakpoints on the execute hooks of a pass, now that the passes are classes within anonymous namespaces. When this was first done, the execute methods were trivial implementations tha

Re: [PATCH] Making it easier to set breakpoints in gdb on pass->execute methods

2014-07-29 Thread David Malcolm
On Tue, 2014-07-29 at 16:44 -0400, David Malcolm wrote: > A complaint I heard at Cauldron with the C++ification of GCC passes is > that it's become much more difficult to set breakpoints on the execute > hooks of a pass, now that the passes are classes within anonymous > namespace

Re: Inliner heuristics TLC 1/n - let small function inlinng to ignore cold portion of program

2014-04-17 Thread David Malcolm
On Thu, 2014-04-17 at 19:52 +0200, Jan Hubicka wrote: [...] > Index: doc/invoke.texi > === > --- doc/invoke.texi (revision 209461) > +++ doc/invoke.texi (working copy) > @@ -9409,7 +9409,8 @@ before applying @option{--param inlin

[PATCH 01/89] Const-correctness fixes for some gimple accessors

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_assign_single_p): Accept a const_gimple rather than a gimple. (gimple_store_p): Likewise. (gimple_assign_load_p): Likewise. (gimple_assign_cast_p): Likewise. (gimple_clobber_p): Likewise. --- gcc/gimple.h | 10 +- 1 fi

[PATCH 03/89] Introduce gimple_bind and use it for accessors.

2014-04-21 Thread David Malcolm
This updates all of the gimple_bind_* accessors in gimple.h from taking a plain gimple to taking a gimple_bind (or const_gimple_bind), with the checking happening at the point of cast. Various other types are strengthened from gimple to gimple_bind, and from plain vec to vec. gcc/ * coret

[PATCH 11/89] tree-parloops.c: use gimple_phi in various places

2014-04-21 Thread David Malcolm
gcc/ * tree-parloops.c (struct reduction_info): Strengthen field "new_phi" from gimple to gimple_phi. (create_phi_for_local_result): Convert local "new_phi" to gimple_phi. (loop_has_vector_phi_nodes): Require a gimple_phi rather than a gimple. (gather_scalar_

[PATCH 00/89] Compile-time gimple-checking

2014-04-21 Thread David Malcolm
Accessors known not to need to be converted: 67 So this patch series as-is takes us a little over halfway there. The remaining accessors would involve more substantial re-indenting (typically to introduce blocks within case statements of a switch on statement code, so I can introduce a type-checke

[PATCH 05/89] Introduce gimple_assign and use it in various places

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_assign): New typedef. (const_gimple_assign): New typedef. * gimple.h (struct gimple_statement_assign): New subclass of gimple_statement_with_memory_ops, adding the invariant that stmt->code == GIMPLE_ASSIGN. (gimple_stateme

[PATCH 45/89] Introduce gimple_omp_sections

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_sections): New typedef. (const_gimple_omp_sections): New typedef. * gimple-pretty-print.c (dump_gimple_omp_sections): Require a gimple_omp_sections rather than a plain gimple. (pp_gimple_stmt_1): Add checked cast to gimple_omp_

[PATCH 49/89] Make add_phi_arg require a gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * tree-phinodes.h (add_phi_arg): Require a gimple_phi rather than a plain gimple. * tree-phinodes.c (add_phi_arg): Likewise. * gimple-ssa-strength-reduction.c (create_phi_basis): Strengthen local "phi" from plain gimple to gimple_phi. * graphit

[PATCH 58/89] Make gimple_label_set_label require a gimple_label

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_label_set_label): Require a gimple_label. --- gcc/gimple.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index cf21083..38f4ea7 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3490,9 +3490,8 @@ gimple_label_label

[PATCH 50/89] Make gimple_phi_arg_set_location require a gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_phi_arg_set_location): Require a gimple_phi rather than a plain gimple. --- gcc/gimple.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index e4d0455..6007516 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h

[PATCH 60/89] Concretize gimple_catch_types

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_catch_types): Require a const_gimple_catch rather than a const_gimple. --- gcc/gimple.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index 7dfd512..3c54119 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h

[PATCH 63/89] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_eh_filter_set_types): Require a gimple_eh_filter. (gimple_eh_filter_set_failure): Likewise. * gimple.c (gimple_copy): Add checked casts to gimple_eh_filter within GIMPLE_EH_FILTER case. --- gcc/gimple.c | 13 + gcc/gimple.h | 14 +

[PATCH 65/89] Concretize three gimple_try_set_ accessors

2014-04-21 Thread David Malcolm
gcc/ * gimple.c (gimple_copy): Add checked casts to gimple_try. * gimple.h (gimple_statement_base::dyn_cast_gimple_try): New. (gimple_try_set_kind): Require a gimple_try. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. * tree-eh

[PATCH 46/89] tree-parloops.c: Use gimple_phi in various places

2014-04-21 Thread David Malcolm
gcc/ * tree-parloops.c (reduction_info::keep_res): Strengthen field from plain gimple to gimple_phi. (transform_to_exit_first_loop): Strengthen locals "phi", "nphi" to gimple_phi. Eliminate early decl of gimple_stmt_iterator gsi in favor of more tightly scop

[PATCH 73/89] Concretize gimple_cond_{true|false}_label

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_cond_true_label): Require a const_gimple_cond rather than just a const_gimple. (gimple_cond_false_label): Likewise. * omp-low.c (diagnose_sb_2): Add checked cast to gimple_cond within case GIMPLE_COND. * tree-eh.c (maybe_recor

[PATCH 76/89] Concretize gimple_cond_{lhs|rhs}_ptr

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_cond_lhs_ptr): Require a const_gimple_cond rather than just a const_gimple_cond. (gimple_cond_rhs_ptr): Likewise. * gimplify-me.c (gimple_regimplify_operands): Add a checked cast to gimple_cond within "case GIMPLE_COND". * omp

[PATCH 31/89] Use subclasses of gimple in various places

2014-04-21 Thread David Malcolm
gcc/ * asan.c (insert_if_then_before_iter): Require a gimple cond rathern than a plain gimple. (instrument_mem_region_access): Strengthen local from gimple to gimple_cond. * cfgloopmanip.c (create_empty_if_region_on_edge): Likewise. * omp-low.c (sim

[PATCH 87/89] Use gimple_call in some places within tree-ssa-dom.c

2014-04-21 Thread David Malcolm
gcc/ * tree-ssa-dom.c (struct hashable_expr): Strengthen field call.fn_from from gimple to gimple_call. (initialize_hash_element): Replace check against GIMPLE_CALL with dyn_cast_gimple_call and update gimple_call_ uses to use new gimple_call local, along wit

[PATCH 83/89] Concretize gimple_call_set_tail and gimple_call_tail_p

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_set_tail): Require a gimple_call. (gimple_call_tail_p): Likewise. * cfgexpand.c (expand_gimple_tailcall): Likewise. (expand_gimple_basic_block): Convert calls to is_gimple_call to a dyn_cast, introducing a new "call_stmt" local.

[PATCH 89/89] Convert various gimple to gimple_phi within ssa-iterators.h

2014-04-21 Thread David Malcolm
gcc/ * ssa-iterators.h (FOR_EACH_PHI_OR_STMT_USE): Add checked cast to gimple_phi. (FOR_EACH_PHI_OR_STMT_DEF): Likewise. * ssa-iterators.h (single_phi_def): Require a gimple_phi. (op_iter_init_phiuse): Likewise. (op_iter_init_phidef): Likewise.

[PATCH 86/89] Concretize gimple_call_copy_flags and ipa_modify_call_arguments

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_copy_flags): Require gimple_calls. * ipa-prop.c (ipa_modify_call_arguments): Require a gimple_call. * ipa-prop.h (ipa_modify_call_arguments): Likewise. * tree-inline.c (copy_bb): Replace is_gimple_call with new local and call to

[PATCH 77/89] Concretize various expressions from gimple to gimple_cond

2014-04-21 Thread David Malcolm
gcc/ * ipa-split.c (check_forbidden_calls): Replace check against GIMPLE_COND with a dyn_cast_gimple_cond, introducing a gimple_cond local. * predict.c (predict_extra_loop_exits): Likewise. * tree-vrp.c (fold_predicate_in): Likewise. (simplify_stmt_fo

[PATCH 80/89] Tweak to gimplify_modify_expr

2014-04-21 Thread David Malcolm
gcc/ * gimplify.c (gimplify_modify_expr): Introduce local "call_stmt". --- gcc/gimplify.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 031834b..d43304e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -45

[PATCH 56/89] Various gimple to gimple_call conversions in IPA

2014-04-21 Thread David Malcolm
gcc/ * ipa-prop.c (detect_type_change): Require a gimple_call rather than a plain gimple. (detect_type_change_ssa): Likewise. (compute_complex_assign_jump_func): Likewise. (compute_complex_ancestor_jump_func): Likewise. (compute_known_type_jump_func):

[PATCH 59/89] Make gimple_goto_set_dest require a gimple_goto

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_goto_set_dest): Require a gimple_goto. * tree-cfg.c (factor_computed_gotos): Add checked cast to gimple_goto. (cleanup_dead_labels): Likewise. --- gcc/gimple.h | 3 +-- gcc/tree-cfg.c | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) di

[PATCH 64/89] Concretize gimple_try_set_catch_is_cleanup

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_try_set_catch_is_cleanup): Require a gimple_try. * gimplify.c (gimplify_expr): Convert local "try_" from a gimple to a gimple_try. --- gcc/gimple.h | 2 +- gcc/gimplify.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/g

[PATCH 29/89] Introduce gimple_resx

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_resx): New typedef. (const_gimple_resx): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_resx): New. (gimple_build_resx): Return a gimple_resx rather than a plain gimple. (gimple_resx_region): Require a const_gi

[PATCH 19/89] Const-correctness of gimple_call_builtin_p

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_builtin_call_types_compatible_p): Accept a const_gimple, rather than a gimple. (gimple_call_builtin_p): Likewise, for the three variants. * gimple.c (gimple_builtin_call_types_compatible_p): Likewise. (gimple_call_builtin_p): Likewise

[PATCH 39/89] Introduce gimple_omp_parallel

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_parallel): New typedef. (const_gimple_omp_parallel): New typedef. * cgraphbuild.c (build_cgraph_edges): Convert check of code against GIMPLE_OMP_PARALLEL to a dyn_cast_gimple_omp_parallel and new local. * gimple-pretty

[PATCH 34/89] Introduce gimple_omp_atomic_load

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_atomic_load): New typedef. (const_gimple_omp_atomic_load): New typedef. * gimple-pretty-print.c (dump_gimple_omp_atomic_load): Require a gimple_omp_atomic_load rather than a plain gimple. (pp_gimple_stmt_1): Add a checked cast

[PATCH 41/89] Introduce gimple_omp_task

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_task): New typedef. (const_gimple_omp_task): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_omp_task): New. (gimple_build_omp_task): Return a gimple_omp_task rather than a plain gimple. * gimple-pretty-pri

[PATCH 21/89] Introduce gimple_return

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_return): New typedef. (const_gimple_return): New typedef. * gimple.h (gimple_statement_return): New subclass of gimple_statement_with_memory_ops, adding the invariant that stmt->code == GIMPLE_RETURN. (gimple_statement_base

[PATCH 06/89] Introduce gimple_label and use it in a few places

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_label): New typedef. (const_gimple_label): New typedef. * gimple.h (struct gimple_statement_label): New subclass of gimple_statement_with_ops, adding the invariant that stmt->code == GIMPLE_LABEL. (gimple_statement_base::as

[PATCH 04/89] Introduce gimple_cond and use it in various places

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_cond): New typedef. (const_gimple_cond): Likewise. * gimple.h (struct gimple_statement_cond): New subclass of gimple_statement_with_ops, adding the invariant that stmt->code == GIMPLE_COND. (gimple_statement_base::as_a_gimp

[PATCH 16/89] tree-ssa-loop-ivopts.c: use gimple_phi in a few places

2014-04-21 Thread David Malcolm
gcc/ * tree-ssa-loop-ivopts.c (determine_biv_step): Require a gimple_phi. (find_bivs): Convert local "phi" into a gimple_phi. (mark_bivs): Likewise. --- gcc/tree-ssa-loop-ivopts.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/tree-ssa-loop-i

[PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_statement_switch): New subclass of gimple_statement_with_ops, adding the invariant that stmt->code == GIMPLE_SWITCH. (gimple_statement_base::as_a_gimple_switch): New. (gimple_statement_base::dyn_cast_gimple_switch): New. (is_a_

[PATCH 17/89] Update various expressions within tree-scalar-evolution.c to be gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi, rather than a gimple. (follow_ssa_edge_binary): Likewise. (follow_ssa_edge_expr): Likewise. (follow_ssa_edge_in_rhs): Likewise. (backedge_phi_arg_p): Likewise. (follow_ssa

[PATCH 70/89] Concretize locals within expand_omp_for_init_counts

2014-04-21 Thread David Malcolm
gcc/ * omp-low.c (expand_omp_for_init_counts): Eliminate local "stmt" in favor of new locals "cond_stmt" and "assign_stmt" with more concrete types. --- gcc/omp-low.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gcc/omp-low

[PATCH 78/89] Concretize gimple_call_set_nothrow

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_set_nothrow): Require a gimple_call. * trans-mem.c (ipa_tm_insert_gettmclone_call): Likewise. (ipa_tm_transform_calls_redirect): Add checked cast to gimple call; this is only called for gsi on a GIMPLE_CALL statement. --- gcc/gimple.h

[PATCH 67/89] Make gimple_phi_arg_location require a gimple_phi.

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_phi_arg_location): Require a gimple_phi. * tree-into-ssa.c (rewrite_update_phi_arguments): Replace a check for code GIMPLE_PHI with a dyn_cast and a new local. * tree-ssa-ter.c (ter_is_replaceable_p): Likewise. * tree-ssa-live.c (rem

[PATCH 84/89] Concretize gimple_call_arg_flags

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_arg_flags): Require a const_gimple_call rather than a const_gimple. * gimple.c (gimple_call_fnspec): Likewise. (gimple_call_arg_flags): Likewise. --- gcc/gimple.c | 4 ++-- gcc/gimple.h | 2 +- 2 files changed, 3 insertions(+), 3 deleti

[PATCH 82/89] Concretize gimple_call_set_fntype

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_set_fntype): Require a gimple_call. * omp-low.c (lower_omp_1): Add a new local gimple_call "call_stmt", from a checked cast to gimple_call within the "case GIMPLE_CALL", for the regions where "stmt" is not subsequently overwritten. ---

[PATCH 48/89] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_phi_arg_def_ptr): Require a gimple_phi rather than a plain gimple. (gimple_phi_arg_has_location): Likewise. * gimple-streamer-in.c (input_phi): Return a gimple_phi rather than a plain gimple. * gimple-streamer-out.c (output_ph

[PATCH 53/89] More gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_phi_set_result): Require a gimple_phi rather than a plain gimple. (gimple_phi_set_arg): Likewise. * tree-outof-ssa.c (remove_gimple_phi_args): Likewise; add a checked cast to gimple_phi. * tree-sra.c (replace_removed_params_s

[PATCH 69/89] Make gimple_cond_set_{true|false}_label require gimple_cond.

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_cond_set_true_label): Require a gimple_cond. (gimple_cond_set_false_label): Likewise. * tree-cfg.c (make_cond_expr_edges): Convert "entry" from gimple to a gimple_cond. (cleanup_dead_labels): Introduce a checked cast to a gimple_cond

[PATCH 66/89] Make gimple_phi_arg_location_from_edge require a gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_phi_arg_location_from_edge): Require a gimple_phi. * tree-parloops.c (create_parallel_loop): Split up local variable "stmt", introducing other locals for the various statements created by this function. Reuse "stmt" within the phi-ha

[PATCH 85/89] Concretize gimple_assign_nontemporal_move_p

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_assign_nontemporal_move_p): Require a const_gimple_assign rather than a const_gimple. * cfgexpand.c (expand_gimple_stmt_1): Add local assign_stmt and checked cast within "case GIMPLE_ASSIGN". * gimple-streamer-out.c (output_gimple_st

[PATCH 43/89] Introduce gimple_omp_target

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_target): New typedef. (const_gimple_omp_target): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_omp_target): New. (gimple_build_omp_target): Return a gimple_omp_target rather than a plain gimple. (gimple_om

[PATCH 79/89] Concretize gimple_call_nothrow_p

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_nothrow_p): Require a gimple_call. * tree-eh.c (stmt_could_throw_p): Add checked cast to gimple_call. * tree-vect-slp.c (vect_build_slp_tree_1): Replace call to is_gimple_call with dyn_cast_gimple_call, introducing a local. --- gcc/gim

[PATCH 47/89] omp-low.c: Use more concrete types of gimple statement for various locals

2014-04-21 Thread David Malcolm
gcc/ * omp-low.c (finalize_task_copyfn): Strengthen local "bind" from plain gimple to gimple_bind. (lower_rec_input_clauses): Strengthen local "g" from plain gimple to gimple_assign. (lower_lastprivate_clauses): Likewise for "stmt" to gimple_cond and

[PATCH 42/89] Introduce gimple_omp_single

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_single): New typedef. (const_gimple_omp_single): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_omp_single): New. (gimple_build_omp_single): Return a gimple_omp_single rather than a plain gimple. (gimple_om

[PATCH 36/89] Introduce gimple_omp_continue

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_continue): New typedef. (const_gimple_omp_continue): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_omp_continue): New. (gimple_build_omp_continue): Return a gimple_omp_continue rather than a plain gimple.

[PATCH 71/89] Concretize gimple_cond_make_{false|true}

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_cond_make_false): Require a gimple_cond. (gimple_cond_make_true): Likewise. * tree-cfg.c (fold_cond_expr_cond): Add a checked cast to gimple_cond within region guarded by check for GIMPLE_COND. * tree-ssa-ccp.c (ccp_fold_stmt): Likewi

[PATCH 24/89] Introduce gimple_transaction

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_transaction): New typedef. (const_gimple_transaction): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_transaction): New. (gimple_statement_base::dyn_cast_gimple_transaction): New. (gimple_build_transaction): Return a g

[PATCH 72/89] Concretize gimple_switch_index and gimple_switch_index_ptr

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_switch_index): Require a const_gimple_switch rather than a plain const_gimple. (gimple_switch_index_ptr): Likewise. * gimplify-me.c (gimple_regimplify_operands): Add checked cast to gimple_switch within "case GIMPLE_SWITCH". *

[PATCH 74/89] Concretize gimple_cond_set_code

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_cond_set_code): Require a gimple_cond. * tree-complex.c (expand_complex_comparison): Add a checked cast to gimple_cond within "case GIMPLE_COND". * tree-ssa-loop-ivcanon.c (create_canonical_iv): Convert local "cond" to a gimple_cond,

[PATCH 62/89] Concretize gimple_label_label

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_label_label): Require a const_gimple_label rather than just a const_gimple. * cfgexpand.c (label_rtx_for_bb): Convert local from gimple to gimple_label, replacing a check against GIMPLE_LABEL with a dyn_cast_gimple_label. * pr

[PATCH 25/89] Introduce gimple_catch

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_catch): New typedef. (const_gimple_catch): New typedef. * gimple-low.c (lower_try_catch): Add checked cast to gimple_catch. (gimple_try_catch_may_fallthru): Likewise. * gimple-pretty-print.c (dump_gimple_catch): Require a gimple_c

[PATCH 28/89] Introduce gimple_eh_else

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_eh_else): New typedef. (const_gimple_eh_else): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_eh_else): New. (gimple_build_eh_else): Return a gimple_eh_else rather than a plain gimple. (gimple_eh_else_n_body_pt

[PATCH 37/89] Introduce gimple_omp_critical

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_critical): New typedef. (const_gimple_omp_critical): New typedef. * gimple-pretty-print.c (dump_gimple_omp_critical): Require a gimple_omp_critical rather than a plain gimple. (pp_gimple_stmt_1): Add a checked cast to gimple_om

[PATCH 57/89] Concretize parameter to gimple_call_copy_skip_args

2014-04-21 Thread David Malcolm
gcc/ * gimple.c (gimple_call_copy_skip_args): Require a gimple_call. * gimple.h (gimple_call_copy_skip_args): Likewise. --- gcc/gimple.c | 2 +- gcc/gimple.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/gimple.c b/gcc/gimple.c index 6de651d..75a9f5f 10

[PATCH 32/89] Introduce gimple_try

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_try): New typedef. (const_gimple_try): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_try): New. * gimple-low.c (gimple_try_catch_may_fallthru): Require a gimple_try rather than a plain gimple. (gimple_stmt_ma

[PATCH 08/89] Introduce gimple_phi and use it in various places

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_phi): New typedef. (const_gimple_phi): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_phi): New. (gimple_statement_base::dyn_cast_gimple_phi): New. * gdbhooks.py (build_pretty_printer): Add gimple_phi and its

[PATCH 51/89] Update GRAPHITE to use more concrete gimple statement classes

2014-04-21 Thread David Malcolm
gcc/ * graphite-scop-detection.c (canonicalize_loop_closed_ssa): Strengthen local "psi" to be a gimple_phi_iterator and "phi" to a gimple_phi. * graphite-sese-to-poly.c (phi_arg_in_outermost_loop): Require a gimple_phi rathen than a plain gimple. (re

[PATCH 27/89] Introduce gimple_eh_must_not_throw

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_eh_must_not_throw): New typedef. (const_gimple_eh_must_not_throw): New typedef. * gimple-pretty-print.c (dump_gimple_eh_must_not_throw): Require a gimple_eh_must_not_throw rather than a plain gimple. (pp_gimple_stmt_1): Add a check

[PATCH 10/89] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * tree-ssa-propagate.h (typedef ssa_prop_visit_phi_fn): Strengthen type of parameter from gimple to gimple_phi. * tree-complex.c (complex_visit_phi): Update signature of callback implementation accordingly. * tree-ssa-ccp.c (ccp_visit_phi_node): Likewis

[PATCH 18/89] Concretize get_loop_exit_condition et al to working on gimple_cond

2014-04-21 Thread David Malcolm
gcc/ * tree-scalar-evolution.h (get_loop_exit_condition): Return a gimple_cond. * tree-scalar-evolution.c (get_loop_exit_condition): Likewise, also concretizing local "res" from gimple to gimple_cond. * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes)

[PATCH 15/89] tree-ssa-loop-manip.c: use gimple_phi in three places

2014-04-21 Thread David Malcolm
gcc/ * tree-ssa-loop-manip.c (add_exit_phi): Convert local "phi" to be a gimple_phi. (split_loop_exit_edge): Likewise for "phi" and "new_phi". --- gcc/tree-ssa-loop-manip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-loop-manip.c b/g

[PATCH 26/89] Introduce gimple_eh_filter

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_eh_filter): New typedef. (const_gimple_eh_filter): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_eh_filter): New. (gimple_build_eh_filter): Return a gimple_eh_filter rather than a plain gimple. * gimple-prett

[PATCH 55/89] Use gimple_call for callgraph edges

2014-04-21 Thread David Malcolm
gcc/ * cgraph.h (cgraph_edge::call_stmt): Strengthen field from plain gimple to a gimple_call. (cgraph_create_edge): Require a gimple_call rather than a plain gimple. (cgraph_create_indirect_edge): Likewise. (cgraph_set_call_stmt): Likewise. (

[PATCH 75/89] Concretize gimple_cond_set_{lhs|rhs}

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_cond_set_lhs): Require a gimple_cond. (gimple_cond_set_rhs): Likewise. * tree-parloops.c (transform_to_exit_first_loop): Convert locals "cond_stmt" and "cond_nit" to gimple_cond, adding checked casts, since the existing code assumes t

[PATCH 61/89] Concretize gimple_call_use_set and gimple_call_clobber_set

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_use_set): Require a gimple_call. (gimple_call_clobber_set): Likewise. --- gcc/gimple.h | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index 3c54119..e4aeec6 100644 --- a/gcc/gimple.h +++ b/gcc/

[PATCH 33/89] Use more concrete types for various gimple statements

2014-04-21 Thread David Malcolm
gcc/ * cgraphunit.c (thunk_adjust): Strengthen local "stmt" from gimple to gimple_assign. * gimple-ssa-isolate-paths.c (insert_trap_and_remove_trailing_statements): Strengthen local "new_stmt" from gimple to gimple_call. * gimple-ssa-strength-reduct

[PATCH 81/89] Concretize gimple_call_set_fn

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_set_fn): Require a gimple_call. * trans-mem.c (dump_tm_memopt_transform): Likewise. (tm_memopt_transform_blocks): Add checked casts to gimple_call in suites guarded by is_tm_simple_{load|store}, which enforce that the statement m

[PATCH 38/89] Introduce gimple_omp_for

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_for): New. (const_gimple_omp_for): New. * gimple.h (gimple_statement_base::as_a_gimple_omp_for): New. (gimple_statement_base::dyn_cast_gimple_omp_for): New. (gimple_build_omp_for): Return a gimple_omp_for rather than a

[PATCH 35/89] Introduce gimple_omp_atomic_store

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_atomic_store): New typedef. (const_gimple_omp_atomic_store): New typedef. * gimple-pretty-print.c (dump_gimple_omp_atomic_store): Require a gimple_omp_atomic_store rather than a plain gimple. (pp_gimple_stmt_1): Add checked cas

[PATCH 52/89] Make gimple_phi_arg_edge require a gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_phi_arg_edge): Require a gimple_phi rather than a plain gimple. * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Require a gimple_phi_iterator; strengthen local "phi" from gimple to a gimple_phi. (rewrite_cross_bb_scalar_de

[PATCH 12/89] tree-predcom.c: use gimple_phi in various places

2014-04-21 Thread David Malcolm
gcc/ * tree-predcom.c (find_looparound_phi): Return a gimple_phi rather than just a gimple. (insert_looparound_copy): Require a gimple_phi rather than just a gimple. (add_looparound_copies): Convert local "phi" to be a gimple_phi. (initialize_root_var

[PATCH 07/89] Introduce gimple_debug and use it in a few places

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_debug): New typedef. (const_gimple_debug): New typedef. * gimple.h (struct gimple_statement_debug): New subclass of gimple_statement_with_ops, adding the invariant that stmt->code == GIMPLE_DEBUG. (gimple_statement_base::as

[PATCH 22/89] Introduce gimple_goto

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_goto): New typedef. (const_gimple_goto): New typedef. * gimple.h (gimple_statement_goto): New subclass of gimple_statement_with_ops, adding the invariant that stmt->code == GIMPLE_GOTO. (gimple_statement_base::as_a_gimple_g

[PATCH 14/89] tree-ssa-loop-niter.c: use gimple_phi in a few places

2014-04-21 Thread David Malcolm
gcc/ * tree-ssa-loop-niter.c (chain_of_csts_start): Return a gimple_phi rather than a gimple. (get_base_for): Likewise; convert local "phi" to be a gimple_phi. (loop_niter_by_eval): Convert local "phi" to be a gimple_phi. --- gcc/tree-ssa-loop-niter.c | 11 ++---

[PATCH 44/89] Introduce gimple_omp_teams

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_omp_teams): New typedef. (const_gimple_omp_teams): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_omp_teams): New. (gimple_build_omp_teams): Return a gimple_omp_teams rather than a plain gimple. (gimple_omp_tea

[PATCH 54/89] Make gimple_call_return_slot_opt_p require a gimple_call.

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call rather than a plain gimple. * gimple-walk.c (walk_stmt_load_store_addr_ops): Convert usage of is_gimple_call to dyn_cast_gimple_call, introducing a new local "call_stmt". * trans

[PATCH 40/89] tree-cfg.c: Make verify_gimple_call require a gimple_call

2014-04-21 Thread David Malcolm
gcc/ * tree-cfg.c (verify_gimple_call): Require a gimple_call rather than a plain gimple. (verify_gimple_stmt): Add checked cast to gimple_call within GIMPLE_CALL case of switch statement. --- gcc/tree-cfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH 68/89] Concretize three gimple_return_ accessors

2014-04-21 Thread David Malcolm
gcc/ * gimple.h (gimple_return_retval_ptr): Require a const_gimple_return rather than a const_gimple. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a gimple_return. * cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to g

[PATCH 23/89] Introduce gimple_asm

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_asm): New typedef. (const_gimple_asm): New typedef. * gimple.h (gimple_statement_base::as_a_gimple_asm): New. gimple_statement_base::dyn_cast_gimple_asm): New. (gimple_build_asm_vec): Return a gimple_asm rather than just a

[PATCH 13/89] tree-ssa-phiprop.c: use gimple_phi

2014-04-21 Thread David Malcolm
gcc/ * tree-ssa-phiprop.c (phiprop_insert_phi): Strengthen types of parameter "phi" and local "new_phi" from gimple to gimple_phi. --- gcc/tree-ssa-phiprop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c inde

[PATCH 30/89] Introduce gimple_eh_dispatch

2014-04-21 Thread David Malcolm
gcc/ * coretypes.h (gimple_eh_dispatch): New typedef. (const_gimple_eh_dispatch): New typedef. * gimple-pretty-print.c (dump_gimple_eh_dispatch): Require a gimple_eh_dispatch rather than a plain gimple. (pp_gimple_stmt_1): Add a checked cast to gimple_eh_dis

Re: [PATCH 01/89] Const-correctness fixes for some gimple accessors

2014-04-21 Thread David Malcolm
On Mon, 2014-04-21 at 12:43 -0600, Jeff Law wrote: > On 04/21/14 10:56, David Malcolm wrote: > > gcc/ > > * gimple.h (gimple_assign_single_p): Accept a const_gimple rather > > than a gimple. > > (gimple_store_p): Likewise. > >

Re: [PATCH 00/89] Compile-time gimple-checking

2014-04-22 Thread David Malcolm
On Tue, 2014-04-22 at 09:03 +0100, Richard Sandiford wrote: > First of all, thanks a lot for doing this. Maybe one day we'll have > the same in rtl :-) > > But... > > David Malcolm writes: > > In doing the checked downcasts I ran into the verbosity of the as_a <

Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-22 Thread David Malcolm
On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote: > > --- a/gcc/tree-loop-distribution.c > > +++ b/gcc/tree-loop-distribution.c > > @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, > > partition_t partition, > > } > > else if (gimple_code (stmt) ==

Re: [PATCH 71/89] Concretize gimple_cond_make_{false|true}

2014-04-22 Thread David Malcolm
On Tue, 2014-04-22 at 11:37 -0400, Trevor Saunders wrote: > > diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c > > index 902b879..62ec9f5 100644 > > --- a/gcc/tree-vrp.c > > +++ b/gcc/tree-vrp.c > > @@ -9517,10 +9517,11 @@ fold_predicate_in (gimple_stmt_iterator *si) > >else > > { > >

Re: [PATCH 00/89] Compile-time gimple-checking

2014-04-22 Thread David Malcolm
On Tue, 2014-04-22 at 09:05 -0400, Andrew MacLeod wrote: > On 04/22/2014 04:03 AM, Richard Sandiford wrote: > > First of all, thanks a lot for doing this. Maybe one day we'll have > > the same in rtl :-) > > > > But... > > > > David Malcolm writes: &g

<    8   9   10   11   12   13   14   15   16   17   >