diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2023-07-11 18:33:52 +0200 |
---|---|---|
committer | Uros Bizjak <ubizjak@gmail.com> | 2023-07-11 18:34:39 +0200 |
commit | 47bd559829726f44b9c545cd96db49e57f1fd3c4 (patch) | |
tree | 339f671532b51086618aa6ac27b826e0c2d858fd /gcc/tree-cfg.cc | |
parent | 85bd9a549c044ea618b28cc13350d0e769bb3579 (diff) | |
download | gcc-47bd559829726f44b9c545cd96db49e57f1fd3c4.zip gcc-47bd559829726f44b9c545cd96db49e57f1fd3c4.tar.gz gcc-47bd559829726f44b9c545cd96db49e57f1fd3c4.tar.bz2 |
cfg+gcse: Change return type of predicate functions from int to bool
Also change some internal variables from int to bool.
gcc/ChangeLog:
* cfghooks.cc (verify_flow_info): Change "err" variable to bool.
* cfghooks.h (struct cfg_hooks): Change return type of
verify_flow_info from integer to bool.
* cfgrtl.cc (can_delete_note_p): Change return type from int to bool.
(can_delete_label_p): Ditto.
(rtl_verify_flow_info): Change return type from int to bool
and adjust function body accordingly. Change "err" variable to bool.
(rtl_verify_flow_info_1): Ditto.
(free_bb_for_insn): Change return type to void.
(rtl_merge_blocks): Change "b_empty" variable to bool.
(try_redirect_by_replacing_jump): Change "fallthru" variable to bool.
(verify_hot_cold_block_grouping): Change return type from int to bool.
Change "err" variable to bool.
(rtl_verify_edges): Ditto.
(rtl_verify_bb_insns): Ditto.
(rtl_verify_bb_pointers): Ditto.
(rtl_verify_bb_insn_chain): Ditto.
(rtl_verify_fallthru): Ditto.
(rtl_verify_bb_layout): Ditto.
(purge_all_dead_edges): Change "purged" variable to bool.
* cfgrtl.h (free_bb_for_insn): Change return type from int to void.
* postreload-gcse.cc (expr_hasher::equal): Change "equiv_p" to bool.
(load_killed_in_block_p): Change return type from int to bool
and adjust function body accordingly.
(oprs_unchanged_p): Return true/false.
(rest_of_handle_gcse2): Change return type to void.
* tree-cfg.cc (gimple_verify_flow_info): Change return type from
int to bool. Change "err" variable to bool.
Diffstat (limited to 'gcc/tree-cfg.cc')
-rw-r--r-- | gcc/tree-cfg.cc | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 4989906..938d063 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -165,7 +165,7 @@ static edge gimple_try_redirect_by_replacing_jump (edge, basic_block); /* Various helpers. */ static inline bool stmt_starts_bb_p (gimple *, gimple *); -static int gimple_verify_flow_info (void); +static bool gimple_verify_flow_info (void); static void gimple_make_forwarder_block (edge); static gimple *first_non_label_stmt (basic_block); static bool verify_gimple_transaction (gtransaction *); @@ -5654,10 +5654,10 @@ verify_gimple_in_cfg (struct function *fn, bool verify_nothrow, bool ice) /* Verifies that the flow information is OK. */ -static int +static bool gimple_verify_flow_info (void) { - int err = 0; + bool err = false; basic_block bb; gimple_stmt_iterator gsi; gimple *stmt; @@ -5668,21 +5668,21 @@ gimple_verify_flow_info (void) || ENTRY_BLOCK_PTR_FOR_FN (cfun)->il.gimple.phi_nodes) { error ("ENTRY_BLOCK has IL associated with it"); - err = 1; + err = true; } if (EXIT_BLOCK_PTR_FOR_FN (cfun)->il.gimple.seq || EXIT_BLOCK_PTR_FOR_FN (cfun)->il.gimple.phi_nodes) { error ("EXIT_BLOCK has IL associated with it"); - err = 1; + err = true; } FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) if (e->flags & EDGE_FALLTHRU) { error ("fallthru to exit from bb %d", e->src->index); - err = 1; + err = true; } FOR_EACH_BB_FN (bb, cfun) @@ -5707,28 +5707,28 @@ gimple_verify_flow_info (void) { error ("nonlocal label %qD is not first in a sequence " "of labels in bb %d", label, bb->index); - err = 1; + err = true; } if (prev_stmt && EH_LANDING_PAD_NR (label) != 0) { error ("EH landing pad label %qD is not first in a sequence " "of labels in bb %d", label, bb->index); - err = 1; + err = true; } if (label_to_block (cfun, label) != bb) { error ("label %qD to block does not match in bb %d", label, bb->index); - err = 1; + err = true; } if (decl_function_context (label) != current_function_decl) { error ("label %qD has incorrect context in bb %d", label, bb->index); - err = 1; + err = true; } } @@ -5742,7 +5742,7 @@ gimple_verify_flow_info (void) { error ("control flow in the middle of basic block %d", bb->index); - err = 1; + err = true; } if (stmt_ends_bb_p (stmt)) @@ -5752,7 +5752,7 @@ gimple_verify_flow_info (void) { error ("label %qD in the middle of basic block %d", gimple_label_label (label_stmt), bb->index); - err = 1; + err = true; } /* Check that no statements appear between a returns_twice call @@ -5781,7 +5781,7 @@ gimple_verify_flow_info (void) error ("returns_twice call is %s in basic block %d", misplaced, bb->index); print_gimple_stmt (stderr, stmt, 0, TDF_SLIM); - err = 1; + err = true; } } if (!is_gimple_debug (stmt)) @@ -5797,7 +5797,8 @@ gimple_verify_flow_info (void) if (gimple_code (stmt) == GIMPLE_LABEL) continue; - err |= verify_eh_edges (stmt); + if (verify_eh_edges (stmt)) + err = true; if (is_ctrl_stmt (stmt)) { @@ -5806,7 +5807,7 @@ gimple_verify_flow_info (void) { error ("fallthru edge after a control statement in bb %d", bb->index); - err = 1; + err = true; } } @@ -5819,7 +5820,7 @@ gimple_verify_flow_info (void) { error ("true/false edge after a non-GIMPLE_COND in bb %d", bb->index); - err = 1; + err = true; } } @@ -5842,7 +5843,7 @@ gimple_verify_flow_info (void) { error ("wrong outgoing edge flags at end of bb %d", bb->index); - err = 1; + err = true; } } break; @@ -5851,7 +5852,7 @@ gimple_verify_flow_info (void) if (simple_goto_p (stmt)) { error ("explicit goto at end of bb %d", bb->index); - err = 1; + err = true; } else { @@ -5864,7 +5865,7 @@ gimple_verify_flow_info (void) { error ("wrong outgoing edge flags at end of bb %d", bb->index); - err = 1; + err = true; } } break; @@ -5880,13 +5881,13 @@ gimple_verify_flow_info (void) | EDGE_TRUE_VALUE | EDGE_FALSE_VALUE))) { error ("wrong outgoing edge flags at end of bb %d", bb->index); - err = 1; + err = true; } if (single_succ (bb) != EXIT_BLOCK_PTR_FOR_FN (cfun)) { error ("return edge does not point to exit in bb %d", bb->index); - err = 1; + err = true; } break; @@ -5916,7 +5917,7 @@ gimple_verify_flow_info (void) { error ("found default case not at the start of " "case vector"); - err = 1; + err = true; continue; } if (CASE_LOW (prev) @@ -5927,7 +5928,7 @@ gimple_verify_flow_info (void) fprintf (stderr," is greater than "); print_generic_expr (stderr, c); fprintf (stderr," but comes before it.\n"); - err = 1; + err = true; } prev = c; } @@ -5941,7 +5942,7 @@ gimple_verify_flow_info (void) { error ("extra outgoing edge %d->%d", bb->index, e->dest->index); - err = 1; + err = true; } e->dest->aux = (void *)2; @@ -5950,7 +5951,7 @@ gimple_verify_flow_info (void) { error ("wrong outgoing edge flags at end of bb %d", bb->index); - err = 1; + err = true; } } @@ -5963,7 +5964,7 @@ gimple_verify_flow_info (void) if (label_bb->aux != (void *)2) { error ("missing edge %i->%i", bb->index, label_bb->index); - err = 1; + err = true; } } @@ -5973,7 +5974,8 @@ gimple_verify_flow_info (void) break; case GIMPLE_EH_DISPATCH: - err |= verify_eh_dispatch_edge (as_a <geh_dispatch *> (stmt)); + if (verify_eh_dispatch_edge (as_a <geh_dispatch *> (stmt))) + err = true; break; default: |