diff options
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r-- | gcc/cfgrtl.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 7295ead57d6..d4136d246b0 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -313,7 +313,7 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after) link_block (bb, after); BASIC_BLOCK (bb->index) = bb; update_bb_for_insn (bb); - bb->partition = UNPARTITIONED; + BB_SET_PARTITION (bb, BB_UNPARTITIONED); /* Tag the block so that we know it has been used when considering other basic block notes. */ @@ -489,7 +489,7 @@ rtl_split_block (basic_block bb, void *insnp) /* Create the new basic block. */ new_bb = create_basic_block (NEXT_INSN (insn), BB_END (bb), bb); - new_bb->partition = bb->partition; + BB_COPY_PARTITION (new_bb, bb); BB_END (bb) = insn; /* Redirect the outgoing edges. */ @@ -619,24 +619,26 @@ rtl_merge_blocks (basic_block a, basic_block b) static bool rtl_can_merge_blocks (basic_block a,basic_block b) { - bool partitions_ok = true; - /* If we are partitioning hot/cold basic blocks, we don't want to mess up unconditional or indirect jumps that cross between hot - and cold sections. */ - + and cold sections. + + ??? If two basic blocks could otherwise be merged (which implies + that the jump between the two is unconditional), and one is in a + hot section and the other is in a cold section, surely that means + that one of the section choices is wrong. */ + if (flag_reorder_blocks_and_partition && (find_reg_note (BB_END (a), REG_CROSSING_JUMP, NULL_RTX) || find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX) - || a->partition != b->partition)) - partitions_ok = false; + || BB_PARTITION (a) != BB_PARTITION (b))) + return false; /* There must be exactly one edge in between the blocks. */ return (a->succ && !a->succ->succ_next && a->succ->dest == b && !b->pred->pred_next && a != b /* Must be simple edge. */ && !(a->succ->flags & EDGE_COMPLEX) - && partitions_ok && a->next_bb == b && a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR /* If the jump insn has side effects, @@ -684,7 +686,7 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout) if (flag_reorder_blocks_and_partition && (find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX) - || (src->partition != target->partition))) + || BB_PARTITION (src) != BB_PARTITION (target))) return NULL; /* Verify that all targets will be TARGET. */ @@ -1094,11 +1096,11 @@ force_nonfallthru_and_redirect (edge e, basic_block target) /* Make sure new block ends up in correct hot/cold section. */ - jump_block->partition = e->src->partition; + BB_COPY_PARTITION (jump_block, e->src); if (flag_reorder_blocks_and_partition && targetm.have_named_sections) { - if (e->src->partition == COLD_PARTITION) + if (BB_PARTITION (jump_block) == BB_COLD_PARTITION) { rtx bb_note, new_note; for (bb_note = BB_HEAD (jump_block); @@ -1110,7 +1112,6 @@ force_nonfallthru_and_redirect (edge e, basic_block target) new_note = emit_note_after (NOTE_INSN_UNLIKELY_EXECUTED_CODE, bb_note); NOTE_BASIC_BLOCK (new_note) = jump_block; - jump_block->partition = COLD_PARTITION; } if (JUMP_P (BB_END (jump_block)) && !any_condjump_p (BB_END (jump_block)) @@ -1354,12 +1355,13 @@ rtl_split_edge (edge edge_in) && NOTE_LINE_NUMBER (before) == NOTE_INSN_LOOP_END) before = NEXT_INSN (before); bb = create_basic_block (before, NULL, edge_in->src); - bb->partition = edge_in->src->partition; + BB_COPY_PARTITION (bb, edge_in->src); } else { bb = create_basic_block (before, NULL, edge_in->dest->prev_bb); - bb->partition = edge_in->dest->partition; + /* ??? Why not edge_in->dest->prev_bb here? */ + BB_COPY_PARTITION (bb, edge_in->dest); } /* ??? This info is likely going to be out of date very soon. */ @@ -1601,7 +1603,7 @@ commit_one_edge_insertion (edge e, int watch_calls) if (flag_reorder_blocks_and_partition && targetm.have_named_sections && e->src != ENTRY_BLOCK_PTR - && e->src->partition == COLD_PARTITION + && BB_PARTITION (e->src) == BB_COLD_PARTITION && !(e->flags & EDGE_CROSSING)) { rtx bb_note, new_note, cur_insn; @@ -1987,7 +1989,7 @@ rtl_verify_flow_info_1 (void) { n_fallthru++, fallthru = e; if ((e->flags & EDGE_CROSSING) - || (e->src->partition != e->dest->partition + || (BB_PARTITION (e->src) != BB_PARTITION (e->dest) && e->src != ENTRY_BLOCK_PTR && e->dest != EXIT_BLOCK_PTR)) { @@ -2667,24 +2669,26 @@ cfg_layout_delete_block (basic_block bb) static bool cfg_layout_can_merge_blocks_p (basic_block a, basic_block b) { - bool partitions_ok = true; - /* If we are partitioning hot/cold basic blocks, we don't want to mess up unconditional or indirect jumps that cross between hot - and cold sections. */ + and cold sections. + + ??? If two basic blocks could otherwise be merged (which implies + that the jump between the two is unconditional), and one is in a + hot section and the other is in a cold section, surely that means + that one of the section choices is wrong. */ if (flag_reorder_blocks_and_partition && (find_reg_note (BB_END (a), REG_CROSSING_JUMP, NULL_RTX) || find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX) - || a->partition != b->partition)) - partitions_ok = false; + || BB_PARTITION (a) != BB_PARTITION (b))) + return false; /* There must be exactly one edge in between the blocks. */ return (a->succ && !a->succ->succ_next && a->succ->dest == b && !b->pred->pred_next && a != b /* Must be simple edge. */ && !(a->succ->flags & EDGE_COMPLEX) - && partitions_ok && a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR /* If the jump insn has side effects, we can't kill the edge. */ |