OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR debug/45997
[pf3gnuchains/gcc-fork.git]
/
gcc
/
sched-rgn.c
diff --git
a/gcc/sched-rgn.c
b/gcc/sched-rgn.c
index
ff559ad
..
6ed4675
100644
(file)
--- a/
gcc/sched-rgn.c
+++ b/
gcc/sched-rgn.c
@@
-1,6
+1,6
@@
/* Instruction scheduling pass.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
/* Instruction scheduling pass.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
, 2010
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com)
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com)
@@
-49,7
+49,7
@@
along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "
toplev
.h"
+#include "
diagnostic-core
.h"
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
@@
-59,7
+59,6
@@
along with GCC; see the file COPYING3. If not see
#include "insn-config.h"
#include "insn-attr.h"
#include "except.h"
#include "insn-config.h"
#include "insn-attr.h"
#include "except.h"
-#include "toplev.h"
#include "recog.h"
#include "cfglayout.h"
#include "params.h"
#include "recog.h"
#include "cfglayout.h"
#include "params.h"
@@
-237,7
+236,7
@@
static void compute_block_dependences (int);
static void schedule_region (int);
static rtx concat_INSN_LIST (rtx, rtx);
static void concat_insn_mem_list (rtx, rtx, rtx *, rtx *);
static void schedule_region (int);
static rtx concat_INSN_LIST (rtx, rtx);
static void concat_insn_mem_list (rtx, rtx, rtx *, rtx *);
-static void propagate_deps (int, struct deps *);
+static void propagate_deps (int, struct deps
_desc
*);
static void free_pending_lists (void);
/* Functions for construction of the control flow graph. */
static void free_pending_lists (void);
/* Functions for construction of the control flow graph. */
@@
-354,7
+353,7
@@
extract_edgelst (sbitmap set, edgelst *el)
/* Print the regions, for debugging purposes. Callable from debugger. */
/* Print the regions, for debugging purposes. Callable from debugger. */
-void
+
DEBUG_FUNCTION
void
debug_regions (void)
{
int rgn, bb;
debug_regions (void)
{
int rgn, bb;
@@
-379,7
+378,7
@@
debug_regions (void)
/* Print the region's basic blocks. */
/* Print the region's basic blocks. */
-void
+
DEBUG_FUNCTION
void
debug_region (int rgn)
{
int bb;
debug_region (int rgn)
{
int bb;
@@
-448,7
+447,7
@@
dump_region_dot (FILE *f, int rgn)
}
/* The same, but first open a file specified by FNAME. */
}
/* The same, but first open a file specified by FNAME. */
-void
+void
dump_region_dot_file (const char *fname, int rgn)
{
FILE *f = fopen (fname, "wt");
dump_region_dot_file (const char *fname, int rgn)
{
FILE *f = fopen (fname, "wt");
@@
-486,7
+485,6
@@
find_single_block_region (bool ebbs_p)
for (bb = ebb_start; ; bb = bb->next_bb)
{
edge e;
for (bb = ebb_start; ; bb = bb->next_bb)
{
edge e;
- edge_iterator ei;
rgn_bb_table[i] = bb->index;
RGN_NR_BLOCKS (nr_regions)++;
rgn_bb_table[i] = bb->index;
RGN_NR_BLOCKS (nr_regions)++;
@@
-497,10
+495,8
@@
find_single_block_region (bool ebbs_p)
if (bb->next_bb == EXIT_BLOCK_PTR
|| LABEL_P (BB_HEAD (bb->next_bb)))
break;
if (bb->next_bb == EXIT_BLOCK_PTR
|| LABEL_P (BB_HEAD (bb->next_bb)))
break;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if ((e->flags & EDGE_FALLTHRU) != 0)
- break;
+
+ e = find_fallthru_edge (bb->succs);
if (! e)
break;
if (e->probability <= probability_cutoff)
if (! e)
break;
if (e->probability <= probability_cutoff)
@@
-783,7
+779,7
@@
haifa_find_rgns (void)
int *queue, *degree1 = NULL;
/* We use EXTENDED_RGN_HEADER as an addition to HEADER and put
there basic blocks, which are forced to be region heads.
int *queue, *degree1 = NULL;
/* We use EXTENDED_RGN_HEADER as an addition to HEADER and put
there basic blocks, which are forced to be region heads.
- This is done to try to assemble few smaller regions
+ This is done to try to assemble few smaller regions
from a too_large region. */
sbitmap extended_rgn_header = NULL;
bool extend_regions_p;
from a too_large region. */
sbitmap extended_rgn_header = NULL;
bool extend_regions_p;
@@
-795,7
+791,7
@@
haifa_find_rgns (void)
block of each region. */
queue = XNEWVEC (int, n_basic_blocks);
block of each region. */
queue = XNEWVEC (int, n_basic_blocks);
-
+
extend_regions_p = PARAM_VALUE (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS) > 0;
if (extend_regions_p)
{
extend_regions_p = PARAM_VALUE (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS) > 0;
if (extend_regions_p)
{
@@
-851,11
+847,11
@@
haifa_find_rgns (void)
loop_head = max_hdr[bb->index];
if (extend_regions_p)
loop_head = max_hdr[bb->index];
if (extend_regions_p)
- /* We save degree in case when we meet a too_large region
- and cancel it. We need a correct degree later when
+ /* We save degree in case when we meet a too_large region
+ and cancel it. We need a correct degree later when
calling extend_rgns. */
memcpy (degree1, degree, last_basic_block * sizeof (int));
calling extend_rgns. */
memcpy (degree1, degree, last_basic_block * sizeof (int));
-
+
/* Decrease degree of all I's successors for topological
ordering. */
FOR_EACH_EDGE (e, ei, bb->succs)
/* Decrease degree of all I's successors for topological
ordering. */
FOR_EACH_EDGE (e, ei, bb->succs)
@@
-1022,7
+1018,7
@@
haifa_find_rgns (void)
degree = degree1;
degree1 = t;
degree = degree1;
degree1 = t;
-
+
/* And force successors of BB to be region heads.
This may provide several smaller regions instead
of one too_large region. */
/* And force successors of BB to be region heads.
This may provide several smaller regions instead
of one too_large region. */
@@
-1037,10
+1033,10
@@
haifa_find_rgns (void)
if (extend_regions_p)
{
free (degree1);
if (extend_regions_p)
{
free (degree1);
-
+
sbitmap_a_or_b (header, header, extended_rgn_header);
sbitmap_free (extended_rgn_header);
sbitmap_a_or_b (header, header, extended_rgn_header);
sbitmap_free (extended_rgn_header);
-
+
extend_rgns (degree, &idx, header, max_hdr);
}
}
extend_rgns (degree, &idx, header, max_hdr);
}
}
@@
-1084,8
+1080,8
@@
find_rgns (void)
static int gather_region_statistics (int **);
static void print_region_statistics (int *, int, int *, int);
static int gather_region_statistics (int **);
static void print_region_statistics (int *, int, int *, int);
-/* Calculate the histogram that shows the number of regions having the
- given number of basic blocks, and store it in the RSP array. Return
+/* Calculate the histogram that shows the number of regions having the
+ given number of basic blocks, and store it in the RSP array. Return
the size of this array. */
static int
gather_region_statistics (int **rsp)
the size of this array. */
static int
gather_region_statistics (int **rsp)
@@
-1100,7
+1096,7
@@
gather_region_statistics (int **rsp)
gcc_assert (nr_blocks >= 1);
if (nr_blocks > a_sz)
gcc_assert (nr_blocks >= 1);
if (nr_blocks > a_sz)
- {
+ {
a = XRESIZEVEC (int, a, nr_blocks);
do
a[a_sz++] = 0;
a = XRESIZEVEC (int, a, nr_blocks);
do
a[a_sz++] = 0;
@@
-1114,14
+1110,14
@@
gather_region_statistics (int **rsp)
return a_sz;
}
return a_sz;
}
-/* Print regions statistics. S1 and S2 denote the data before and after
+/* Print regions statistics. S1 and S2 denote the data before and after
calling extend_rgns, respectively. */
static void
print_region_statistics (int *s1, int s1_sz, int *s2, int s2_sz)
{
int i;
calling extend_rgns, respectively. */
static void
print_region_statistics (int *s1, int s1_sz, int *s2, int s2_sz)
{
int i;
-
- /* We iterate until s2_sz because extend_rgns does not decrease
+
+ /* We iterate until s2_sz because extend_rgns does not decrease
the maximal region size. */
for (i = 1; i < s2_sz; i++)
{
the maximal region size. */
for (i = 1; i < s2_sz; i++)
{
@@
-1175,28
+1171,28
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
/* This block already was processed in find_rgns. */
max_hdr[bbn] = -1;
}
/* This block already was processed in find_rgns. */
max_hdr[bbn] = -1;
}
-
+
/* The idea is to topologically walk through CFG in top-down order.
During the traversal, if all the predecessors of a node are
marked to be in the same region (they all have the same max_hdr),
/* The idea is to topologically walk through CFG in top-down order.
During the traversal, if all the predecessors of a node are
marked to be in the same region (they all have the same max_hdr),
- then current node is also marked to be a part of that region.
+ then current node is also marked to be a part of that region.
Otherwise the node starts its own region.
Otherwise the node starts its own region.
- CFG should be traversed until no further changes are made. On each
- iteration the set of the region heads is extended (the set of those
- blocks that have max_hdr[bbi] == bbi). This set is upper bounded by the
+ CFG should be traversed until no further changes are made. On each
+ iteration the set of the region heads is extended (the set of those
+ blocks that have max_hdr[bbi] == bbi). This set is upper bounded by the
set of all basic blocks, thus the algorithm is guaranteed to
terminate. */
while (rescan && iter < max_iter)
{
rescan = 0;
set of all basic blocks, thus the algorithm is guaranteed to
terminate. */
while (rescan && iter < max_iter)
{
rescan = 0;
-
+
for (i = nblocks - 1; i >= 0; i--)
{
edge e;
edge_iterator ei;
int bbn = order[i];
for (i = nblocks - 1; i >= 0; i--)
{
edge e;
edge_iterator ei;
int bbn = order[i];
-
+
if (max_hdr[bbn] != -1 && !TEST_BIT (header, bbn))
{
int hdr = -1;
if (max_hdr[bbn] != -1 && !TEST_BIT (header, bbn))
{
int hdr = -1;
@@
-1222,16
+1218,16
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
{
hdr = bbn;
break;
{
hdr = bbn;
break;
- }
+ }
}
else
/* BB starts its own region. */
{
hdr = bbn;
break;
}
else
/* BB starts its own region. */
{
hdr = bbn;
break;
- }
+ }
}
}
-
+
if (hdr == bbn)
{
/* If BB start its own region,
if (hdr == bbn)
{
/* If BB start its own region,
@@
-1240,7
+1236,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
rescan = 1;
}
else
rescan = 1;
}
else
- gcc_assert (hdr != -1);
+ gcc_assert (hdr != -1);
max_hdr[bbn] = hdr;
}
max_hdr[bbn] = hdr;
}
@@
-1248,17
+1244,17
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
iter++;
}
iter++;
}
-
+
/* Statistics were gathered on the SPEC2000 package of tests with
mainline weekly snapshot gcc-4.1-20051015 on ia64.
/* Statistics were gathered on the SPEC2000 package of tests with
mainline weekly snapshot gcc-4.1-20051015 on ia64.
-
+
Statistics for SPECint:
1 iteration : 1751 cases (38.7%)
2 iterations: 2770 cases (61.3%)
Blocks wrapped in regions by find_rgns without extension: 18295 blocks
Blocks wrapped in regions by 2 iterations in extend_rgns: 23821 blocks
(We don't count single block regions here).
Statistics for SPECint:
1 iteration : 1751 cases (38.7%)
2 iterations: 2770 cases (61.3%)
Blocks wrapped in regions by find_rgns without extension: 18295 blocks
Blocks wrapped in regions by 2 iterations in extend_rgns: 23821 blocks
(We don't count single block regions here).
-
+
Statistics for SPECfp:
1 iteration : 621 cases (35.9%)
2 iterations: 1110 cases (64.1%)
Statistics for SPECfp:
1 iteration : 621 cases (35.9%)
2 iterations: 1110 cases (64.1%)
@@
-1270,11
+1266,11
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
This can be overridden with max-sched-extend-regions-iters parameter:
0 - disable region extension,
N > 0 - do at most N iterations. */
This can be overridden with max-sched-extend-regions-iters parameter:
0 - disable region extension,
N > 0 - do at most N iterations. */
-
+
if (sched_verbose && iter != 0)
fprintf (sched_dump, ";; Region extension iterations: %d%s\n", iter,
rescan ? "... failed" : "");
if (sched_verbose && iter != 0)
fprintf (sched_dump, ";; Region extension iterations: %d%s\n", iter,
rescan ? "... failed" : "");
-
+
if (!rescan && iter != 0)
{
int *s1 = NULL, s1_sz = 0;
if (!rescan && iter != 0)
{
int *s1 = NULL, s1_sz = 0;
@@
-1294,7
+1290,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
edge e;
edge_iterator ei;
int num_bbs = 0, j, num_insns = 0, large;
edge e;
edge_iterator ei;
int num_bbs = 0, j, num_insns = 0, large;
-
+
large = too_large (bbn, &num_bbs, &num_insns);
degree[bbn] = -1;
large = too_large (bbn, &num_bbs, &num_insns);
degree[bbn] = -1;
@@
-1329,7
+1325,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
{
RGN_NR_BLOCKS (nr_regions) = 1;
nr_regions++;
{
RGN_NR_BLOCKS (nr_regions) = 1;
nr_regions++;
- }
+ }
num_bbs = 1;
num_bbs = 1;
@@
-1338,7
+1334,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
int succn = order[j];
if (max_hdr[succn] == bbn)
int succn = order[j];
if (max_hdr[succn] == bbn)
- /* This cycle iterates over all basic blocks, that
+ /* This cycle iterates over all basic blocks, that
are supposed to be in the region with head BBN,
and wraps them into that region (or in single
block region). */
are supposed to be in the region with head BBN,
and wraps them into that region (or in single
block region). */
@@
-1346,7
+1342,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
gcc_assert (degree[succn] == 0);
degree[succn] = -1;
gcc_assert (degree[succn] == 0);
degree[succn] = -1;
- rgn_bb_table[idx] = succn;
+ rgn_bb_table[idx] = succn;
BLOCK_TO_BB (succn) = large ? 0 : num_bbs++;
CONTAINING_RGN (succn) = nr_regions;
BLOCK_TO_BB (succn) = large ? 0 : num_bbs++;
CONTAINING_RGN (succn) = nr_regions;
@@
-1361,7
+1357,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
}
idx++;
}
idx++;
-
+
FOR_EACH_EDGE (e, ei, BASIC_BLOCK (succn)->succs)
if (e->dest != EXIT_BLOCK_PTR)
degree[e->dest->index]--;
FOR_EACH_EDGE (e, ei, BASIC_BLOCK (succn)->succs)
if (e->dest != EXIT_BLOCK_PTR)
degree[e->dest->index]--;
@@
-1380,7
+1376,7
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
{
int *s2, s2_sz;
{
int *s2, s2_sz;
- /* Get the new statistics and print the comparison with the
+ /* Get the new statistics and print the comparison with the
one before calling this function. */
s2_sz = gather_region_statistics (&s2);
print_region_statistics (s1, s1_sz, s2, s2_sz);
one before calling this function. */
s2_sz = gather_region_statistics (&s2);
print_region_statistics (s1, s1_sz, s2, s2_sz);
@@
-1388,11
+1384,11
@@
extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
free (s2);
}
}
free (s2);
}
}
-
+
free (order);
free (max_hdr);
free (order);
free (max_hdr);
- *idxp = idx;
+ *idxp = idx;
}
/* Functions for regions scheduling information. */
}
/* Functions for regions scheduling information. */
@@
-1408,7
+1404,7
@@
compute_dom_prob_ps (int bb)
/* We shouldn't have any real ebbs yet. */
gcc_assert (ebb_head [bb] == bb + current_blocks);
/* We shouldn't have any real ebbs yet. */
gcc_assert (ebb_head [bb] == bb + current_blocks);
-
+
if (IS_RGN_ENTRY (bb))
{
SET_BIT (dom[bb], 0);
if (IS_RGN_ENTRY (bb))
{
SET_BIT (dom[bb], 0);
@@
-1594,7
+1590,7
@@
free_trg_info (void)
/* Print candidates info, for debugging purposes. Callable from debugger. */
/* Print candidates info, for debugging purposes. Callable from debugger. */
-void
+
DEBUG_FUNCTION
void
debug_candidate (int i)
{
if (!candidate_table[i].is_valid)
debug_candidate (int i)
{
if (!candidate_table[i].is_valid)
@@
-1631,7
+1627,7
@@
debug_candidate (int i)
/* Print candidates info, for debugging purposes. Callable from debugger. */
/* Print candidates info, for debugging purposes. Callable from debugger. */
-void
+
DEBUG_FUNCTION
void
debug_candidates (int trg)
{
int i;
debug_candidates (int trg)
{
int i;
@@
-2119,7
+2115,7
@@
init_ready_list (void)
/* Initialize ready list with all 'ready' insns in target block.
Count number of insns in the target block being scheduled. */
for (insn = NEXT_INSN (prev_head); insn != next_tail; insn = NEXT_INSN (insn))
/* Initialize ready list with all 'ready' insns in target block.
Count number of insns in the target block being scheduled. */
for (insn = NEXT_INSN (prev_head); insn != next_tail; insn = NEXT_INSN (insn))
- {
+ {
try_ready (insn);
target_n_insns++;
try_ready (insn);
target_n_insns++;
@@
-2157,7
+2153,7
@@
can_schedule_ready_p (rtx insn)
if (INSN_BB (insn) != target_bb
&& IS_SPECULATIVE_INSN (insn)
&& !check_live (insn, INSN_BB (insn)))
if (INSN_BB (insn) != target_bb
&& IS_SPECULATIVE_INSN (insn)
&& !check_live (insn, INSN_BB (insn)))
- return 0;
+ return 0;
else
return 1;
}
else
return 1;
}
@@
-2206,12
+2202,12
@@
new_ready (rtx next, ds_t ts)
int not_ex_free = 0;
/* For speculative insns, before inserting to ready/queue,
int not_ex_free = 0;
/* For speculative insns, before inserting to ready/queue,
- check live, exception-free, and issue-delay. */
+ check live, exception-free, and issue-delay. */
if (!IS_VALID (INSN_BB (next))
|| CANT_MOVE (next)
|| (IS_SPECULATIVE_INSN (next)
&& ((recog_memoized (next) >= 0
if (!IS_VALID (INSN_BB (next))
|| CANT_MOVE (next)
|| (IS_SPECULATIVE_INSN (next)
&& ((recog_memoized (next) >= 0
- && min_insn_conflict_delay (curr_state, next, next)
+ && min_insn_conflict_delay (curr_state, next, next)
> PARAM_VALUE (PARAM_MAX_SCHED_INSN_CONFLICT_DELAY))
|| IS_SPECULATION_CHECK_P (next)
|| !check_live (next, INSN_BB (next))
> PARAM_VALUE (PARAM_MAX_SCHED_INSN_CONFLICT_DELAY))
|| IS_SPECULATION_CHECK_P (next)
|| !check_live (next, INSN_BB (next))
@@
-2242,7
+2238,7
@@
new_ready (rtx next, ds_t ts)
ts = (ts & ~SPECULATIVE) | HARD_DEP;
}
}
ts = (ts & ~SPECULATIVE) | HARD_DEP;
}
}
-
+
return ts;
}
return ts;
}
@@
-2325,7
+2321,7
@@
compute_jump_reg_dependencies (rtx insn ATTRIBUTE_UNUSED,
add_branch_dependences. */
}
add_branch_dependences. */
}
-/* This variable holds common_sched_info hooks and data relevant to
+/* This variable holds common_sched_info hooks and data relevant to
the interblock scheduler. */
static struct common_sched_info_def rgn_common_sched_info;
the interblock scheduler. */
static struct common_sched_info_def rgn_common_sched_info;
@@
-2400,7
+2396,7
@@
get_rgn_sched_max_insns_priority (void)
return rgn_sched_info.sched_max_insns_priority;
}
return rgn_sched_info.sched_max_insns_priority;
}
-/* Determine if PAT sets a CLASS_LIKELY_SPILLED_P register. */
+/* Determine if PAT sets a
TARGET_
CLASS_LIKELY_SPILLED_P register. */
static bool
sets_likely_spilled (rtx pat)
static bool
sets_likely_spilled (rtx pat)
@@
-2417,8
+2413,8
@@
sets_likely_spilled_1 (rtx x, const_rtx pat, void *data)
if (GET_CODE (pat) == SET
&& REG_P (x)
if (GET_CODE (pat) == SET
&& REG_P (x)
- &&
REGNO (x) < FIRST_PSEUDO_REGISTER
- &&
CLASS_LIKELY_SPILLED_P
(REGNO_REG_CLASS (REGNO (x))))
+ &&
HARD_REGISTER_P (x)
+ &&
targetm.class_likely_spilled_p
(REGNO_REG_CLASS (REGNO (x))))
*ret = true;
}
*ret = true;
}
@@
-2447,8
+2443,8
@@
add_branch_dependences (rtx head, rtx tail)
COND_EXEC insns cannot be moved past a branch (see e.g. PR17808).
COND_EXEC insns cannot be moved past a branch (see e.g. PR17808).
- Insns setting
CLASS_LIKELY_SPILLED_P registers (usually return values)
- are not moved before reload because we can wind up with register
+ Insns setting
TARGET_CLASS_LIKELY_SPILLED_P registers (usually return
+
values)
are not moved before reload because we can wind up with register
allocation failures. */
while (tail != head && DEBUG_INSN_P (tail))
allocation failures. */
while (tail != head && DEBUG_INSN_P (tail))
@@
-2508,7
+2504,9
@@
add_branch_dependences (rtx head, rtx tail)
add_dependence (last, insn, REG_DEP_ANTI);
}
add_dependence (last, insn, REG_DEP_ANTI);
}
-#ifdef HAVE_conditional_execution
+ if (!targetm.have_conditional_execution ())
+ return;
+
/* Finally, if the block ends in a jump, and we are doing intra-block
scheduling, make sure that the branch depends on any COND_EXEC insns
inside the block to avoid moving the COND_EXECs past the branch insn.
/* Finally, if the block ends in a jump, and we are doing intra-block
scheduling, make sure that the branch depends on any COND_EXEC insns
inside the block to avoid moving the COND_EXECs past the branch insn.
@@
-2557,7
+2555,6
@@
add_branch_dependences (rtx head, rtx tail)
if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == COND_EXEC)
add_dependence (tail, insn, REG_DEP_ANTI);
}
if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == COND_EXEC)
add_dependence (tail, insn, REG_DEP_ANTI);
}
-#endif
}
/* Data structures for the computation of data dependences in a regions. We
}
/* Data structures for the computation of data dependences in a regions. We
@@
-2566,7
+2563,7
@@
add_branch_dependences (rtx head, rtx tail)
the variables of its predecessors. When the analysis for a bb completes,
we save the contents to the corresponding bb_deps[bb] variable. */
the variables of its predecessors. When the analysis for a bb completes,
we save the contents to the corresponding bb_deps[bb] variable. */
-static struct deps *bb_deps;
+static struct deps
_desc
*bb_deps;
/* Duplicate the INSN_LIST elements of COPY and prepend them to OLD. */
/* Duplicate the INSN_LIST elements of COPY and prepend them to OLD. */
@@
-2575,7
+2572,10
@@
concat_INSN_LIST (rtx copy, rtx old)
{
rtx new_rtx = old;
for (; copy ; copy = XEXP (copy, 1))
{
rtx new_rtx = old;
for (; copy ; copy = XEXP (copy, 1))
- new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ {
+ new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ PUT_REG_NOTE_KIND (new_rtx, REG_NOTE_KIND (copy));
+ }
return new_rtx;
}
return new_rtx;
}
@@
-2600,7
+2600,7
@@
concat_insn_mem_list (rtx copy_insns, rtx copy_mems, rtx *old_insns_p,
/* Join PRED_DEPS to the SUCC_DEPS. */
void
/* Join PRED_DEPS to the SUCC_DEPS. */
void
-deps_join (struct deps
*succ_deps, struct deps
*pred_deps)
+deps_join (struct deps
_desc *succ_deps, struct deps_desc
*pred_deps)
{
unsigned reg;
reg_set_iterator rsi;
{
unsigned reg;
reg_set_iterator rsi;
@@
-2645,6
+2645,11
@@
deps_join (struct deps *succ_deps, struct deps *pred_deps)
= concat_INSN_LIST (pred_deps->last_function_call,
succ_deps->last_function_call);
= concat_INSN_LIST (pred_deps->last_function_call,
succ_deps->last_function_call);
+ /* last_function_call_may_noreturn is inherited by successor. */
+ succ_deps->last_function_call_may_noreturn
+ = concat_INSN_LIST (pred_deps->last_function_call_may_noreturn,
+ succ_deps->last_function_call_may_noreturn);
+
/* sched_before_next_call is inherited by successor. */
succ_deps->sched_before_next_call
= concat_INSN_LIST (pred_deps->sched_before_next_call,
/* sched_before_next_call is inherited by successor. */
succ_deps->sched_before_next_call
= concat_INSN_LIST (pred_deps->sched_before_next_call,
@@
-2654,7
+2659,7
@@
deps_join (struct deps *succ_deps, struct deps *pred_deps)
/* After computing the dependencies for block BB, propagate the dependencies
found in TMP_DEPS to the successors of the block. */
static void
/* After computing the dependencies for block BB, propagate the dependencies
found in TMP_DEPS to the successors of the block. */
static void
-propagate_deps (int bb, struct deps *pred_deps)
+propagate_deps (int bb, struct deps
_desc
*pred_deps)
{
basic_block block = BASIC_BLOCK (BB_TO_BLOCK (bb));
edge_iterator ei;
{
basic_block block = BASIC_BLOCK (BB_TO_BLOCK (bb));
edge_iterator ei;
@@
-2709,7
+2714,7
@@
static void
compute_block_dependences (int bb)
{
rtx head, tail;
compute_block_dependences (int bb)
{
rtx head, tail;
- struct deps tmp_deps;
+ struct deps
_desc
tmp_deps;
tmp_deps = bb_deps[bb];
tmp_deps = bb_deps[bb];
@@
-2769,7
+2774,7
@@
free_pending_lists (void)
Callable from debugger. */
/* Print dependences for debugging starting from FROM_BB.
Callable from debugger. */
Callable from debugger. */
/* Print dependences for debugging starting from FROM_BB.
Callable from debugger. */
-void
+
DEBUG_FUNCTION
void
debug_rgn_dependencies (int from_bb)
{
int bb;
debug_rgn_dependencies (int from_bb)
{
int bb;
@@
-2866,9
+2871,9
@@
sched_is_disabled_for_current_region_p (void)
return true;
}
return true;
}
-/* Free all region dependencies saved in INSN_BACK_DEPS and
+/* Free all region dependencies saved in INSN_BACK_DEPS and
INSN_RESOLVED_BACK_DEPS. The Haifa scheduler does this on the fly
INSN_RESOLVED_BACK_DEPS. The Haifa scheduler does this on the fly
- when scheduling, so this function is supposed to be called from
+ when scheduling, so this function is supposed to be called from
the selective scheduling only. */
void
free_rgn_deps (void)
the selective scheduling only. */
void
free_rgn_deps (void)
@@
-2878,7
+2883,7
@@
free_rgn_deps (void)
for (bb = 0; bb < current_nr_blocks; bb++)
{
rtx head, tail;
for (bb = 0; bb < current_nr_blocks; bb++)
{
rtx head, tail;
-
+
gcc_assert (EBB_FIRST_BB (bb) == EBB_LAST_BB (bb));
get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head, &tail);
gcc_assert (EBB_FIRST_BB (bb) == EBB_LAST_BB (bb));
get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head, &tail);
@@
-2890,7
+2895,7
@@
static int rgn_n_insns;
/* Compute insn priority for a current region. */
void
/* Compute insn priority for a current region. */
void
-compute_priorities (void)
+compute_priorities (void)
{
int bb;
{
int bb;
@@
-2898,7
+2903,7
@@
compute_priorities (void)
for (bb = 0; bb < current_nr_blocks; bb++)
{
rtx head, tail;
for (bb = 0; bb < current_nr_blocks; bb++)
{
rtx head, tail;
-
+
gcc_assert (EBB_FIRST_BB (bb) == EBB_LAST_BB (bb));
get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head, &tail);
gcc_assert (EBB_FIRST_BB (bb) == EBB_LAST_BB (bb));
get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head, &tail);
@@
-2945,12
+2950,12
@@
schedule_region (int rgn)
{
basic_block first_bb, last_bb;
rtx head, tail;
{
basic_block first_bb, last_bb;
rtx head, tail;
-
+
first_bb = EBB_FIRST_BB (bb);
last_bb = EBB_LAST_BB (bb);
first_bb = EBB_FIRST_BB (bb);
last_bb = EBB_LAST_BB (bb);
-
+
get_ebb_head_tail (first_bb, last_bb, &head, &tail);
get_ebb_head_tail (first_bb, last_bb, &head, &tail);
-
+
if (no_real_insns_p (head, tail))
{
gcc_assert (first_bb == last_bb);
if (no_real_insns_p (head, tail))
{
gcc_assert (first_bb == last_bb);
@@
-3121,7
+3126,7
@@
rgn_setup_region (int rgn)
/* Set variables for the current region. */
current_nr_blocks = RGN_NR_BLOCKS (rgn);
current_blocks = RGN_BLOCKS (rgn);
/* Set variables for the current region. */
current_nr_blocks = RGN_NR_BLOCKS (rgn);
current_blocks = RGN_BLOCKS (rgn);
-
+
/* EBB_HEAD is a region-scope structure. But we realloc it for
each region to save time/memory/something else.
See comments in add_block1, for what reasons we allocate +1 element. */
/* EBB_HEAD is a region-scope structure. But we realloc it for
each region to save time/memory/something else.
See comments in add_block1, for what reasons we allocate +1 element. */
@@
-3144,18
+3149,18
@@
sched_rgn_compute_dependencies (int rgn)
init_deps_global ();
/* Initializations for region data dependence analysis. */
init_deps_global ();
/* Initializations for region data dependence analysis. */
- bb_deps = XNEWVEC (struct deps, current_nr_blocks);
+ bb_deps = XNEWVEC (struct deps
_desc
, current_nr_blocks);
for (bb = 0; bb < current_nr_blocks; bb++)
for (bb = 0; bb < current_nr_blocks; bb++)
- init_deps (bb_deps + bb);
+ init_deps (bb_deps + bb
, false
);
/* Initialize bitmap used in add_branch_dependences. */
insn_referenced = sbitmap_alloc (sched_max_luid);
sbitmap_zero (insn_referenced);
/* Initialize bitmap used in add_branch_dependences. */
insn_referenced = sbitmap_alloc (sched_max_luid);
sbitmap_zero (insn_referenced);
-
+
/* Compute backward dependencies. */
for (bb = 0; bb < current_nr_blocks; bb++)
compute_block_dependences (bb);
/* Compute backward dependencies. */
for (bb = 0; bb < current_nr_blocks; bb++)
compute_block_dependences (bb);
-
+
sbitmap_free (insn_referenced);
free_pending_lists ();
finish_deps_global ();
sbitmap_free (insn_referenced);
free_pending_lists ();
finish_deps_global ();
@@
-3179,7
+3184,7
@@
void
sched_rgn_local_init (int rgn)
{
int bb;
sched_rgn_local_init (int rgn)
{
int bb;
-
+
/* Compute interblock info: probabilities, split-edges, dominators, etc. */
if (current_nr_blocks > 1)
{
/* Compute interblock info: probabilities, split-edges, dominators, etc. */
if (current_nr_blocks > 1)
{
@@
-3236,7
+3241,7
@@
sched_rgn_local_init (int rgn)
}
/* Free data computed for the finished region. */
}
/* Free data computed for the finished region. */
-void
+void
sched_rgn_local_free (void)
{
free (prob);
sched_rgn_local_free (void)
{
free (prob);
@@
-3366,7
+3371,7
@@
rgn_make_new_region_out_of_new_block (basic_block bb)
BLOCK_TO_BB (bb->index) = 0;
nr_regions++;
BLOCK_TO_BB (bb->index) = 0;
nr_regions++;
-
+
RGN_BLOCKS (nr_regions) = i + 1;
}
RGN_BLOCKS (nr_regions) = i + 1;
}
@@
-3383,7
+3388,7
@@
rgn_add_block (basic_block bb, basic_block after)
RGN_DONT_CALC_DEPS (nr_regions - 1) = (after == EXIT_BLOCK_PTR);
}
else
RGN_DONT_CALC_DEPS (nr_regions - 1) = (after == EXIT_BLOCK_PTR);
}
else
- {
+ {
int i, pos;
/* We need to fix rgn_table, block_to_bb, containing_rgn
int i, pos;
/* We need to fix rgn_table, block_to_bb, containing_rgn
@@
-3392,7
+3397,7
@@
rgn_add_block (basic_block bb, basic_block after)
BLOCK_TO_BB (bb->index) = BLOCK_TO_BB (after->index);
/* We extend ebb_head to one more position to
BLOCK_TO_BB (bb->index) = BLOCK_TO_BB (after->index);
/* We extend ebb_head to one more position to
- easily find the last position of the last ebb in
+ easily find the last position of the last ebb in
the current region. Thus, ebb_head[BLOCK_TO_BB (after) + 1]
is _always_ valid for access. */
the current region. Thus, ebb_head[BLOCK_TO_BB (after) + 1]
is _always_ valid for access. */
@@
-3411,24
+3416,24
@@
rgn_add_block (basic_block bb, basic_block after)
/* Source position: ebb_head[i]
Destination position: ebb_head[i] + 1
/* Source position: ebb_head[i]
Destination position: ebb_head[i] + 1
- Last position:
+ Last position:
RGN_BLOCKS (nr_regions) - 1
Number of elements to copy: (last_position) - (source_position) + 1
*/
RGN_BLOCKS (nr_regions) - 1
Number of elements to copy: (last_position) - (source_position) + 1
*/
-
+
memmove (rgn_bb_table + pos + 1,
rgn_bb_table + pos,
((RGN_BLOCKS (nr_regions) - 1) - (pos) + 1)
* sizeof (*rgn_bb_table));
rgn_bb_table[pos] = bb->index;
memmove (rgn_bb_table + pos + 1,
rgn_bb_table + pos,
((RGN_BLOCKS (nr_regions) - 1) - (pos) + 1)
* sizeof (*rgn_bb_table));
rgn_bb_table[pos] = bb->index;
-
+
for (; i <= current_nr_blocks; i++)
ebb_head [i]++;
i = CONTAINING_RGN (after->index);
CONTAINING_RGN (bb->index) = i;
for (; i <= current_nr_blocks; i++)
ebb_head [i]++;
i = CONTAINING_RGN (after->index);
CONTAINING_RGN (bb->index) = i;
-
+
RGN_HAS_REAL_EBB (i) = 1;
for (++i; i <= nr_regions; i++)
RGN_HAS_REAL_EBB (i) = 1;
for (++i; i <= nr_regions; i++)
@@
-3445,7
+3450,7
@@
rgn_fix_recovery_cfg (int bbi, int check_bbi, int check_bb_nexti)
int old_pos, new_pos, i;
BLOCK_TO_BB (check_bb_nexti) = BLOCK_TO_BB (bbi);
int old_pos, new_pos, i;
BLOCK_TO_BB (check_bb_nexti) = BLOCK_TO_BB (bbi);
-
+
for (old_pos = ebb_head[BLOCK_TO_BB (check_bbi) + 1] - 1;
rgn_bb_table[old_pos] != check_bb_nexti;
old_pos--);
for (old_pos = ebb_head[BLOCK_TO_BB (check_bbi) + 1] - 1;
rgn_bb_table[old_pos] != check_bb_nexti;
old_pos--);
@@
-3456,7
+3461,7
@@
rgn_fix_recovery_cfg (int bbi, int check_bbi, int check_bb_nexti)
new_pos--);
new_pos++;
gcc_assert (new_pos > ebb_head[BLOCK_TO_BB (bbi)]);
new_pos--);
new_pos++;
gcc_assert (new_pos > ebb_head[BLOCK_TO_BB (bbi)]);
-
+
gcc_assert (new_pos < old_pos);
memmove (rgn_bb_table + new_pos + 1,
gcc_assert (new_pos < old_pos);
memmove (rgn_bb_table + new_pos + 1,
@@
-3512,7
+3517,7
@@
static bool
gate_handle_sched2 (void)
{
#ifdef INSN_SCHEDULING
gate_handle_sched2 (void)
{
#ifdef INSN_SCHEDULING
- return optimize > 0 && flag_schedule_insns_after_reload
+ return optimize > 0 && flag_schedule_insns_after_reload
&& dbg_cnt (sched2_func);
#else
return 0;
&& dbg_cnt (sched2_func);
#else
return 0;
@@
-3531,7
+3536,7
@@
rest_of_handle_sched2 (void)
{
/* Do control and data sched analysis again,
and write some more of the results to dump file. */
{
/* Do control and data sched analysis again,
and write some more of the results to dump file. */
- if (flag_sched2_use_superblocks
|| flag_sched2_use_traces
)
+ if (flag_sched2_use_superblocks)
schedule_ebbs ();
else
schedule_insns ();
schedule_ebbs ();
else
schedule_insns ();
@@
-3583,4
+3588,3
@@
struct rtl_opt_pass pass_sched2 =
TODO_ggc_collect /* todo_flags_finish */
}
};
TODO_ggc_collect /* todo_flags_finish */
}
};
-