Update various expressions within tree-scalar-evolution.c to be gimple_phi
[official-gcc.git] / gcc / ChangeLog.gimple-classes
blobc28facc442265a931dca787e71826ab8d371f3d7
1 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
3         Update various expressions within tree-scalar-evolution.c to be gimple_phi
5         * tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi,
6         rather than a gimple.
7         (follow_ssa_edge_binary): Likewise.
8         (follow_ssa_edge_expr): Likewise.
9         (follow_ssa_edge_in_rhs): Likewise.
10         (backedge_phi_arg_p): Likewise.
11         (follow_ssa_edge_in_condition_phi_branch): Likewise.
12         (follow_ssa_edge_in_condition_phi): Likewise.
13         (follow_ssa_edge_inner_loop_phi): Likewise.
14         (analyze_evolution_in_loop): Likewise.
15         (analyze_initial_condition): Likewise.
16         (interpret_loop_phi): Likewise.
17         (interpret_condition_phi): Likewise.
18         (follow_ssa_edge): Likewise; also, add checked casts to gimple_phi.
20         (analyze_scalar_evolution_1): Add checked casts to gimple_phi
21         within "case GIMPLE_PHI".
23 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
25         tree-ssa-loop-ivopts.c: use gimple_phi in a few places
27         * tree-ssa-loop-ivopts.c (determine_biv_step): Require a gimple_phi.
28         (find_bivs): Convert local "phi" into a gimple_phi.
29         (mark_bivs): Likewise.
31 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
33         tree-ssa-loop-manip.c: use gimple_phi in three places
35         * tree-ssa-loop-manip.c (add_exit_phi): Convert local "phi" to be a
36         gimple_phi.
37         (split_loop_exit_edge): Likewise for "phi" and "new_phi".
39 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
41         tree-ssa-loop-niter.c: use gimple_phi in a few places
43         * tree-ssa-loop-niter.c (chain_of_csts_start): Return a gimple_phi
44         rather than a gimple.
45         (get_base_for): Likewise; convert local "phi" to be a gimple_phi.
46         (loop_niter_by_eval): Convert local "phi" to be a gimple_phi.
48 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
50         tree-ssa-phiprop.c: use gimple_phi
52         * tree-ssa-phiprop.c (phiprop_insert_phi): Strengthen types of
53         parameter "phi" and local "new_phi" from gimple to gimple_phi.
55 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
57         tree-predcom.c: use gimple_phi in various places
59         * tree-predcom.c (find_looparound_phi): Return a gimple_phi rather
60         than just a gimple.
61         (insert_looparound_copy): Require a gimple_phi rather than just a
62         gimple.
63         (add_looparound_copies): Convert local "phi" to be a gimple_phi.
64         (initialize_root_vars): Likewise.
65         (initialize_root_vars_lm): Likewise.
67 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
69         tree-parloops.c: use gimple_phi in various places
71         * tree-parloops.c (struct reduction_info): Strengthen field "new_phi"
72         from gimple to gimple_phi.
73         (create_phi_for_local_result): Convert local "new_phi" to gimple_phi.
74         (loop_has_vector_phi_nodes): Require a gimple_phi rather than a gimple.
75         (gather_scalar_reductions): Convert to a gimple_phi_iterator and
76         gimple_phi.
77         (try_create_reduction_list): Likewise.
79 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
81         Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
83         * tree-ssa-propagate.h (typedef ssa_prop_visit_phi_fn): Strengthen
84         type of parameter from gimple to gimple_phi.
86         * tree-complex.c (complex_visit_phi): Update signature of callback
87         implementation accordingly.
88         * tree-ssa-ccp.c (ccp_visit_phi_node): Likewise.
89         * tree-ssa-copy.c (copy_prop_visit_phi_node): Likewise.
90         * tree-vrp.c (vrp_visit_phi_node): Likewise.
92         * tree-ssa-propagate.c (simulate_stmt): Add a checked cast to
93         gimple_phi when invoking the ssa_prop_visit_phi callback.
95 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
97         Introduce gimple_phi_iterator
99         * gimple-iterator.h (struct gimple_phi_iterator): New subclass of
100         gimple_stmt_iterator with identical layout, but adding...
101         (gimple_phi_iterator::phi): ...new method, equivalent to
102         gsi_stmt (), but casting the underlying gimple to gimple_phi,
103         checking that code == GIMPLE_PHI in a checked build.
104         (gsi_start_phis): Return a gimple_phi_iterator, rather than just a
105         gimple_stmt_iterator.
107         * tree-if-conv.c (bb_with_exit_edge_p): Require a gimple_phi rather
108         than just a gimple.
109         (if_convertible_phi_p): Likewise.
110         * tree-phinodes.h (add_phi_node_to_bb): Likewise.
111         * tree-ssa-phiprop.c (propagate_with_phi): Likewise.
113         * tree-ssa-uninit.c (warn_uninitialized_phi): Require a gimple_phi
114         and a vec<gimple_phi> *, rather than just a gimple and
115         vec<gimple> *, and a hash_set<gimple_phi> * rather than a
116         hash_set<gimple> *.
117         (find_uninit_use): Likewise; add checked cast to gimple_phi when
118         adding to worklist.
119         (pass_late_warn_uninitialized::execute): Strengthen types of
120         various locals, "worklist" from vec<gimple> to vec<gimple_phi>,
121         "gsi" to a gimple_phi_iterator, "phi" and "cur_phi" to a
122         gimple_phi, "added_to_worklist" from hash_set<gimple> to
123         hash_set<gimple_phi>.
125         * tree-ssa-loop-manip.c (rewrite_phi_with_iv): Require a
126         gimple_phi_iterator * rather than a gimple_stmt_iterator *;
127         use it to strengthen local from a gimple to a gimple_phi.
129         * cfgloop.c (find_subloop_latch_edge_by_ivs): Convert local from a
130         gimple_stmt_iterator to a gimple_phi_iterator.  Use the iterator's
131         "phi" method rather than gsi_stmt.  Use this checked cast to convert
132         the type of related local from a plain gimple to a gimple_phi.
133         * gimple-pretty-print.c (dump_phi_nodes): Likewise.
134         * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour):
135         Likewise.
136         * sese.c (sese_add_exit_phis_edge): Likewise.
137         * tree-cfg.c (reinstall_phi_args): Likewise.
138         (gimple_make_forwarder_block): Likewise.
139         (add_phi_args_after_copy_edge): Likewise.
140         (gimple_lv_adjust_loop_header_phi): Likewise.
141         * tree-cfgcleanup.c (phi_alternatives_equal): Likewise.
142         (remove_forwarder_block_with_phi): Likewise.
143         (merge_phi_nodes): Likewise.
144         * tree-complex.c (update_phi_components): Likewise.
145         * tree-if-conv.c (if_convertible_loop_p_1): Likewise.
146         * tree-inline.c (update_ssa_across_abnormal_edges): Likewise.
147         (copy_phis_for_bb): Likewise.
148         * tree-into-ssa.c (rewrite_add_phi_arguments): Likewise.
149         * tree-outof-ssa.c (eliminate_build): Likewise.
150         (eliminate_useless_phis): Likewise.
151         (rewrite_trees): Likewise.
152         (insert_backedge_copies): Likewise.
153         * tree-phinodes.c (reserve_phi_args_for_new_edge): Likewise.
154         (remove_phi_args): Likewise.
155         (remove_phi_nodes): Likewise.
156         * tree-predcom.c (find_looparound_phi): Likewise.
157         (eliminate_temp_copies): Likewise.
158         * tree-scalar-evolution.c (loop_closed_phi_def): Likewise.
159         (scev_const_prop): Likewise; also, add checked cast to phi.
160         * tree-ssa-coalesce.c (coalesce_partitions): Likewise.
161         * tree-ssa-dce.c (remove_dead_phis): Likewise.
162         (forward_edge_to_pdom): Likewise.
163         * tree-ssa-dom.c (record_equivalences_from_phis): Likewise.
164         (cprop_into_successor_phis): Likewise.
165         (propagate_rhs_into_lhs): Likewise.
166         (eliminate_degenerate_phis_1): Likewise.
167         * tree-ssa-ifcombine.c (same_phi_args_p): Likewise.
168         * tree-ssa-live.c (calculate_live_on_exit): Likewise.
169         (verify_live_on_entry): Likewise.
170         * tree-ssa-loop-im.c
171         (move_computations_dom_walker::before_dom_children): Likewise.
172         * tree-ssa-loop-ivopts.c (find_bivs): Likewise.
173         (mark_bivs): Likewise.
174         (find_interesting_uses_outside): Likewise.
175         (determine_set_costs): Likewise.
176         * tree-ssa-loop-manip.c (split_loop_exit_edge): Likewise.
177         (tree_transform_and_unroll_loop): Likewise.
178         (rewrite_all_phi_nodes_with_iv): Likewise.
179         (canonicalize_loop_ivs): Likewise.
180         * tree-ssa-loop-niter.c (determine_value_range): Likewise.
181         * tree-ssa-phiopt.c (hoist_adjacent_loads): Likewise.
182         * tree-ssa-phiprop.c (tree_ssa_phiprop): Likewise.
183         * tree-ssa-reassoc.c (suitable_cond_bb): Likewise.
184         * tree-ssa-tail-merge.c (same_phi_alternatives_1): Likewise.
185         (vop_phi): Likewise.
186         * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
187         Likewise.
188         * tree-ssa-threadupdate.c (copy_phi_arg_into_existing_phi): Likewise.
189         (copy_phi_args): Likewise.
190         (phi_args_equal_on_edges): Likewise.
191         * tree-ssa.c (ssa_redirect_edge): Likewise.
192         (flush_pending_stmts): Likewise.
193         * tree-switch-conversion.c (check_final_bb): Likewise.
194         (gather_default_values): Likewise.
195         (build_constructors): Likewise.
196         (fix_phi_nodes): Likewise.
197         * tree-tailcall.c (propagate_through_phis): Likewise.
198         (add_successor_phi_arg): Likewise.
199         * tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1):
200         Likewise.
201         (slpeel_update_phi_nodes_for_guard2): Likewise.
202         (slpeel_tree_peel_loop_to_edge): Likewise.
203         (vect_can_advance_ivs_p): Likewise.
204         (vect_update_ivs_after_vectorizer): Likewise.
205         * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Likewise.
206         * tree-vrp.c (find_assert_locations): Likewise.
207         * value-prof.c (gimple_ic): Likewise.
209         * omp-low.c (expand_parallel_call): Convert local to a gimple_phi.
211 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
213         Introduce gimple_phi and use it in various places
215         * coretypes.h (gimple_phi): New typedef.
216         (const_gimple_phi): New typedef.
218         * gdbhooks.py (build_pretty_printer): Add gimple_phi and its
219         variants, using the gimple printer.
221         * gimple.h (gimple_vec): Eliminate thie typedef in the hope of using
222         vecs of more concrete gimple subclasses as appropriate; also the
223         comment is about to become misleading.
225         * gimple.h (gimple_phi_capacity): Use const_gimple_phi typedef
226         rather than spelling out the full type.
227         (gimple_phi_num_args): Likewise.
228         (gimple_phi_result): Likewise.
229         (gimple_phi_result_ptr): Use gimple_phi typedef.
230         (gimple_phi_set_result): Likewise.
231         (gimple_phi_arg): Likewise.
232         (gimple_phi_set_arg): Likewise.
233         * tree-phinodes.c (allocate_phi_node): Likewise.
234         (resize_phi_node): Likewise.
235         (reserve_phi_args_for_new_edge): Likewise.
236         (remove_phi_arg_num): Likewise.
238         * gimple-pretty-print.c (dump_gimple_phi): Require a gimple_phi
239         rather than just a gimple.
240         * tree-into-ssa.c (mark_phi_for_rewrite): Likewise.
242         * tree-phinodes.c (make_phi_node): Return a gimple_phi rather than
243         just a gimple.
244         (create_phi_node): Likewise.
245         * tree-phinodes.h (create_phi_node): Likewise.
247         * trans-mem.c (struct struct tm_log_entry): Replace use of
248         now-removed gimple_vec with a plain vec<gimple>.
250         * tree-into-ssa.c (phis_to_rewrite): Strengthen from a
251         vec<gimple_vec> to a vec< vec<gimple_phi> >.
253         * tree-into-ssa.c (insert_phi_nodes_for): Update local to be a
254         gimple_phi.
255         * tree-into-ssa.c (rewrite_update_phi_arguments): Strengthen local
256         "phis" from a gimple_vec to a vec<gimple_phi>, and local "phi" to
257         a gimple_phi.
258         * tree-into-ssa.c (delete_update_ssa): Strengthen local
259         "phis" from a gimple_vec to a vec<gimple_phi>.
261         * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
262         gimple_phi in regions where a stmt is known to have code
263         GIMPLE_PHI.
264         * tree-into-ssa.c (mark_use_interesting): Likewise.
266 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
268         Introduce gimple_debug and use it in a few places
270         * coretypes.h (gimple_debug): New typedef.
271         (const_gimple_debug): New typedef.
273         * gimple.h (struct gimple_statement_debug): New subclass of
274         gimple_statement_with_ops, adding the invariant that
275         stmt->code == GIMPLE_DEBUG.
276         (is_a_helper <gimple_statement_debug>::test): New.
278         * gdbhooks.py (build_pretty_printer): Add gimple_debug and its
279         variants, using the gimple printer.
281         * gimple-pretty-print.c (dump_gimple_debug): Require a gimple_debug
282         rather than just a gimple.
283         * tree-inline.c (copy_debug_stmt): Likewise.
285         * tree-inline.h (struct copy_body_data): Strengthen field
286         "debug_stmts" from a vec<gimple> to a vec<gimple_debug>.
288         * gimple.c (gimple_build_debug_bind_stat): Return a gimple_debug
289         rather than just a gimple.
290         (gimple_build_debug_source_bind_stat): Likewise.
291         * gimple.h (gimple_build_debug_bind_stat): Likewise.
292         (gimple_build_debug_source_bind_stat): Likewise.
294         * tree-inline.c (remap_gimple_stmt): Update locals to be a
295         gimple_debug.
296         (maybe_move_debug_stmts_to_successors): Likewise.
297         (copy_debug_stmts): Likewise.
299         * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
300         gimple_debug in regions where a stmt is known to have code
301         GIMPLE_DEBUG.
303 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
305         Introduce gimple_label and use it in a few places
307         * coretypes.h (gimple_label): New typedef.
308         (const_gimple_label): New typedef.
310         * gimple.h (struct gimple_statement_label): New subclass of
311         gimple_statement_with_ops, adding the invariant that
312         stmt->code == GIMPLE_LABEL.
313         (is_a_helper <gimple_statement_label>::test): New.
315         * gdbhooks.py (build_pretty_printer): Add gimple_label and its
316         variants, reusing the gimple printer.
318         * gimple-pretty-print.c (dump_gimple_label): Require a gimple_label
319         rather than just a gimple.
320         * tree-cfg.c (verify_gimple_label): Likewise.
322         * gimple.c (gimple_build_label): Return a gimple_label rather than
323         just a gimple.
324         * gimple.h (gimple_build_label): Likewise.
326         * gimplify.c (gimplify_case_label_expr): Update local to be a
327         gimple_label.
328         * tree-switch-conversion.c (gen_inbound_check): Likewise.
330         * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
331         gimple_label in regions where a stmt is known to have code
332         GIMPLE_LABEL.
333         * tree-cfg.c (verify_gimple_stmt): Likewise.
335 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
337         Introduce gimple_assign and use it in various places
339         * coretypes.h (gimple_assign): New typedef.
340         (const_gimple_assign): New typedef.
342         * gimple.h (struct gimple_statement_assign): New subclass of
343         gimple_statement_with_memory_ops, adding the invariant that
344         stmt->code == GIMPLE_ASSIGN.
345         (is_a_helper <gimple_statement_assign>::test): New.
347         * gdbhooks.py (build_pretty_printer): Add gimple_assign and its
348         variants, using the gimple printer.
350         * gimple-builder.c (build_assign): Return a gimple_assign rather
351         than just a gimple from each of the overloaded variants.
352         (build_type_cast): Likewise.
353         * gimple-builder.h (build_assign): Likewise.
354         (build_type_cast): Likewise.
355         * gimple.c (gimple_build_assign_stat): Likewise.
356         (gimple_build_assign_with_ops): Likewise.
357         * gimple.h (gimple_build_assign_stat): Likewise.
358         (gimple_build_assign_with_ops): Likewise.
360         * asan.c (get_mem_ref_of_assignment): Require a const_gimple_assign
361         rather than just a "const gimple" (the latter is not a
362         "const_gimple").
363         * gimple-pretty-print.c (dump_unary_rhs): Require a gimple_assign
364         rather than just a gimple.
365         (dump_binary_rhs): Likewise.
366         (dump_ternary_rhs): Likewise.
367         * tree-cfg.c (verify_gimple_assign_unary): Likewise.
368         (verify_gimple_assign_binary): Likewise.
369         (verify_gimple_assign_ternary): Likewise.
370         (verify_gimple_assign_single): Likewise.
371         (verify_gimple_assign): Likewise.
372         * tree-ssa-sccvn.c (simplify_unary_expression): Likewise.
373         (try_to_simplify): Likewise.
374         * tree-tailcall.c (process_assignment): Likewise.
375         * tree-vect-generic.c (expand_vector_operation): Likewise.
376         * tree-vrp.c (extract_range_from_cond_expr): Likewise.
377         (extract_range_from_assignment): Likewise.
379         * asan.c (has_stmt_been_instrumented_p): Add checked cast to
380         gimple_assign in regions where a stmt is known to have code
381         GIMPLE_ASSIGN.
382         * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
383         * tree-cfg.c (verify_gimple_stmt): Likewise.
384         * tree-ssa-sccvn.c (visit_use): Likewise.
385         * tree-tailcall.c (find_tail_calls): Likewise.
386         * tree-vrp.c (vrp_visit_assignment_or_call): Likewise.
388         * tree-vrp.c (simplify_stmt_for_jump_threading): Replace a check
389         against GIMPLE_ASSIGN with a dyn_cast<gimple_assign>, introducing
390         a gimple_assign local.
392         * tree-vect-generic.c (expand_vector_condition): Convert local to a
393         gimple_assign, adding a checked cast when extracting from gsi, since
394         this is only called when  underlying stmt has code GIMPLE_ASSIGN.
395         (optimize_vector_constructor): Likewise.
396         (lower_vec_perm): Likewise.
397         (expand_vector_operations_1): Convert local to a gimple_assign,
398         introducing a dyn_cast.
400 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
402         Introduce gimple_cond and use it in various places
404         * coretypes.h (gimple_cond): New typedef.
405         (const_gimple_cond): Likewise.
407         * gimple.h (struct gimple_statement_cond): New subclass of
408         gimple_statement_with_ops, adding the invariant that
409         stmt->code == GIMPLE_COND.
410         (is_a_helper <gimple_statement_cond>::test): New.
411         (gimple_build_cond): Return a gimple_cond, rather than just
412         a gimple.
413         (gimple_build_cond_from_tree): Likewise.
415         * gdbhooks.py (build_pretty_printer): Add gimple_cond and its
416         variants, using the gimple printer.
418         * cfgexpand.c (expand_gimple_cond): Require a gimple_cond rather
419         than just a gimple.
420         * gimple.h (gimple_cond_set_condition_from_tree): Likewise.
421         (gimple_cond_true_p): Likewise.
422         (gimple_cond_false_p): Likewise.
423         (gimple_cond_set_condition): Likewise.
424         * gimple.c (gimple_cond_set_condition_from_tree): Likewise.
425         * gimple-fold.c (fold_gimple_cond): Likewise.
426         * gimple-pretty-print.c (dump_gimple_cond): Likewise.
427         * tree-ssa-dom.c (canonicalize_comparison): Likewise.
428         * tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise.
429         * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise.
430         (recognize_bits_test): Likewise.
431         * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
432         (thread_around_empty_blocks): Likewise.
433         (thread_through_normal_block): Likewise.
434         (thread_across_edge): Likewise.
435         * tree-ssa-threadedge.h (thread_across_edge): Likewise.
436         * tree-vrp.c (range_fits_type_p): Likewise.
438         * cfgexpand.c (expand_gimple_basic_block): Add checked cast to
439         gimple_cond in regions where a stmt is known to have code GIMPLE_COND.
440         * gimple-fold.c (fold_stmt_1): Likewise.
441         * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
442         * tree-ssa-dom.c (optimize_stmt): Likewise.
443         * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
444         * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.
445         * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
446         Likewise.
447         * tree-vrp.c (simplify_stmt_using_ranges): Likewise.
449         * cfgloopmanip.c (create_empty_loop_on_edge): Update local to be a
450         gimple_cond.
451         * tree-vrp.c (identify_jump_threads): Likewise.
453         * gimple.c (gimple_build_cond): Return a gimple_cond, rather than
454         just a gimple.
455         (gimple_build_cond_from_tree): Likewise.
457         * tree-ssa-dom.c (class dom_opt_dom_walker): Strengthen type of
458         field "m_dummy_cond" from a plain gimple to a gimple_cond.
460         * tree-ssa-ifcombine.c (ifcombine_ifandif): Introduce locals
461         inner_stmt and outer_stmt so that inner_cond and outer_cond can be
462         of type gimple_cond once we know that we have code == GIMPLE_COND.
463         * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Introduce local
464         "last" so that stmt can be of type gimple_cond.
466 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
468         Introduce gimple_bind and use it for accessors.
470         * coretypes.h (gimple_bind): New typedef.
471         (const_gimple_bind): New typedef.
473         * gdbhooks.py (build_pretty_printer): Add gimple_bind
474         and its variants, using the gimple printer.
476         * gimple-pretty-print.c (dump_gimple_bind): Update type-signature to
477         require a gimple_bind rather than just a gimple.
479         * gimple.c (gimple_build_bind): Return a gimple_bind rather than
480         just a gimple.
481         * gimple.h (gimple_build_bind): Likewise.
483         * gimple.h (gimple_seq_first_stmt_as_a_bind): New.
485         * gimple.h (gimple_bind_vars): Update type-signature to
486         require a gimple_bind rather than just a gimple, removing
487         as_a and hence run-time check.
488         (gimple_bind_set_vars): Likewise.
489         (gimple_bind_append_vars): Likewise.
490         (gimple_bind_body_ptr): Likewise.
491         (gimple_bind_body): Likewise.
492         (gimple_bind_set_body): Likewise.
493         (gimple_bind_add_stmt): Likewise.
494         (gimple_bind_add_seq): Likewise.
495         (gimple_bind_block): Likewise.
496         (gimple_bind_set_block): Likewise.
497         * gimplify.c (gimple_push_bind_expr): Likewise.
498         (gimple_current_bind_expr): Likewise.
499         * tree-inline.c (copy_gimple_bind): Likewise.
501         * gimplify.h (gimple_current_bind_expr): Return a gimple_bind
502         rather than a plain gimple.
503         (gimplify_body): Likewise.
504         (gimple_bind_expr_stack): Return a vec<gimple_bind> rather than
505         a vec<gimple>.
507         * gimplify.c (struct gimplify_ctx): Strengthen field
508         "bind_expr_stack" from vec<gimple> to vec<gimple_bind>.
509         (gimple_bind_expr_stack): Likewise for type of returned value.
511         * gimplify.c (gimplify_body): Strengthen various types from gimple
512         to gimple_bind, including the return type.
514         * gimplify.c (declare_vars): Introduce "gs" as a generic gimple,
515         so that local "scope" can be of type gimple_bind once we've reached
516         the region where it must be of code GIMPLE_BIND.
518         * gimple-low.c (lower_gimple_bind): Add checked cast to
519         gimple_bind, since both callers (lower_function_body and
520         lower_stmt) have checked the code for us.
522         * gimple.c (gimple_copy): Add checked cast to gimple_bind in
523         region guarded by check for code GIMPLE_BIND.
524         * gimple-low.c (gimple_stmt_may_fallthru): Likewise.
525         * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
526         * gimple-walk.c (walk_gimple_stmt): Likewise.
527         * omp-low.c (scan_omp_1_stmt): Likewise.
528         (lower_omp_1): Likewise.
529         (lower_omp_for): Likewise.
530         * tree-cfg.c (verify_gimple_in_seq_2): Likewise.
531         (do_warn_unused_result): Likewise.
532         * tree-inline.c (remap_gimple_stmt): Likewise.
533         (estimate_num_insns): Likewise.
534         * tree-nested.c (convert_nonlocal_reference_stmt): Likewise.
536         * gimplify.c (gimplify_bind_expr): Update local(s) to be a
537         gimple_bind rather than just a gimple.
538         (gimplify_function_tree): Likewise.
539         * omp-low.c (lower_omp_sections): Likewise.
540         (lower_omp_single): Likewise.
541         (lower_omp_master): Likewise.
542         (lower_omp_taskgroup): Likewise.
543         (lower_omp_ordered): Likewise.
544         (lower_omp_critical): Likewise.
545         (lower_omp_taskreg): Likewise.
546         (lower_omp_teams): Likewise.
547         * omp-low.c (lower_omp_for): Likewise; use
548         gimple_seq_first_stmt_as_a_bind to encapsulate the checked cast.
549         (lower_omp_target): Likewise.
550         * tree-nested.c (finalize_nesting_tree_1): Likewise.
552         * gimple.c (empty_stmt_p): Add dyn_cast to a gimple_bind.
553         * tree-inline.c (replace_locals_stmt): Add dyn_cast to gimple_bind.
555 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
557         Introduce gimple_switch and use it in various places
559         * gimple.h (gimple_statement_switch): New subclass of
560         gimple_statement_with_ops, adding the invariant that
561         stmt->code == GIMPLE_SWITCH.
562         (is_a_helper <gimple_statement_switch>::test (gimple)): New.
564         * coretypes.h (gimple_switch): New typedef
565         (const_gimple_switch): Likewise.
567         * gdbhooks.py (build_pretty_printer): Add gimple_switch
568         and its variants, using the gimple printer.
570         * gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
571         rather than just a gimple.
572         (gimple_build_switch): Likewise.
573         * gimple.h (gimple_build_switch_nlabels): Likewise.
574         (gimple_build_switch): Likewise.
576         * gimple.h (gimple_switch_num_labels): Update type-signature to
577         require a gimple_switch rather than just a gimple.
578         (gimple_switch_set_num_labels): Likewise.
579         (gimple_switch_set_index): Likewise.
580         (gimple_switch_label): Likewise.
581         (gimple_switch_set_label): Likewise.
582         (gimple_switch_default_label): Likewise.
583         (gimple_switch_set_default_label): Likewise.
584         * expr.h (expand_case): Likewise.
585         * gimple-pretty-print.c (dump_gimple_call): Likewise.
586         * stmt.c (compute_cases_per_edge): Likewise.
587         (expand_case): Likewise.
588         * tree-cfg.h (group_case_labels_stmt): Likewise.
589         * tree-cfg.c (make_gimple_switch_edges): Likewise.
590         (find_taken_edge_switch_expr) Likewise.
591         (find_case_label_for_value) Likewise.
592         (get_cases_for_edge): Likewise.
593         (group_case_labels_stmt): Likewise.
594         (verify_gimple_switch): Likewise.
595         * tree-eh.c (verify_norecord_switch_expr): Likewise.
596         * tree-eh.c (lower_eh_constructs_2): Likewise.
597         * tree-loop-distribution.c (generate_loops_for_partition): Likewise.
598         * tree-ssa-dom.c (record_edge_info): Likewise.
599         * tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
600         (simplify_gimple_switch): Likewise.
601         * tree-switch-conversion.c (emit_case_bit_tests): Likewise.
602         (collect_switch_conv_info): Likewise.
603         (build_constructors): Likewise.
604         (array_value_type): Likewise.
605         (build_one_array): Likewise.
606         (build_arrays): Likewise.
607         (gen_inbound_check): Likewise.
608         * tree-vrp.c (find_switch_asserts): Likewise.
609         (find_case_label_range): Likewise.
610         (find_case_label_ranges): Likewise.
611         (vrp_visit_switch_stmt): Likewise.
612         (simplify_switch_using_ranges): Likewise.
614         * tree-vrp.c (switch_update): Strengthen field "stmt" from being
615         merely a gimple to being a gimple_switch.
617         * cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
618         gimple_switch in regions where the stmt code has been tested as
619         GIMPLE_SWITCH.
620         * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
621         * tree-cfg.c (make_edges): Likewise.
622         (end_recording_case_labels): Likewise.
623         (cleanup_dead_labels): Likewise.
624         (cleanup_dead_labels): Likewise.
625         (group_case_labels): Likewise.
626         (find_taken_edge): Likewise.
627         (find_case_label_for_value): Likewise.
628         (verify_gimple_stmt): Likewise.
629         (gimple_verify_flow_info): Likewise.
630         (gimple_redirect_edge_and_branch): Likewise.
631         * tree-inline.c (estimate_num_insns): Likewise.
632         * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
633         * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
634         * tree-switch-conversion.c (do_switchconv): Likewise.
635         * tree-vrp.c  (find_assert_locations_1): Likewise.
636         (vrp_visit_stmt): Likewise.
637         (simplify_stmt_using_ranges): Likewise.
639         * ipa-inline-analysis.c (set_switch_stmt_execution_predicate):
640         Introduce local "lastg" as a generic gimple, so that local "last"
641         can be of type gimple_switch once lastg's code has been verified.
643         * omp-low.c (diagnose_sb_2): Introduce switch_stmt local to handle
644         the GIMPLE_SWITCH case.
646         * tree-cfg.c (find_taken_edge_switch_expr): Add gimple_switch
647         argument, since the caller (find_taken_edge) has checked that
648         last_stmt is a switch.
650 Copyright (C) 2014 Free Software Foundation, Inc.
652 Copying and distribution of this file, with or without modification,
653 are permitted in any medium without royalty provided the copyright
654 notice and this notice are preserved.