1 2014-10-24 David Malcolm <dmalcolm@redhat.com>
3 Introduce gimple_transaction
5 * coretypes.h (gimple_transaction): New typedef.
6 (const_gimple_transaction): New typedef.
8 * gimple.h (gimple_build_transaction): Return a gimple_transaction
9 rather than a plain gimple.
10 (gimple_transaction_body_ptr): Require a gimple_transaction rather
12 (gimple_transaction_body): Likewise.
13 (gimple_transaction_label_ptr): Likewise.
14 (gimple_transaction_set_body): Likewise.
15 (gimple_transaction_set_label): Likewise.
16 (gimple_transaction_set_subcode): Likewise.
17 (gimple_transaction_label): Require a const_gimple_transaction
18 rather than a plain const_gimple.
19 (gimple_transaction_subcode): Likewise.
21 * gimple-low.c (lower_stmt): Add checked cast to
22 gimple_transaction within GIMPLE_TRANSACTION case of switch
25 * gimple-pretty-print.c (dump_gimple_transaction): Require a
26 gimple_transaction rather than a plain gimple.
27 (pp_gimple_stmt_1): Add checked cast to gimple_transaction within
28 GIMPLE_TRANSACTION case of switch statement.
29 * gimple-streamer-in.c (input_gimple_stmt): Likewise.
30 * gimple-streamer-out.c (output_gimple_stmt): Likewise.
31 * gimple-walk.c (walk_gimple_op): Likewise.
32 (walk_gimple_stmt): Likewise.
34 * gimple.c (gimple_build_transaction): Return a gimple_transaction
35 rather than a plain gimple.
36 (gimple_copy): Add checked casts to gimple_transaction within
37 GIMPLE_TRANSACTION case of switch statement.
39 * gimplify.c (gimplify_transaction): Split local "g" into
40 "body_stmt" and "trans_stmt", strengthening the type of the latter
41 from gimple to gimple_transaction.
43 * omp-low.c (lower_omp_1): Add checked cast to gimple_transaction
44 within GIMPLE_TRANSACTION case of switch statement.
46 * trans-mem.c (diagnose_tm_1): Add checked cast within
47 GIMPLE_TRANSACTION case of switch statement, introducing a new
48 local "trans_stmt". Use it in place of "stmt".
49 (examine_call_tm): Convert local from gimple to gimple_transaction.
50 (tm_region::get_transaction_stmt): New method.
51 (tm_region::transaction_stmt): Add clarification of type to the
53 (tm_region_init_0): Require a gimple_transaction rather than a
55 (tm_region_init): Convert a check against GIMPLE_TRANSACTION to a
56 dyn_cast<gimple_transaction> and new local.
57 (transaction_subcode_ior): Add a new local, using the new
58 get_transaction_stmt method to perform a checked cast.
59 (propagate_tm_flags_out): Likewise.
60 (expand_transaction): Add a checked cast using the new
61 get_transaction_stmt method.
62 (generate_tm_state): Likewise.
63 (execute_tm_mark): Likewise.
64 (ipa_tm_diagnose_transaction): Likewise.
66 * tree-cfg.c (verify_gimple_transaction): Require a
67 gimple_transaction rather than a plain gimple.
68 (make_edges): Add checked cast within GIMPLE_TRANSACTION case of
70 (cleanup_dead_labels): Likewise.
71 (verify_gimple_stmt): Likewise.
72 (verify_gimple_in_seq_2): Likewise.
73 (verify_gimple_in_seq_2): Likewise.
74 (gimple_redirect_edge_and_branch): Add checked cast.
76 * tree-inline.c (remap_gimple_stmt): Add checked cast within
77 GIMPLE_TRANSACTION case of switch statement, introducing a new
78 local "old_trans_stmt". Use it in place of "stmt". Add new
79 local "new_trans_stmt", using it to initialize "copy", and for
80 type-safe operations as a transaction.
81 (estimate_num_insns): Add checked cast within GIMPLE_TRANSACTION
82 case of switch statement.
84 2014-10-24 David Malcolm <dmalcolm@redhat.com>
88 * coretypes.h (gimple_asm): New typedef.
89 (const_gimple_asm): New typedef.
91 * gimple.h (gimple_build_asm_vec): Return a gimple_asm rather than
93 (gimple_asm_clobbers_memory_p): Require a const_gimple_asm rather
94 than just a const_gimple.
95 (gimple_asm_ninputs): Likewise.
96 (gimple_asm_noutputs): Likewise.
97 (gimple_asm_nclobbers): Likewise.
98 (gimple_asm_nlabels): Likewise.
99 (gimple_asm_input_op): Likewise.
100 (gimple_asm_input_op_ptr): Likewise.
101 (gimple_asm_output_op): Likewise.
102 (gimple_asm_output_op_ptr): Likewise.
103 (gimple_asm_clobber_op): Likewise.
104 (gimple_asm_label_op): Likewise.
105 (gimple_asm_string): Likewise.
106 (gimple_asm_volatile_p): Likewise.
107 (gimple_asm_input_p): Likewise.
108 (gimple_asm_set_input_op): Require a gimple_asm rather than a plain
110 (gimple_asm_set_output_op): Likewise.
111 (gimple_asm_set_clobber_op): Likewise.
112 (gimple_asm_set_label_op): Likewise.
113 (gimple_asm_set_volatile): Likewise.
114 (gimple_asm_set_input): Likewise.
116 * cfgexpand.c (expand_asm_stmt): Require a gimple_asm rather than
118 (expand_gimple_stmt_1): Add checked cast to gimple_asm within
119 GIMPLE_ASM case of switch statement.
121 * gimple-fold.c (fold_stmt_1): Add new local from checked cast to
122 gimple_asm within case GIMPLE_ASM.
124 * gimple-pretty-print.c (dump_gimple_asm): Require a gimple_asm
125 rather than a plain gimple.
126 (pp_gimple_stmt_1): Add checked cast to gimple_asm within
127 GIMPLE_ASM case of switch statement.
129 * gimple-streamer-in.c (input_gimple_stmt): Rework existing
130 checked cast to gimple_asm; add a new one.
132 * gimple-streamer-out.c (output_gimple_stmt): Add new local from
133 checked cast to gimple_asm within case GIMPLE_ASM.
135 * gimple-walk.c (walk_gimple_asm): Require a gimple_asm rather
137 (walk_gimple_op): Add checked cast to gimple_asm within GIMPLE_ASM
138 case of switch statement.
139 (walk_stmt_load_store_addr_ops): Use dyn_cast<gimple_asm> in place
140 of a code check against GIMPLE_ASM to introduce a new gimple_asm
143 * gimple.c (gimple_build_asm_1): Return a gimple_asm rather than
145 (gimple_build_asm_vec): Likewise.
146 (gimple_has_side_effects): Add a checked cast to gimple_asm.
147 (gimple_could_trap_p_1): Likewise.
148 (gimple_call_builtin_p): Require a const_gimple_asm rather then
151 * gimplify-me.c (gimple_regimplify_operands): Add a checked cast
152 and a new local of type gimple_asm within GIMPLE_ASM case.
154 * gimplify.c (gimplify_asm_expr): Convert a local from gimple to
157 * ipa-pure-const.c (check_stmt): Add checked casts within
160 * ssa-iterators.h (op_iter_init): Likewise.
162 * tree-cfg.c (make_goto_expr_edges): Convert a local from gimple
164 (cleanup_dead_labels): Add a checked cast and a new local of type
165 gimple_asm within GIMPLE_ASM case.
166 (gimple_redirect_edge_and_branch): Likewise.
167 (is_ctrl_altering_stmt): Add a checked cast.
168 (need_fake_edge_p): Replace a code check against GIMPLE_ASM with a
169 dyn_cast<gimple_asm>.
171 * tree-complex.c (expand_complex_comparison): Convert a local from
172 gimple to gimple_asm.
174 * tree-data-ref.c (get_references_in_stmt): Add a checked cast to
177 * tree-eh.c (stmt_could_throw_p): Likewise.
179 * tree-inline.c (estimate_num_insns): Likewise.
181 * tree-sra.c (scan_function): Add a checked cast and a new local
182 of type gimple_asm within GIMPLE_ASM case.
183 (sra_modify_function_body): Likewise.
184 (ipa_sra_modify_function_body): Likewise.
186 * tree-ssa-coalesce.c (create_outofssa_var_map): Likewise.
188 * tree-ssa-dce.c (propagate_necessity): Replace a code check
189 against GIMPLE_ASM with a dyn_cast<gimple_asm>.
191 * tree-ssa-operands.c (maybe_add_call_vops): Require a gimple_asm
192 rather than a plain gimple.
193 (parse_ssa_operands): Add a checked cast to gimple_asm.
195 * tree-ssa-structalias.c (find_func_aliases): Replace a check for
196 GIMPLE_ASM with a dyn_cast<gimple_asm>, introducing a new local
197 "asm_stmt", using it in place of "t" for typesafety.
199 * tree-ssa-threadedge.c
200 (record_temporary_equivalences_from_stmts_at_dest): Add a checked
203 * tree-ssa.c (execute_update_addresses_taken): Add checked casts
204 and new locals of type gimple_asm within clauses guarded by code
207 2014-10-24 David Malcolm <dmalcolm@redhat.com>
209 Introduce gimple_goto
211 * coretypes.h (gimple_goto): New typedef.
212 (const_gimple_goto): New typedef.
214 * gimple.h (gimple_statement_goto): New subclass of
215 gimple_statement_with_ops, adding the invariant that
216 stmt->code == GIMPLE_GOTO.
217 (is_a_helper <gimple_statement_goto>::test): New.
218 (gimple_build_goto): Return a gimple_goto rather than a
221 * gimple-pretty-print.c (dump_gimple_goto): Require a gimple_goto
222 rather than a plain gimple.
223 (pp_gimple_stmt_1): Add a checked cast to gimple_goto within
224 GIMPLE_GOTO case of switch statement.
226 * gimple.c (gimple_build_goto): Return a gimple_goto rather than a
229 * tree-cfg.c (verify_gimple_goto): Require a gimple_goto rather
231 (verify_gimple_stmt): Add a checked cast to gimple_goto within
232 GIMPLE_GOTO case of switch statement.
234 2014-10-24 David Malcolm <dmalcolm@redhat.com>
236 Introduce gimple_return
238 * coretypes.h (gimple_return): New typedef.
239 (const_gimple_return): New typedef.
241 * gimple.h (gimple_statement_return): New subclass of
242 gimple_statement_with_memory_ops, adding the invariant that
243 stmt->code == GIMPLE_RETURN.
244 (is_a_helper <gimple_statement_return>::test): New.
245 (gimple_build_return): Return a gimple_return rather
248 * gimple.c (gimple_build_return): Return a gimple_return rather
251 * cgraphunit.c (expand_thunk): Convert local from a gimple to
254 * gimple-low.c (struct return_statements_t): Convert field "stmt"
255 from a gimple to a gimple_return.
256 (lower_gimple_return): Convert local from a gimple to a
259 * gimple-pretty-print.c (dump_gimple_return): Require a
260 gimple_return rather than a plain gimple.
261 (pp_gimple_stmt_1): Add a checked cast to gimple_return within
262 case GIMPLE_RETURN of switch statement.
264 * gimplify.c (gimplify_return_expr): Convert locals from
265 gimple to gimple_return.
267 * ipa-split.c (split_function): Likewise.
269 * tree-cfg.c (verify_gimple_assign): Require a gimple_return
270 rather than a plain gimple.
271 (verify_gimple_stmt): Add checked cast to gimple_return within
272 case GIMPLE_RETURN of switch statement.
274 * tree-tailcall.c (adjust_return_value): Convert local from
275 gimple to gimple_return.
277 2014-10-24 David Malcolm <dmalcolm@redhat.com>
279 Introduce gimple_call
281 * coretypes.h (gimple_call): New typedef.
282 (const_gimple_call): New typedef.
284 * asan.c (get_mem_refs_of_builtin_call): Require a
285 const_gimple_call rather than a const gimple.
286 (has_stmt_been_instrumented_p): Add a checked cast to
288 (instrument_strlen_call): Likewise.
289 (instrument_builtin_call): Likewise.
290 * builtins.c (validate_gimple_arglist): Require a
291 const_gimple_call rather than a const gimple.
292 (fold_call_stmt): Require a gimple_call rather than a gimple.
293 * builtins.h (validate_gimple_arglist): Require a
294 const_gimple_call rather than a const gimple.
295 (fold_call_stmt): Require a gimple_call rather than a gimple.
296 * cfgexpand.c (expand_call_stmt): Likewise.
297 (expand_gimple_stmt_1): Add a checked cast to gimple_call within
299 * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Strengthen
300 local "new_stmt" from gimple to gimple_call, adding a checked
302 * cgraphunit.c (cgraph_node::expand_thunk): Likewise for local
304 * gimple-fold.c (gimple_fold_builtin_snprintf_chk): Likewise for
306 (gimple_fold_builtin_snprintf): Likewise.
307 (gimple_fold_builtin): Likewise.
308 (gimple_fold_call): Likewise.
309 (gimple_fold_stmt_to_constant_1): Introduce local "call_stmt" via
310 checked cast of "stmt" to gimple_call, using it in various places
312 * gimple-pretty-print.c (dump_gimple_call_args): Strengthen param
313 2 from gimple to gimple_call.
314 (dump_gimple_call): Likewise.
315 (pp_gimple_stmt_1): Add a checked cast to gimple_call within
317 * gimple-streamer-in.c (input_gimple_stmt): Replace is_gimple_call
318 with a dyn_cast<gimple_call>, introducing local "call_stmt", and
319 using it in place of "stmt" for typesafety. Add a checked cast
320 in statement guarded by check for GIMPLE_CALL.
321 * gimple-walk.c (walk_gimple_op): Add a checked cast to
323 * gimple.c (gimple_call_reset_alias_info): Strengthen param from
324 gimple to gimple_call.
325 (gimple_build_call_1): Strengthen return type and local from
326 gimple to gimple_call.
327 (gimple_build_call_vec): Likewise.
328 (gimple_build_call): Likewise.
329 (gimple_build_call_valist): Likewise.
330 (gimple_build_call_internal_1): Likewise.
331 (gimple_build_call_internal): Likewise.
332 (gimple_build_call_internal_vec): Likewise.
333 (gimple_build_call_from_tree): Likewise.
334 (gimple_call_return_flags): Strengthen param from
335 const_gimple to const_gimple_call.
336 (gimple_call_copy_skip_args): Strengthen return type and local from
337 gimple to gimple_call.
338 * gimple.h (gimple_call_reset_alias_info): Strengthen param from
339 gimple to gimple_call.
340 (gimple_build_call_vec): Strengthen return type from gimple to
342 (gimple_build_call): Likewise.
343 (gimple_build_call_valist): Likewise.
344 (gimple_build_call_internal): Likewise.
345 (gimple_build_call_internal_vec): Likewise.
346 (gimple_build_call_from_tree): Likewise.
347 (gimple_call_return_flags): Strengthen param from const_gimple to
349 (gimple_call_copy_skip_args): Strengthen return type from gimple
351 (gimple_call_set_internal_fn): Strengthen param "call_stmt" from
352 gimple to gimple_call.
353 (gimple_call_return_type): Strengthen param from const_gimple to
355 (gimple_call_chain_ptr): Likewise.
356 (gimple_call_set_chain): Strengthen param from gimple to
358 (gimple_call_set_return_slot_opt): Likewise.
359 (gimple_call_set_from_thunk): Likewise.
360 (gimple_call_from_thunk_p): Likewise.
361 (gimple_call_set_va_arg_pack): Likewise.
362 (gimple_call_va_arg_pack_p): Likewise.
363 (gimple_call_set_alloca_for_var): Likewise.
364 (gimple_call_alloca_for_var_p): Likewise.
365 (gimple_expr_type): Introduce local "call_stmt" via a checked cast
366 and use it for typesafety.
367 * gimplify.c (gimplify_call_expr): Strengthen local "call" from
368 gimple to gimple_call.
369 (gimplify_modify_expr_to_memcpy): Likewise for local "gs".
370 (gimplify_modify_expr_to_memset): Likewise.
371 (gimplify_modify_expr): Add a checked cast to gimple_call.
372 (gimplify_expr): Strengthen local "call" from gimple to
374 (gimplify_function_tree): Likewise.
375 * internal-fn.c (expand_LOAD_LANES): Strengthen param from gimple
377 (expand_STORE_LANES): Likewise.
378 (expand_ANNOTATE): Likewise.
379 (expand_GOMP_SIMD_LANE): Likewise.
380 (expand_GOMP_SIMD_VF): Likewise.
381 (expand_GOMP_SIMD_LAST_LANE): Likewise.
382 (expand_UBSAN_NULL): Likewise.
383 (expand_UBSAN_BOUNDS): Likewise.
384 (expand_UBSAN_OBJECT_SIZE): Likewise.
385 (expand_ASAN_CHECK): Likewise.
386 (ubsan_expand_si_overflow_addsub_check): Likewise.
387 (ubsan_expand_si_overflow_neg_check): Likewise.
388 (ubsan_expand_si_overflow_mul_check): Likewise.
389 (expand_UBSAN_CHECK_ADD): Likewise.
390 (expand_UBSAN_CHECK_SUB): Likewise.
391 (expand_UBSAN_CHECK_MUL): Likewise.
392 (expand_LOOP_VECTORIZED): Likewise.
393 (expand_MASK_LOAD): Likewise.
394 (expand_MASK_STORE): Likewise.
395 (expand_ABNORMAL_DISPATCHER): Likewise.
396 (expand_BUILTIN_EXPECT): Likewise.
397 (internal_fn_expanders): Likewise for entries in this table.
398 (expand_internal_call): Likewise.
399 * internal-fn.def: Update comment to reflect strengthening of
401 * internal-fn.h (expand_internal_call): Strengthen param from
402 gimple to gimple_call.
403 * ipa-prop.c (ipa_modify_call_arguments): Likewise for local
405 * ipa-pure-const.c (check_call): Likewise for param "call".
406 (check_stmt): Add a checked cast to gimple_call within GIMPLE_CALL
408 * ipa-split.c (split_function): Strengthen local "call" from
409 gimple to gimple_call.
410 * omp-low.c (build_omp_barrier): Likewise for local "g".
411 (lower_rec_input_clauses): Likewise for local "stmt".
412 * trans-mem.c (build_tm_load): Likewise for return type and local
414 (build_tm_store): Likewise.
415 (expand_transaction): Likewise for local "call".
416 * tree-call-cdce.c (check_pow): Likewise for param.
417 (check_builtin_call): Likewise.
418 (is_call_dce_candidate): Likewise.
419 (gen_conditions_for_pow): Likewise.
420 (gen_shrink_wrap_conditions): Likewise.
421 (shrink_wrap_one_built_in_call): Likewise.
422 (shrink_wrap_conditional_dead_built_in_calls): Strengthen param
423 from vec<gimple> to vec<gimple_call>, and local "bi_call" from
424 gimple to gimple_call.
425 (pass_call_cdce::execute): Strengthen local
426 "cond_dead_built_in_calls" from auto_vec<gimple> to
427 auto_vec<gimple_call> and local "stmt" from gimple to gimple_call,
428 * tree-cfg.c (notice_special_calls): Strengthen param from gimple
430 * tree-cfg.h (notice_special_calls): Likewise.
431 * tree-complex.c (expand_complex_libcall): Likewise for local
433 * tree-inline.c (remap_gimple_stmt): Add checked cast to
435 (copy_bb): Likewise. Strengthen local "new_call" from gimple to
437 (inline_forbidden_p_stmt): Add checked cast to gimple_call.
438 * tree-nested.c (init_tmp_var_with_call): Strengthen param "call"
439 from gimple to gimple_call.
440 (convert_nl_goto_reference): Likewise for local "call".
441 (convert_tramp_reference_op): Likewise.
442 (convert_gimple_call): Add checked cast to gimple_call.
443 * tree-nrv.c (dest_safe_for_nrv_p): Strengthen param "call" from
444 gimple to gimple_call.
445 (pass_return_slot::execute): Likewise for local "stmt", using a
446 dyn_cast<gimple_call> rather than an is_gimple_call call.
447 * tree-object-size.c (alloc_object_size): Strengthen param "call"
448 from const_gimple to const_gimple_call.
449 (pass_through_call): Likewise.
450 (call_object_size): Strengthen param "call" from gimple to
452 (collect_object_sizes_for): Introduce local "call_stmt" via a
453 checked cast, using it for typesafety.
454 (check_for_plus_in_loops_1): Likewise.
455 (pass_object_sizes::execute): Add a checked cast to gimple_call.
456 * tree-profile.c (gimple_gen_interval_profiler): Strengthen local
457 "call" from gimple to gimple_call.
458 (gimple_gen_pow2_profiler): Likewise.
459 (gimple_gen_one_value_profiler): Likewise.
460 (gimple_gen_time_profiler): Likewise.
461 (gimple_gen_average_profiler): Likewise.
462 (gimple_gen_ior_profiler): Likewise.
463 * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise for
465 (ref_maybe_used_by_call_p): Likewise.
466 (ref_maybe_used_by_stmt_p): Add a checked cast to gimple_call.
467 (call_may_clobber_ref_p_1): Strengthen param "call" from gimple to
469 (call_may_clobber_ref_p): Likewise.
470 (stmt_may_clobber_ref_p_1): Add a checked cast to gimple_call.
471 * tree-ssa-alias.h (call_may_clobber_ref_p): Strengthen param 1
472 from gimple to gimple_call.
473 (call_may_clobber_ref_p_1): Likewise.
474 * tree-ssa-dce.c (eliminate_unnecessary_stmts): Add a checked cast
476 * tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Strengthen
477 local "call" from gimple to gimple_call.
478 * tree-ssa-math-opts.c (build_and_insert_call): Likewise for local
480 * tree-ssa-operands.c (maybe_add_call_vops): Likewise for param
482 (parse_ssa_operands): Add a checked cast to gimple_call within
484 * tree-ssa-pre.c (compute_avail): Add a checked cast to
486 * tree-ssa-sccvn.c (copy_reference_ops_from_call): Strengthen
487 param "call" from gimple to gimple_call.
488 (valueize_shared_reference_ops_from_call): Likewise.
489 (vn_reference_lookup_3): Add a checked cast to gimple_call.
490 (vn_reference_lookup_call): Strengthen param "call" from gimple to
492 (visit_reference_op_call): Likewise for param "stmt".
493 (visit_use): Replace is_gimple_call with a dyn_cast, introducing
494 local "call_stmt", using it in place of "stmt" for type-safety.
495 * tree-ssa-sccvn.h (vn_reference_lookup_call): Strengthen param 1
496 from gimple to gimple_call.
497 * tree-ssa-structalias.c (get_call_vi): Likewise.
498 (lookup_call_use_vi): Likewise.
499 (lookup_call_clobber_vi): Likewise.
500 (get_call_use_vi): Likewise.
501 (get_call_clobber_vi): Likewise.
502 (handle_rhs_call): Likewise.
503 (handle_lhs_call): Likewise.
504 (handle_const_call): Likewise.
505 (handle_pure_call): Likewise.
506 (get_fi_for_callee): Likewise.
507 (find_func_aliases_for_builtin_call): Likewise for param 2.
508 (find_func_aliases_for_call): Likewise.
509 (find_func_aliases): Add a checked cast to gimple_call.
510 (find_func_clobbers): Replace is_gimple_call with a dyn_cast,
511 introducing local "call_stmt", using it in place of "stmt" for
513 (compute_points_to_sets): Strengthen local "stmt" from gimple to
514 gimple_call, replacing is_gimple_call with a
515 dyn_cast <gimple_call>.
516 (ipa_pta_execute): Likewise.
517 * tree-ssa-threadedge.c
518 (record_temporary_equivalences_from_stmts_at_dest): Add checked
520 * tree-tailcall.c (find_tail_calls): Strengthen local "call" from
521 gimple to gimple_call, adding a checked cast.
522 * tree-vect-data-refs.c (vect_setup_realignment): Eliminate
523 top-level local "new_stmt" in favor of more tightly-scoped locals
524 "new_stmt" of type gimple_assign and gimple_call.
525 * tree-vect-patterns.c (vect_recog_pow_pattern): Strenghthen local
526 "stmt" from gimple to gimple_call.
527 * tree-vect-stmts.c (vectorizable_function): Likewise for param
529 (vectorizable_call): Rename param 1 from "stmt" to "gs",
530 reintroducing "stmt" as a gimple_call once we've established that
531 we're working with a GIMPLE_CALL.
532 * tree-vectorizer.h (vectorizable_function): Strengthen param 1
533 from gimple to gimple_call.
534 * value-prof.c (check_ic_target): Likewise.
535 (gimple_ic_transform): Likewise for local "stmt", replacing a
536 check for GIMPLE_CALL with a dyn_cast.
537 (interesting_stringop_to_profile_p): Strengthen param "call"
538 from gimple to gimple_call.
539 (gimple_stringop_fixed_value): Likewise for param "vcall_stmt".
540 (gimple_stringops_transform): Likewise for local "stmt",
541 replacing a check for GIMPLE_CALL with a dyn_cast.
542 (gimple_stringops_values_to_profile): Rename param 1 from "stmt"
543 to "gs", reintroducing "stmt" as a gimple_call once we've
544 established that we're working with a GIMPLE_CALL.
545 * vtable-verify.c (verify_bb_vtables): Strengthen local
546 "call_stmt" from gimple to gimple_call.
548 2014-10-24 David Malcolm <dmalcolm@redhat.com>
550 Concretize get_loop_exit_condition et al to working on gimple_cond
552 * tree-scalar-evolution.h (get_loop_exit_condition): Return a
554 * tree-scalar-evolution.c (get_loop_exit_condition): Likewise, also
555 concretizing local "res" from gimple to gimple_cond.
556 * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Convert
557 locals from gimple to gimple_cond.
558 (slpeel_can_duplicate_loop_p): Likewise.
559 * tree-vect-loop.c (vect_get_loop_niters): Return a gimple_cond.
560 (vect_analyze_loop_form): Convert local from gimple to gimple_cond.
562 2014-10-24 David Malcolm <dmalcolm@redhat.com>
564 Update various expressions within tree-scalar-evolution.c to be gimple_phi
566 * tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi,
567 rather than a gimple.
568 (follow_ssa_edge_binary): Likewise.
569 (follow_ssa_edge_expr): Likewise.
570 (follow_ssa_edge_in_rhs): Likewise.
571 (backedge_phi_arg_p): Likewise.
572 (follow_ssa_edge_in_condition_phi_branch): Likewise.
573 (follow_ssa_edge_in_condition_phi): Likewise.
574 (follow_ssa_edge_inner_loop_phi): Likewise.
575 (analyze_evolution_in_loop): Likewise.
576 (analyze_initial_condition): Likewise.
577 (interpret_loop_phi): Likewise.
578 (interpret_condition_phi): Likewise.
579 (follow_ssa_edge): Likewise; also, add checked casts to gimple_phi.
581 (analyze_scalar_evolution_1): Add checked casts to gimple_phi
582 within "case GIMPLE_PHI".
584 2014-10-24 David Malcolm <dmalcolm@redhat.com>
586 tree-ssa-loop-ivopts.c: use gimple_phi in a few places
588 * tree-ssa-loop-ivopts.c (determine_biv_step): Require a gimple_phi.
589 (find_bivs): Convert local "phi" into a gimple_phi.
590 (mark_bivs): Likewise.
592 2014-10-24 David Malcolm <dmalcolm@redhat.com>
594 tree-ssa-loop-manip.c: use gimple_phi in three places
596 * tree-ssa-loop-manip.c (add_exit_phi): Convert local "phi" to be a
598 (split_loop_exit_edge): Likewise for "phi" and "new_phi".
600 2014-10-24 David Malcolm <dmalcolm@redhat.com>
602 tree-ssa-loop-niter.c: use gimple_phi in a few places
604 * tree-ssa-loop-niter.c (chain_of_csts_start): Return a gimple_phi
605 rather than a gimple.
606 (get_base_for): Likewise; convert local "phi" to be a gimple_phi.
607 (loop_niter_by_eval): Convert local "phi" to be a gimple_phi.
609 2014-10-24 David Malcolm <dmalcolm@redhat.com>
611 tree-ssa-phiprop.c: use gimple_phi
613 * tree-ssa-phiprop.c (phiprop_insert_phi): Strengthen types of
614 parameter "phi" and local "new_phi" from gimple to gimple_phi.
616 2014-10-24 David Malcolm <dmalcolm@redhat.com>
618 tree-predcom.c: use gimple_phi in various places
620 * tree-predcom.c (find_looparound_phi): Return a gimple_phi rather
622 (insert_looparound_copy): Require a gimple_phi rather than just a
624 (add_looparound_copies): Convert local "phi" to be a gimple_phi.
625 (initialize_root_vars): Likewise.
626 (initialize_root_vars_lm): Likewise.
628 2014-10-24 David Malcolm <dmalcolm@redhat.com>
630 tree-parloops.c: use gimple_phi in various places
632 * tree-parloops.c (struct reduction_info): Strengthen field "new_phi"
633 from gimple to gimple_phi.
634 (create_phi_for_local_result): Convert local "new_phi" to gimple_phi.
635 (loop_has_vector_phi_nodes): Require a gimple_phi rather than a gimple.
636 (gather_scalar_reductions): Convert to a gimple_phi_iterator and
638 (try_create_reduction_list): Likewise.
640 2014-10-24 David Malcolm <dmalcolm@redhat.com>
642 Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
644 * tree-ssa-propagate.h (typedef ssa_prop_visit_phi_fn): Strengthen
645 type of parameter from gimple to gimple_phi.
647 * tree-complex.c (complex_visit_phi): Update signature of callback
648 implementation accordingly.
649 * tree-ssa-ccp.c (ccp_visit_phi_node): Likewise.
650 * tree-ssa-copy.c (copy_prop_visit_phi_node): Likewise.
651 * tree-vrp.c (vrp_visit_phi_node): Likewise.
653 * tree-ssa-propagate.c (simulate_stmt): Add a checked cast to
654 gimple_phi when invoking the ssa_prop_visit_phi callback.
656 2014-10-24 David Malcolm <dmalcolm@redhat.com>
658 Introduce gimple_phi_iterator
660 * gimple-iterator.h (struct gimple_phi_iterator): New subclass of
661 gimple_stmt_iterator with identical layout, but adding...
662 (gimple_phi_iterator::phi): ...new method, equivalent to
663 gsi_stmt (), but casting the underlying gimple to gimple_phi,
664 checking that code == GIMPLE_PHI in a checked build.
665 (gsi_start_phis): Return a gimple_phi_iterator, rather than just a
666 gimple_stmt_iterator.
668 * tree-if-conv.c (bb_with_exit_edge_p): Require a gimple_phi rather
670 (if_convertible_phi_p): Likewise.
671 * tree-phinodes.h (add_phi_node_to_bb): Likewise.
672 * tree-ssa-phiprop.c (propagate_with_phi): Likewise.
674 * tree-ssa-uninit.c (warn_uninitialized_phi): Require a gimple_phi
675 and a vec<gimple_phi> *, rather than just a gimple and
676 vec<gimple> *, and a hash_set<gimple_phi> * rather than a
678 (find_uninit_use): Likewise; add checked cast to gimple_phi when
680 (pass_late_warn_uninitialized::execute): Strengthen types of
681 various locals, "worklist" from vec<gimple> to vec<gimple_phi>,
682 "gsi" to a gimple_phi_iterator, "phi" and "cur_phi" to a
683 gimple_phi, "added_to_worklist" from hash_set<gimple> to
684 hash_set<gimple_phi>.
686 * tree-ssa-loop-manip.c (rewrite_phi_with_iv): Require a
687 gimple_phi_iterator * rather than a gimple_stmt_iterator *;
688 use it to strengthen local from a gimple to a gimple_phi.
690 * cfgloop.c (find_subloop_latch_edge_by_ivs): Convert local from a
691 gimple_stmt_iterator to a gimple_phi_iterator. Use the iterator's
692 "phi" method rather than gsi_stmt. Use this checked cast to convert
693 the type of related local from a plain gimple to a gimple_phi.
694 * gimple-pretty-print.c (dump_phi_nodes): Likewise.
695 * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour):
697 * sese.c (sese_add_exit_phis_edge): Likewise.
698 * tree-cfg.c (reinstall_phi_args): Likewise.
699 (gimple_make_forwarder_block): Likewise.
700 (add_phi_args_after_copy_edge): Likewise.
701 (gimple_lv_adjust_loop_header_phi): Likewise.
702 * tree-cfgcleanup.c (phi_alternatives_equal): Likewise.
703 (remove_forwarder_block_with_phi): Likewise.
704 (merge_phi_nodes): Likewise.
705 * tree-complex.c (update_phi_components): Likewise.
706 * tree-if-conv.c (if_convertible_loop_p_1): Likewise.
707 * tree-inline.c (update_ssa_across_abnormal_edges): Likewise.
708 (copy_phis_for_bb): Likewise.
709 * tree-into-ssa.c (rewrite_add_phi_arguments): Likewise.
710 * tree-outof-ssa.c (eliminate_build): Likewise.
711 (eliminate_useless_phis): Likewise.
712 (rewrite_trees): Likewise.
713 (insert_backedge_copies): Likewise.
714 * tree-phinodes.c (reserve_phi_args_for_new_edge): Likewise.
715 (remove_phi_args): Likewise.
716 (remove_phi_nodes): Likewise.
717 * tree-predcom.c (find_looparound_phi): Likewise.
718 (eliminate_temp_copies): Likewise.
719 * tree-scalar-evolution.c (loop_closed_phi_def): Likewise.
720 (scev_const_prop): Likewise; also, add checked cast to phi.
721 * tree-ssa-coalesce.c (coalesce_partitions): Likewise.
722 * tree-ssa-dce.c (remove_dead_phis): Likewise.
723 (forward_edge_to_pdom): Likewise.
724 * tree-ssa-dom.c (record_equivalences_from_phis): Likewise.
725 (cprop_into_successor_phis): Likewise.
726 (propagate_rhs_into_lhs): Likewise.
727 (eliminate_degenerate_phis_1): Likewise.
728 * tree-ssa-ifcombine.c (same_phi_args_p): Likewise.
729 * tree-ssa-live.c (calculate_live_on_exit): Likewise.
730 (verify_live_on_entry): Likewise.
732 (move_computations_dom_walker::before_dom_children): Likewise.
733 * tree-ssa-loop-ivopts.c (find_bivs): Likewise.
734 (mark_bivs): Likewise.
735 (find_interesting_uses_outside): Likewise.
736 (determine_set_costs): Likewise.
737 * tree-ssa-loop-manip.c (split_loop_exit_edge): Likewise.
738 (tree_transform_and_unroll_loop): Likewise.
739 (rewrite_all_phi_nodes_with_iv): Likewise.
740 (canonicalize_loop_ivs): Likewise.
741 * tree-ssa-loop-niter.c (determine_value_range): Likewise.
742 * tree-ssa-phiopt.c (hoist_adjacent_loads): Likewise.
743 * tree-ssa-phiprop.c (tree_ssa_phiprop): Likewise.
744 * tree-ssa-reassoc.c (suitable_cond_bb): Likewise.
745 * tree-ssa-tail-merge.c (same_phi_alternatives_1): Likewise.
747 * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
749 * tree-ssa-threadupdate.c (copy_phi_arg_into_existing_phi): Likewise.
750 (copy_phi_args): Likewise.
751 (phi_args_equal_on_edges): Likewise.
752 * tree-ssa.c (ssa_redirect_edge): Likewise.
753 (flush_pending_stmts): Likewise.
754 * tree-switch-conversion.c (check_final_bb): Likewise.
755 (gather_default_values): Likewise.
756 (build_constructors): Likewise.
757 (fix_phi_nodes): Likewise.
758 * tree-tailcall.c (propagate_through_phis): Likewise.
759 (add_successor_phi_arg): Likewise.
760 * tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1):
762 (slpeel_update_phi_nodes_for_guard2): Likewise.
763 (slpeel_tree_peel_loop_to_edge): Likewise.
764 (vect_can_advance_ivs_p): Likewise.
765 (vect_update_ivs_after_vectorizer): Likewise.
766 * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Likewise.
767 * tree-vrp.c (find_assert_locations): Likewise.
768 * value-prof.c (gimple_ic): Likewise.
770 * omp-low.c (expand_parallel_call): Convert local to a gimple_phi.
772 2014-10-24 David Malcolm <dmalcolm@redhat.com>
774 Introduce gimple_phi and use it in various places
776 * coretypes.h (gimple_phi): New typedef.
777 (const_gimple_phi): New typedef.
779 * gdbhooks.py (build_pretty_printer): Add gimple_phi and its
780 variants, using the gimple printer.
782 * gimple.h (gimple_vec): Eliminate thie typedef in the hope of using
783 vecs of more concrete gimple subclasses as appropriate; also the
784 comment is about to become misleading.
786 * gimple.h (gimple_phi_capacity): Use const_gimple_phi typedef
787 rather than spelling out the full type.
788 (gimple_phi_num_args): Likewise.
789 (gimple_phi_result): Likewise.
790 (gimple_phi_result_ptr): Use gimple_phi typedef.
791 (gimple_phi_set_result): Likewise.
792 (gimple_phi_arg): Likewise.
793 (gimple_phi_set_arg): Likewise.
794 * tree-phinodes.c (allocate_phi_node): Likewise.
795 (resize_phi_node): Likewise.
796 (reserve_phi_args_for_new_edge): Likewise.
797 (remove_phi_arg_num): Likewise.
799 * gimple-pretty-print.c (dump_gimple_phi): Require a gimple_phi
800 rather than just a gimple.
801 * tree-into-ssa.c (mark_phi_for_rewrite): Likewise.
803 * tree-phinodes.c (make_phi_node): Return a gimple_phi rather than
805 (create_phi_node): Likewise.
806 * tree-phinodes.h (create_phi_node): Likewise.
808 * trans-mem.c (struct struct tm_log_entry): Replace use of
809 now-removed gimple_vec with a plain vec<gimple>.
811 * tree-into-ssa.c (phis_to_rewrite): Strengthen from a
812 vec<gimple_vec> to a vec< vec<gimple_phi> >.
814 * tree-into-ssa.c (insert_phi_nodes_for): Update local to be a
816 * tree-into-ssa.c (rewrite_update_phi_arguments): Strengthen local
817 "phis" from a gimple_vec to a vec<gimple_phi>, and local "phi" to
819 * tree-into-ssa.c (delete_update_ssa): Strengthen local
820 "phis" from a gimple_vec to a vec<gimple_phi>.
822 * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
823 gimple_phi in regions where a stmt is known to have code
825 * tree-into-ssa.c (mark_use_interesting): Likewise.
827 2014-10-24 David Malcolm <dmalcolm@redhat.com>
829 Introduce gimple_debug and use it in a few places
831 * coretypes.h (gimple_debug): New typedef.
832 (const_gimple_debug): New typedef.
834 * gimple.h (struct gimple_statement_debug): New subclass of
835 gimple_statement_with_ops, adding the invariant that
836 stmt->code == GIMPLE_DEBUG.
837 (is_a_helper <gimple_statement_debug>::test): New.
839 * gdbhooks.py (build_pretty_printer): Add gimple_debug and its
840 variants, using the gimple printer.
842 * gimple-pretty-print.c (dump_gimple_debug): Require a gimple_debug
843 rather than just a gimple.
844 * tree-inline.c (copy_debug_stmt): Likewise.
846 * tree-inline.h (struct copy_body_data): Strengthen field
847 "debug_stmts" from a vec<gimple> to a vec<gimple_debug>.
849 * gimple.c (gimple_build_debug_bind_stat): Return a gimple_debug
850 rather than just a gimple.
851 (gimple_build_debug_source_bind_stat): Likewise.
852 * gimple.h (gimple_build_debug_bind_stat): Likewise.
853 (gimple_build_debug_source_bind_stat): Likewise.
855 * tree-inline.c (remap_gimple_stmt): Update locals to be a
857 (maybe_move_debug_stmts_to_successors): Likewise.
858 (copy_debug_stmts): Likewise.
860 * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
861 gimple_debug in regions where a stmt is known to have code
864 2014-10-24 David Malcolm <dmalcolm@redhat.com>
866 Introduce gimple_label and use it in a few places
868 * coretypes.h (gimple_label): New typedef.
869 (const_gimple_label): New typedef.
871 * gimple.h (struct gimple_statement_label): New subclass of
872 gimple_statement_with_ops, adding the invariant that
873 stmt->code == GIMPLE_LABEL.
874 (is_a_helper <gimple_statement_label>::test): New.
876 * gdbhooks.py (build_pretty_printer): Add gimple_label and its
877 variants, reusing the gimple printer.
879 * gimple-pretty-print.c (dump_gimple_label): Require a gimple_label
880 rather than just a gimple.
881 * tree-cfg.c (verify_gimple_label): Likewise.
883 * gimple.c (gimple_build_label): Return a gimple_label rather than
885 * gimple.h (gimple_build_label): Likewise.
887 * gimplify.c (gimplify_case_label_expr): Update local to be a
889 * tree-switch-conversion.c (gen_inbound_check): Likewise.
891 * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
892 gimple_label in regions where a stmt is known to have code
894 * tree-cfg.c (verify_gimple_stmt): Likewise.
896 2014-10-24 David Malcolm <dmalcolm@redhat.com>
898 Introduce gimple_assign and use it in various places
900 * coretypes.h (gimple_assign): New typedef.
901 (const_gimple_assign): New typedef.
903 * gimple.h (struct gimple_statement_assign): New subclass of
904 gimple_statement_with_memory_ops, adding the invariant that
905 stmt->code == GIMPLE_ASSIGN.
906 (is_a_helper <gimple_statement_assign>::test): New.
908 * gdbhooks.py (build_pretty_printer): Add gimple_assign and its
909 variants, using the gimple printer.
911 * gimple-builder.c (build_assign): Return a gimple_assign rather
912 than just a gimple from each of the overloaded variants.
913 (build_type_cast): Likewise.
914 * gimple-builder.h (build_assign): Likewise.
915 (build_type_cast): Likewise.
916 * gimple.c (gimple_build_assign_stat): Likewise.
917 (gimple_build_assign_with_ops): Likewise.
918 * gimple.h (gimple_build_assign_stat): Likewise.
919 (gimple_build_assign_with_ops): Likewise.
921 * asan.c (get_mem_ref_of_assignment): Require a const_gimple_assign
922 rather than just a "const gimple" (the latter is not a
924 * gimple-pretty-print.c (dump_unary_rhs): Require a gimple_assign
925 rather than just a gimple.
926 (dump_binary_rhs): Likewise.
927 (dump_ternary_rhs): Likewise.
928 * tree-cfg.c (verify_gimple_assign_unary): Likewise.
929 (verify_gimple_assign_binary): Likewise.
930 (verify_gimple_assign_ternary): Likewise.
931 (verify_gimple_assign_single): Likewise.
932 (verify_gimple_assign): Likewise.
933 * tree-ssa-sccvn.c (simplify_unary_expression): Likewise.
934 (try_to_simplify): Likewise.
935 * tree-tailcall.c (process_assignment): Likewise.
936 * tree-vect-generic.c (expand_vector_operation): Likewise.
937 * tree-vrp.c (extract_range_from_cond_expr): Likewise.
938 (extract_range_from_assignment): Likewise.
940 * asan.c (has_stmt_been_instrumented_p): Add checked cast to
941 gimple_assign in regions where a stmt is known to have code
943 * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
944 * tree-cfg.c (verify_gimple_stmt): Likewise.
945 * tree-ssa-sccvn.c (visit_use): Likewise.
946 * tree-tailcall.c (find_tail_calls): Likewise.
947 * tree-vrp.c (vrp_visit_assignment_or_call): Likewise.
949 * tree-vrp.c (simplify_stmt_for_jump_threading): Replace a check
950 against GIMPLE_ASSIGN with a dyn_cast<gimple_assign>, introducing
951 a gimple_assign local.
953 * tree-vect-generic.c (expand_vector_condition): Convert local to a
954 gimple_assign, adding a checked cast when extracting from gsi, since
955 this is only called when underlying stmt has code GIMPLE_ASSIGN.
956 (optimize_vector_constructor): Likewise.
957 (lower_vec_perm): Likewise.
958 (expand_vector_operations_1): Convert local to a gimple_assign,
959 introducing a dyn_cast.
961 2014-10-24 David Malcolm <dmalcolm@redhat.com>
963 Introduce gimple_cond and use it in various places
965 * coretypes.h (gimple_cond): New typedef.
966 (const_gimple_cond): Likewise.
968 * gimple.h (struct gimple_statement_cond): New subclass of
969 gimple_statement_with_ops, adding the invariant that
970 stmt->code == GIMPLE_COND.
971 (is_a_helper <gimple_statement_cond>::test): New.
972 (gimple_build_cond): Return a gimple_cond, rather than just
974 (gimple_build_cond_from_tree): Likewise.
976 * gdbhooks.py (build_pretty_printer): Add gimple_cond and its
977 variants, using the gimple printer.
979 * cfgexpand.c (expand_gimple_cond): Require a gimple_cond rather
981 * gimple.h (gimple_cond_set_condition_from_tree): Likewise.
982 (gimple_cond_true_p): Likewise.
983 (gimple_cond_false_p): Likewise.
984 (gimple_cond_set_condition): Likewise.
985 * gimple.c (gimple_cond_set_condition_from_tree): Likewise.
986 * gimple-fold.c (fold_gimple_cond): Likewise.
987 * gimple-pretty-print.c (dump_gimple_cond): Likewise.
988 * tree-ssa-dom.c (canonicalize_comparison): Likewise.
989 * tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise.
990 * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise.
991 (recognize_bits_test): Likewise.
992 * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
993 (thread_around_empty_blocks): Likewise.
994 (thread_through_normal_block): Likewise.
995 (thread_across_edge): Likewise.
996 * tree-ssa-threadedge.h (thread_across_edge): Likewise.
997 * tree-vrp.c (range_fits_type_p): Likewise.
999 * cfgexpand.c (expand_gimple_basic_block): Add checked cast to
1000 gimple_cond in regions where a stmt is known to have code GIMPLE_COND.
1001 * gimple-fold.c (fold_stmt_1): Likewise.
1002 * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
1003 * tree-ssa-dom.c (optimize_stmt): Likewise.
1004 * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
1005 * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.
1006 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
1008 * tree-vrp.c (simplify_stmt_using_ranges): Likewise.
1010 * cfgloopmanip.c (create_empty_loop_on_edge): Update local to be a
1012 * tree-vrp.c (identify_jump_threads): Likewise.
1014 * gimple.c (gimple_build_cond): Return a gimple_cond, rather than
1016 (gimple_build_cond_from_tree): Likewise.
1018 * tree-ssa-dom.c (class dom_opt_dom_walker): Strengthen type of
1019 field "m_dummy_cond" from a plain gimple to a gimple_cond.
1021 * tree-ssa-ifcombine.c (ifcombine_ifandif): Introduce locals
1022 inner_stmt and outer_stmt so that inner_cond and outer_cond can be
1023 of type gimple_cond once we know that we have code == GIMPLE_COND.
1024 * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Introduce local
1025 "last" so that stmt can be of type gimple_cond.
1027 2014-10-24 David Malcolm <dmalcolm@redhat.com>
1029 Introduce gimple_bind and use it for accessors.
1031 * coretypes.h (gimple_bind): New typedef.
1032 (const_gimple_bind): New typedef.
1034 * gdbhooks.py (build_pretty_printer): Add gimple_bind
1035 and its variants, using the gimple printer.
1037 * gimple-pretty-print.c (dump_gimple_bind): Update type-signature to
1038 require a gimple_bind rather than just a gimple.
1040 * gimple.c (gimple_build_bind): Return a gimple_bind rather than
1042 * gimple.h (gimple_build_bind): Likewise.
1044 * gimple.h (gimple_seq_first_stmt_as_a_bind): New.
1046 * gimple.h (gimple_bind_vars): Update type-signature to
1047 require a gimple_bind rather than just a gimple, removing
1048 as_a and hence run-time check.
1049 (gimple_bind_set_vars): Likewise.
1050 (gimple_bind_append_vars): Likewise.
1051 (gimple_bind_body_ptr): Likewise.
1052 (gimple_bind_body): Likewise.
1053 (gimple_bind_set_body): Likewise.
1054 (gimple_bind_add_stmt): Likewise.
1055 (gimple_bind_add_seq): Likewise.
1056 (gimple_bind_block): Likewise.
1057 (gimple_bind_set_block): Likewise.
1058 * gimplify.c (gimple_push_bind_expr): Likewise.
1059 (gimple_current_bind_expr): Likewise.
1060 * tree-inline.c (copy_gimple_bind): Likewise.
1062 * gimplify.h (gimple_current_bind_expr): Return a gimple_bind
1063 rather than a plain gimple.
1064 (gimplify_body): Likewise.
1065 (gimple_bind_expr_stack): Return a vec<gimple_bind> rather than
1068 * gimplify.c (struct gimplify_ctx): Strengthen field
1069 "bind_expr_stack" from vec<gimple> to vec<gimple_bind>.
1070 (gimple_bind_expr_stack): Likewise for type of returned value.
1072 * gimplify.c (gimplify_body): Strengthen various types from gimple
1073 to gimple_bind, including the return type.
1075 * gimplify.c (declare_vars): Introduce "gs" as a generic gimple,
1076 so that local "scope" can be of type gimple_bind once we've reached
1077 the region where it must be of code GIMPLE_BIND.
1079 * gimple-low.c (lower_gimple_bind): Add checked cast to
1080 gimple_bind, since both callers (lower_function_body and
1081 lower_stmt) have checked the code for us.
1083 * gimple.c (gimple_copy): Add checked cast to gimple_bind in
1084 region guarded by check for code GIMPLE_BIND.
1085 * gimple-low.c (gimple_stmt_may_fallthru): Likewise.
1086 * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
1087 * gimple-walk.c (walk_gimple_stmt): Likewise.
1088 * omp-low.c (scan_omp_1_stmt): Likewise.
1089 (lower_omp_1): Likewise.
1090 (lower_omp_for): Likewise.
1091 * tree-cfg.c (verify_gimple_in_seq_2): Likewise.
1092 (do_warn_unused_result): Likewise.
1093 * tree-inline.c (remap_gimple_stmt): Likewise.
1094 (estimate_num_insns): Likewise.
1095 * tree-nested.c (convert_nonlocal_reference_stmt): Likewise.
1097 * gimplify.c (gimplify_bind_expr): Update local(s) to be a
1098 gimple_bind rather than just a gimple.
1099 (gimplify_function_tree): Likewise.
1100 * omp-low.c (lower_omp_sections): Likewise.
1101 (lower_omp_single): Likewise.
1102 (lower_omp_master): Likewise.
1103 (lower_omp_taskgroup): Likewise.
1104 (lower_omp_ordered): Likewise.
1105 (lower_omp_critical): Likewise.
1106 (lower_omp_taskreg): Likewise.
1107 (lower_omp_teams): Likewise.
1108 * omp-low.c (lower_omp_for): Likewise; use
1109 gimple_seq_first_stmt_as_a_bind to encapsulate the checked cast.
1110 (lower_omp_target): Likewise.
1111 * tree-nested.c (finalize_nesting_tree_1): Likewise.
1113 * gimple.c (empty_stmt_p): Add dyn_cast to a gimple_bind.
1114 * tree-inline.c (replace_locals_stmt): Add dyn_cast to gimple_bind.
1116 2014-10-24 David Malcolm <dmalcolm@redhat.com>
1118 Introduce gimple_switch and use it in various places
1120 * gimple.h (gimple_statement_switch): New subclass of
1121 gimple_statement_with_ops, adding the invariant that
1122 stmt->code == GIMPLE_SWITCH.
1123 (is_a_helper <gimple_statement_switch>::test (gimple)): New.
1125 * coretypes.h (gimple_switch): New typedef
1126 (const_gimple_switch): Likewise.
1128 * gdbhooks.py (build_pretty_printer): Add gimple_switch
1129 and its variants, using the gimple printer.
1131 * gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
1132 rather than just a gimple.
1133 (gimple_build_switch): Likewise.
1134 * gimple.h (gimple_build_switch_nlabels): Likewise.
1135 (gimple_build_switch): Likewise.
1137 * gimple.h (gimple_switch_num_labels): Update type-signature to
1138 require a gimple_switch rather than just a gimple.
1139 (gimple_switch_set_num_labels): Likewise.
1140 (gimple_switch_set_index): Likewise.
1141 (gimple_switch_label): Likewise.
1142 (gimple_switch_set_label): Likewise.
1143 (gimple_switch_default_label): Likewise.
1144 (gimple_switch_set_default_label): Likewise.
1145 * expr.h (expand_case): Likewise.
1146 * gimple-pretty-print.c (dump_gimple_call): Likewise.
1147 * stmt.c (compute_cases_per_edge): Likewise.
1148 (expand_case): Likewise.
1149 * tree-cfg.h (group_case_labels_stmt): Likewise.
1150 * tree-cfg.c (make_gimple_switch_edges): Likewise.
1151 (find_taken_edge_switch_expr) Likewise.
1152 (find_case_label_for_value) Likewise.
1153 (get_cases_for_edge): Likewise.
1154 (group_case_labels_stmt): Likewise.
1155 (verify_gimple_switch): Likewise.
1156 * tree-eh.c (verify_norecord_switch_expr): Likewise.
1157 * tree-eh.c (lower_eh_constructs_2): Likewise.
1158 * tree-loop-distribution.c (generate_loops_for_partition): Likewise.
1159 * tree-ssa-dom.c (record_edge_info): Likewise.
1160 * tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
1161 (simplify_gimple_switch): Likewise.
1162 * tree-switch-conversion.c (emit_case_bit_tests): Likewise.
1163 (collect_switch_conv_info): Likewise.
1164 (build_constructors): Likewise.
1165 (array_value_type): Likewise.
1166 (build_one_array): Likewise.
1167 (build_arrays): Likewise.
1168 (gen_inbound_check): Likewise.
1169 * tree-vrp.c (find_switch_asserts): Likewise.
1170 (find_case_label_range): Likewise.
1171 (find_case_label_ranges): Likewise.
1172 (vrp_visit_switch_stmt): Likewise.
1173 (simplify_switch_using_ranges): Likewise.
1175 * tree-vrp.c (switch_update): Strengthen field "stmt" from being
1176 merely a gimple to being a gimple_switch.
1178 * cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
1179 gimple_switch in regions where the stmt code has been tested as
1181 * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
1182 * tree-cfg.c (make_edges): Likewise.
1183 (end_recording_case_labels): Likewise.
1184 (cleanup_dead_labels): Likewise.
1185 (cleanup_dead_labels): Likewise.
1186 (group_case_labels): Likewise.
1187 (find_taken_edge): Likewise.
1188 (find_case_label_for_value): Likewise.
1189 (verify_gimple_stmt): Likewise.
1190 (gimple_verify_flow_info): Likewise.
1191 (gimple_redirect_edge_and_branch): Likewise.
1192 * tree-inline.c (estimate_num_insns): Likewise.
1193 * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
1194 * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
1195 * tree-switch-conversion.c (do_switchconv): Likewise.
1196 * tree-vrp.c (find_assert_locations_1): Likewise.
1197 (vrp_visit_stmt): Likewise.
1198 (simplify_stmt_using_ranges): Likewise.
1200 * ipa-inline-analysis.c (set_switch_stmt_execution_predicate):
1201 Introduce local "lastg" as a generic gimple, so that local "last"
1202 can be of type gimple_switch once lastg's code has been verified.
1204 * omp-low.c (diagnose_sb_2): Introduce switch_stmt local to handle
1205 the GIMPLE_SWITCH case.
1207 * tree-cfg.c (find_taken_edge_switch_expr): Add gimple_switch
1208 argument, since the caller (find_taken_edge) has checked that
1209 last_stmt is a switch.
1211 Copyright (C) 2014 Free Software Foundation, Inc.
1213 Copying and distribution of this file, with or without modification,
1214 are permitted in any medium without royalty provided the copyright
1215 notice and this notice are preserved.