summaryrefslogtreecommitdiff
path: root/gcc/bb-reorder.c
diff options
context:
space:
mode:
authorctice <ctice@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-27 21:35:20 +0000
committerctice <ctice@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-27 21:35:20 +0000
commit4d0e931faa7ab6bb3ebe39347667b74ffd1c460d (patch)
tree25224a7ffa0ad51eb003a772afe847c2781c56d4 /gcc/bb-reorder.c
parent184b7bf54c26c7366ba668d7788610fb5111846e (diff)
downloadgcc-4d0e931faa7ab6bb3ebe39347667b74ffd1c460d.tar.gz
Correct fixes for various hot/cold partitioning concerns.
2005-04-27 Caroline Tice <ctice@apple.com> * bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges): Remove targetm.have_named_sections test. (fix_edges_for_rarely_executed_code): Likewise. (insert_section_boundary_note): Likewise. (reorder_basic_blocks): Check partitioning flag before calling verify_hot_cold_block_grouping. * dbxout.c (dbxout_function_end): Get hot/cold section labels from the function struct rather than global variables. * dwarf2out.c (COLD_TEXT_SECTION_LABEL): New macro. (COLD_END_LABEL): Likewise (cold_text_section_label): New static global variable. (cold_end_label): Likewise. (dwarf2out_switch_text_section): Get hot/cold section labels from the function struct rather than global variables; test to make sure cfun is defined. (output_aranges): Use cold_text_section_label and cold_end_label; check partitioning flag before putting out delta. (output_ranges): Remove incorrect code attempting to use hot/cold labels. (output_line_info): Get cold section label from function struct; test to make sure cfun is defined. (add_location_or_const_value_attribute): Likewise. (dwarf2out_var_location): Likewise. (dwarf2out_init): Generate cold_text_section_label and cold_end_label; write out cold_text_section_label if partition flag is set. (dwarf2out_finish): Write out cold_end_label if partition flag is set; * function.h (struct function): Add new fields to point to hot/cold section labels: hot_section_label, cold_section_label, hot_section_end_label and cold_section_end_label; also add new field for cold text section name, unlikely_text_section_name. * opts.c (decode_options): Turn off partitioning flag if !targetm.have_named_sections. * output.h (hot_section_label): Remove. (hot_section_end_label): Remove. (cold_section_end_label): Remove. (unlikely_section_label): Remove. (unlikely_text_section_name): Remove. * passes.c (rest_of_handle_final): Remove extra blank line. * varasm.c (unlikely_section_label): Remove. (hot_section_label): Remove. (hot_section_end_label): Remove. (cold_section_end_label): Remove. (unlikely_text_section_name): Remove. (initialize_cold_section_name): Modify to call targetm.strip_name_encoding; to store cold section name in current function struct, if it exists; and to only use the decl_section_name if flag_named_sections is true. (unlikely_text_section): Modify to get section name out of current function struct, if there is one; otherwise build it from UNLIKELY_EXECUTED_TEXT_SECTION_NAME. (in_unlikely_text_section): Likewise. (named_section): Modify to get/put cold section name in current function struct, if there is one. (function_section): Change 'bool unlikely' to 'int reloc'; check targetm.have_named_sections before calling named_section. (current_function_section): Likewise. (assemble_start_function): Modify to get/put unlikely_text_section_name in current function struct; modify to get hot/cold section labels from function struct; initialize labels using ASM_GENERATE_INTERNAL_LABEL; test partitioning flag before writing out hot section label. (assemble_end_function): Test partitioning flag before writing out hot/cold section labels. (default_section_type_flags_1): Get cold text section name from function struct if there is one; Set flags correctly for cold text section if there is not a current function struct. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98885 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/bb-reorder.c')
-rw-r--r--gcc/bb-reorder.c87
1 files changed, 37 insertions, 50 deletions
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index cc0844e92d5..cbb49323e31 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1237,27 +1237,24 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
/* Mark every edge that crosses between sections. */
i = 0;
- if (targetm.have_named_sections)
+ FOR_EACH_BB (bb)
+ FOR_EACH_EDGE (e, ei, bb->succs)
{
- FOR_EACH_BB (bb)
- FOR_EACH_EDGE (e, ei, bb->succs)
- {
- if (e->src != ENTRY_BLOCK_PTR
- && e->dest != EXIT_BLOCK_PTR
- && BB_PARTITION (e->src) != BB_PARTITION (e->dest))
- {
- e->flags |= EDGE_CROSSING;
- if (i == *max_idx)
- {
- *max_idx *= 2;
- crossing_edges = xrealloc (crossing_edges,
- (*max_idx) * sizeof (edge));
- }
- crossing_edges[i++] = e;
- }
- else
- e->flags &= ~EDGE_CROSSING;
- }
+ if (e->src != ENTRY_BLOCK_PTR
+ && e->dest != EXIT_BLOCK_PTR
+ && BB_PARTITION (e->src) != BB_PARTITION (e->dest))
+ {
+ e->flags |= EDGE_CROSSING;
+ if (i == *max_idx)
+ {
+ *max_idx *= 2;
+ crossing_edges = xrealloc (crossing_edges,
+ (*max_idx) * sizeof (edge));
+ }
+ crossing_edges[i++] = e;
+ }
+ else
+ e->flags &= ~EDGE_CROSSING;
}
*n_crossing_edges = i;
}
@@ -1821,36 +1818,26 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
fix_up_fall_thru_edges ();
- /* Only do the parts necessary for writing separate sections if
- the target architecture has the ability to write separate sections
- (i.e. it has named sections). Otherwise, the hot/cold partitioning
- information will be used when reordering blocks to try to put all
- the hot blocks together, then all the cold blocks, but no actual
- section partitioning will be done. */
-
- if (targetm.have_named_sections)
- {
- /* If the architecture does not have conditional branches that can
- span all of memory, convert crossing conditional branches into
- crossing unconditional branches. */
+ /* If the architecture does not have conditional branches that can
+ span all of memory, convert crossing conditional branches into
+ crossing unconditional branches. */
- if (!HAS_LONG_COND_BRANCH)
- fix_crossing_conditional_branches ();
+ if (!HAS_LONG_COND_BRANCH)
+ fix_crossing_conditional_branches ();
- /* If the architecture does not have unconditional branches that
- can span all of memory, convert crossing unconditional branches
- into indirect jumps. Since adding an indirect jump also adds
- a new register usage, update the register usage information as
- well. */
-
- if (!HAS_LONG_UNCOND_BRANCH)
- {
- fix_crossing_unconditional_branches ();
- reg_scan (get_insns(), max_reg_num ());
- }
-
- add_reg_crossing_jump_notes ();
+ /* If the architecture does not have unconditional branches that
+ can span all of memory, convert crossing unconditional branches
+ into indirect jumps. Since adding an indirect jump also adds
+ a new register usage, update the register usage information as
+ well. */
+
+ if (!HAS_LONG_UNCOND_BRANCH)
+ {
+ fix_crossing_unconditional_branches ();
+ reg_scan (get_insns(), max_reg_num ());
}
+
+ add_reg_crossing_jump_notes ();
}
/* Verify, in the basic block chain, that there is at most one switch
@@ -1942,7 +1929,8 @@ reorder_basic_blocks (unsigned int flags)
dump_flow_info (dump_file);
cfg_layout_finalize ();
- verify_hot_cold_block_grouping ();
+ if (flag_reorder_blocks_and_partition)
+ verify_hot_cold_block_grouping ();
timevar_pop (TV_REORDER_BLOCKS);
}
@@ -1962,8 +1950,7 @@ insert_section_boundary_note (void)
rtx new_note;
int first_partition = 0;
- if (flag_reorder_blocks_and_partition
- && targetm.have_named_sections)
+ if (flag_reorder_blocks_and_partition)
FOR_EACH_BB (bb)
{
if (!first_partition)