summaryrefslogtreecommitdiff
path: root/gcc/bb-reorder.c
diff options
context:
space:
mode:
authorctice <ctice@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-12 20:39:09 +0000
committerctice <ctice@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-12 20:39:09 +0000
commite6bdfb7433723ffcd81b83ded00ee81a3ac34d2a (patch)
tree2a43fb81a341285d6b565e80e3d30dcf600bd613 /gcc/bb-reorder.c
parent2fc56f5394a1a30adddfddc13285d8a8d8b722cc (diff)
downloadgcc-e6bdfb7433723ffcd81b83ded00ee81a3ac34d2a.tar.gz
Revert patch from April 9.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98039 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/bb-reorder.c')
-rw-r--r--gcc/bb-reorder.c87
1 files changed, 50 insertions, 37 deletions
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 4936ca40910..6925114e133 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1241,24 +1241,27 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
/* Mark every edge that crosses between sections. */
i = 0;
- FOR_EACH_BB (bb)
- FOR_EACH_EDGE (e, ei, bb->succs)
+ if (targetm.have_named_sections)
{
- 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;
+ 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;
+ }
}
*n_crossing_edges = i;
}
@@ -1822,26 +1825,36 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
fix_up_fall_thru_edges ();
- /* 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 ();
+ /* 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 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_COND_BRANCH)
+ fix_crossing_conditional_branches ();
- if (!HAS_LONG_UNCOND_BRANCH)
- {
- fix_crossing_unconditional_branches ();
- reg_scan (get_insns(), max_reg_num ());
+ /* 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 ();
}
-
- add_reg_crossing_jump_notes ();
}
/* Verify, in the basic block chain, that there is at most one switch
@@ -1933,8 +1946,7 @@ reorder_basic_blocks (unsigned int flags)
dump_flow_info (dump_file);
cfg_layout_finalize ();
- if (flag_reorder_blocks_and_partition)
- verify_hot_cold_block_grouping ();
+ verify_hot_cold_block_grouping ();
timevar_pop (TV_REORDER_BLOCKS);
}
@@ -1954,7 +1966,8 @@ insert_section_boundary_note (void)
rtx new_note;
int first_partition = 0;
- if (flag_reorder_blocks_and_partition)
+ if (flag_reorder_blocks_and_partition
+ && targetm.have_named_sections)
FOR_EACH_BB (bb)
{
if (!first_partition)