aboutsummaryrefslogtreecommitdiff
path: root/gcc/sched-deps.c
diff options
context:
space:
mode:
authorAndrey Belevantsev <abel@ispras.ru>2009-11-13 17:27:13 +0300
committerAndrey Belevantsev <abel@gcc.gnu.org>2009-11-13 17:27:13 +0300
commitbcf3377540d2e5d8ea63fdb8aed16cff16f6ba85 (patch)
tree33d70889d193e4a1474e119c509e0e1fcd50b507 /gcc/sched-deps.c
parentba0dc4bed674b0c5bf0df8a4b2fee35617f64335 (diff)
downloadgcc-bcf3377540d2e5d8ea63fdb8aed16cff16f6ba85.zip
gcc-bcf3377540d2e5d8ea63fdb8aed16cff16f6ba85.tar.gz
gcc-bcf3377540d2e5d8ea63fdb8aed16cff16f6ba85.tar.bz2
sched-deps.c (init_deps): New parameter lazy_reg_last.
2009-11-13 Andrey Belevantsev <abel@ispras.ru> * sched-deps.c (init_deps): New parameter lazy_reg_last. Don't allocate reg_last when in case lazy_reg_last is true. (init_deps_reg_last): New. (free_deps): When max_reg is 0, this context is already freed. * sched-int.h (init_deps_reg_last): Export. (init_deps): Update prototype. * sched-ebb.c (schedule_ebb): Update the call to init_deps. * sched-rgn.c (sched_rgn_compute_dependencies): Likewise. * ddg.c (build_intra_loop_deps): Likewise. * sel-sched-ir.c (copy_deps_context, create_deps_context, reset_deps_context, deps_init_id): Likewise. (init_first_time_insn_data): Lazy allocate INSN_DEPS_CONTEXT. (free_data_for_scheduled_insn): New, break down from ... (free_first_time_insn_data): ... here. (has_dependence_p): Allocate reg_last now, when it is needed. (extend_insn_data): When maximal LUID is big enough, allocate per-insn data in smaller chunks. * sel-sched-ir.h (free_data_for_scheduled_insn): Export. * sel-sched.c (update_seqnos_and_stage): Free INSN_DEPS_CONTEXT in scheduled insn. From-SVN: r154147
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r--gcc/sched-deps.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 1f1a76c..fdc98fb 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -3461,15 +3461,19 @@ sched_free_deps (rtx head, rtx tail, bool resolved_p)
}
/* Initialize variables for region data dependence analysis.
- n_bbs is the number of region blocks. */
+ When LAZY_REG_LAST is true, do not allocate reg_last array
+ of struct deps immediately. */
void
-init_deps (struct deps *deps)
+init_deps (struct deps *deps, bool lazy_reg_last)
{
int max_reg = (reload_completed ? FIRST_PSEUDO_REGISTER : max_reg_num ());
deps->max_reg = max_reg;
- deps->reg_last = XCNEWVEC (struct deps_reg, max_reg);
+ if (lazy_reg_last)
+ deps->reg_last = NULL;
+ else
+ deps->reg_last = XCNEWVEC (struct deps_reg, max_reg);
INIT_REG_SET (&deps->reg_last_in_use);
INIT_REG_SET (&deps->reg_conditional_sets);
@@ -3490,6 +3494,18 @@ init_deps (struct deps *deps)
deps->readonly = 0;
}
+/* Init only reg_last field of DEPS, which was not allocated before as
+ we inited DEPS lazily. */
+void
+init_deps_reg_last (struct deps *deps)
+{
+ gcc_assert (deps && deps->max_reg > 0);
+ gcc_assert (deps->reg_last == NULL);
+
+ deps->reg_last = XCNEWVEC (struct deps_reg, deps->max_reg);
+}
+
+
/* Free insn lists found in DEPS. */
void
@@ -3498,6 +3514,14 @@ free_deps (struct deps *deps)
unsigned i;
reg_set_iterator rsi;
+ /* We set max_reg to 0 when this context was already freed. */
+ if (deps->max_reg == 0)
+ {
+ gcc_assert (deps->reg_last == NULL);
+ return;
+ }
+ deps->max_reg = 0;
+
free_INSN_LIST_list (&deps->pending_read_insns);
free_EXPR_LIST_list (&deps->pending_read_mems);
free_INSN_LIST_list (&deps->pending_write_insns);
@@ -3522,7 +3546,10 @@ free_deps (struct deps *deps)
CLEAR_REG_SET (&deps->reg_last_in_use);
CLEAR_REG_SET (&deps->reg_conditional_sets);
- free (deps->reg_last);
+ /* As we initialize reg_last lazily, it is possible that we didn't allocate
+ it at all. */
+ if (deps->reg_last)
+ free (deps->reg_last);
deps->reg_last = NULL;
deps = NULL;