This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 13/18] haifa-sched.c: make twins a auto_vec<rtx_insn *>
- From: tbsaunde+gcc at tbsaunde dot org
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Apr 2016 02:22:17 -0400
- Subject: [PATCH 13/18] haifa-sched.c: make twins a auto_vec<rtx_insn *>
- Authentication-results: sourceware.org; auth=none
- References: <1461133342-10794-1-git-send-email-tbsaunde+gcc at tbsaunde dot org>
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
gcc/ChangeLog:
2016-04-19 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* haifa-sched.c (add_to_speculative_block): Make twins a vector.
---
gcc/haifa-sched.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 0721ec5..34c5cc5 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -7973,7 +7973,7 @@ add_to_speculative_block (rtx_insn *insn)
ds_t ts;
sd_iterator_def sd_it;
dep_t dep;
- rtx_insn_list *twins = NULL;
+ auto_vec<rtx_insn *, 10> twins;
rtx_vec_t priorities_roots;
ts = TODO_SPEC (insn);
@@ -8043,7 +8043,7 @@ add_to_speculative_block (rtx_insn *insn)
fprintf (spec_info->dump, ";;\t\tGenerated twin insn : %d/rec%d\n",
INSN_UID (twin), rec->index);
- twins = alloc_INSN_LIST (twin, twins);
+ twins.safe_push (twin);
/* Add dependences between TWIN and all appropriate
instructions from REC. */
@@ -8082,23 +8082,14 @@ add_to_speculative_block (rtx_insn *insn)
/* We couldn't have added the dependencies between INSN and TWINS earlier
because that would make TWINS appear in the INSN_BACK_DEPS (INSN). */
- while (twins)
+ unsigned int len = twins.length ();
+ for (unsigned int i = len - 1; i < len; i--)
{
- rtx_insn *twin;
- rtx_insn_list *next_node;
-
- twin = twins->insn ();
-
- {
- dep_def _new_dep, *new_dep = &_new_dep;
+ rtx_insn *twin = twins[i];
+ dep_def _new_dep, *new_dep = &_new_dep;
- init_dep (new_dep, insn, twin, REG_DEP_OUTPUT);
- sd_add_dep (new_dep, false);
- }
-
- next_node = twins->next ();
- free_INSN_LIST_node (twins);
- twins = next_node;
+ init_dep (new_dep, insn, twin, REG_DEP_OUTPUT);
+ sd_add_dep (new_dep, false);
}
calc_priorities (priorities_roots);
--
2.7.4