aboutsummaryrefslogtreecommitdiff
path: root/gcc/haifa-sched.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-27 19:53:39 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-27 19:53:39 +0000
commit3dc99c19a5203597ca0bf8f39aea7028f17e80ba (patch)
tree6b70cdb662152458e90a78b8cb9af235f424d8a0 /gcc/haifa-sched.c
parenta756c6be3193ea9483aaa35b1be4e95ccc79af83 (diff)
downloadgcc-3dc99c19a5203597ca0bf8f39aea7028f17e80ba.zip
gcc-3dc99c19a5203597ca0bf8f39aea7028f17e80ba.tar.gz
gcc-3dc99c19a5203597ca0bf8f39aea7028f17e80ba.tar.bz2
Use rtx_insn_list in various places
gcc/ 2014-08-27 David Malcolm <dmalcolm@redhat.com> * rtl.h (free_INSN_LIST_list): Strengthen param from rtx * to rtx_insn_list **. (alloc_INSN_LIST): Strengthen return type from rtx to rtx_insn_list *. (copy_INSN_LIST): Likewise for return type and param. (concat_INSN_LIST): Likewise for both params and return type. (remove_free_INSN_LIST_elem): Strenghten first param from rtx to rtx_insn *. Strengthen second param from rtx * to rtx_insn_list **. (remove_free_INSN_LIST_node): Strenghten return type from rtx to rtx_insn *. Strengthen param from rtx * to rtx_insn_list **. * sched-int.h (struct deps_reg): Strengthen fields "uses", "sets", "implicit_sets", "control_uses", "clobbers" from rtx to rtx_insn_list *. (struct deps_desc): Likewise for fields "pending_read_insns", "pending_write_insns", "pending_jump_insns", "last_pending_memory_flush", "last_function_call", "last_function_call_may_noreturn", "sched_before_next_call", "sched_before_next_jump". (struct _haifa_deps_insn_data): Likewise for field "cond_deps". (remove_from_deps): Strengthen second param from rtx to rtx_insn *. * gcse.c (struct ls_expr): Strengthen fields "loads" and "stores" from rtx to rtx_insn_list *. (ldst_entry): Replace use of NULL_RTX with NULL when dealing with rtx_insn_list *. * haifa-sched.c (insn_queue): Strengthen this variable from rtx * to rtx_insn_list **. (dep_cost_1): Strengthen local "dep_cost_rtx_link" from rtx to rtx_insn_list *. (queue_insn): Likewise for local "link". (struct haifa_saved_data): Strengthen field "insn_queue" from rtx * to rtx_insn_list **. (save_backtrack_point): Update allocation of save->insn_queue to reflect the strengthening of elements from rtx to rtx_insn_list *. (queue_to_ready): Strengthen local "link" from rtx to rtx_insn_list *; use methods "next" and "insn" when traversing the list. (early_queue_to_ready): Likewise for locals "link", "next_link", "prev_link". (schedule_block): Update allocation of insn_queue to reflect the strengthening of elements from rtx to rtx_insn_list *. Strengthen local "link" from rtx to rtx_insn_list *, and use methods when working it. (add_to_speculative_block): Strengthen locals "twins" and "next_node" from rtx to rtx_insn_list *, and use methods when working with them. Strengthen local "twin" from rtx to rtx_insn *, eliminating a checked cast. (fix_recovery_deps): Strengthen locals "ready_list" and "link" from rtx to rtx_insn_list *, and use methods when working with them. * lists.c (alloc_INSN_LIST): Strengthen return type and local "r" from rtx to rtx_insn_list *, adding a checked cast. (free_INSN_LIST_list): Strengthen param "listp" from rtx * to rtx_insn_list **. (copy_INSN_LIST): Strengthen return type and locals "new_queue", "newlink" from rtx to rtx_insn_list *. Strengthen local "pqueue" from rtx * to rtx_insn_list **. Strengthen local "x" from rtx to rtx_insn *. (concat_INSN_LIST): Strengthen return type and local "new_rtx", from rtx to rtx_insn_list *. Use methods of the latter class. (remove_free_INSN_LIST_elem): Strengthen param "elem" from rtx to rtx_insn *, and param "listp" from rtx * to rtx_insn_list **. (remove_free_INSN_LIST_node): Strengthen return type and local "elem" from rtx to rtx_insn *. Strenghten param "listp" from rtx * to rtx_insn_list **. Strengthen local "node" from rtx to rtx_insn_list *, using "insn" method. * sched-deps.c (add_dependence_list): Strengthen param "list" from rtx to rtx_insn_list *, and use methods when working with it. (add_dependence_list_and_free): Strengthen param "listp" from rtx * to rtx_insn_list **. (remove_from_dependence_list): Strenghten param "listp" from rtx * to rtx_insn_list **, and use methods when working with *listp. (remove_from_both_dependence_lists): Strengthen param "listp" from rtx * to rtx_insn_list ** (add_insn_mem_dependence): Strengthen local "insn_list" from rtx * to rtx_insn_list **. Eliminate local "link", in favor of two new locals "insn_node" and "mem_node", an rtx_insn_list * and an rtx respectively. (deps_analyze_insn): Split out uses 'f local "t" as an INSN_LIST by introducing local "cond_deps". (remove_from_deps): Strengthen param "insn" from rtx to rtx_insn *. * sched-rgn.c (concat_insn_mem_list): Strengthen param "copy_insns" and local "new_insns" from rtx to rtx_insn_list *. Strengthen param "old_insns_p" from rtx * to rtx_insn_list **. Use methods of rtx_insn_list. * store-motion.c (struct st_expr): Strengthen fields "antic_stores" and "avail_stores" from rtx to rtx_insn_list *. (st_expr_entry): Replace NULL_RTX with NULL when dealing with rtx_insn_list *. (find_moveable_store): Split out "tmp" into multiple more-tightly scoped locals. Use methods of rtx_insn_list *. (compute_store_table): Strengthen local "tmp" from rtx to rtx_insn *. Use methods of rtx_insn_list *. From-SVN: r214590
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r--gcc/haifa-sched.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 80a4dc8..1bb6a9d 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -318,7 +318,7 @@ bool adding_bb_to_current_region_p = true;
the base maximal time of functional unit reservations and getting a
result. This is the longest time an insn may be queued. */
-static rtx *insn_queue;
+static rtx_insn_list **insn_queue;
static int q_ptr = 0;
static int q_size = 0;
#define NEXT_Q(X) (((X)+1) & max_insn_queue_index)
@@ -1475,7 +1475,8 @@ dep_cost_1 (dep_t link, dw_t dw)
{
/* This variable is used for backward compatibility with the
targets. */
- rtx dep_cost_rtx_link = alloc_INSN_LIST (NULL_RTX, NULL_RTX);
+ rtx_insn_list *dep_cost_rtx_link =
+ alloc_INSN_LIST (NULL_RTX, NULL);
/* Make it self-cycled, so that if some tries to walk over this
incomplete list he/she will be caught in an endless loop. */
@@ -2745,7 +2746,7 @@ HAIFA_INLINE static void
queue_insn (rtx_insn *insn, int n_cycles, const char *reason)
{
int next_q = NEXT_Q_AFTER (q_ptr, n_cycles);
- rtx link = alloc_INSN_LIST (insn, insn_queue[next_q]);
+ rtx_insn_list *link = alloc_INSN_LIST (insn, insn_queue[next_q]);
int new_tick;
gcc_assert (n_cycles <= max_insn_queue_index);
@@ -4112,7 +4113,7 @@ struct haifa_saved_data
/* We don't need to save q_ptr, as its value is arbitrary and we can set it
to 0 when restoring. */
int q_size;
- rtx *insn_queue;
+ rtx_insn_list **insn_queue;
/* Describe pattern replacements that occurred since this backtrack point
was queued. */
@@ -4163,7 +4164,7 @@ save_backtrack_point (struct delay_pair *pair,
save->ready.vec = XNEWVEC (rtx_insn *, ready.veclen);
memcpy (save->ready.vec, ready.vec, ready.veclen * sizeof (rtx));
- save->insn_queue = XNEWVEC (rtx, max_insn_queue_index + 1);
+ save->insn_queue = XNEWVEC (rtx_insn_list *, max_insn_queue_index + 1);
save->q_size = q_size;
for (i = 0; i <= max_insn_queue_index; i++)
{
@@ -4926,7 +4927,7 @@ static void
queue_to_ready (struct ready_list *ready)
{
rtx_insn *insn;
- rtx link;
+ rtx_insn_list *link;
rtx skip_insn;
q_ptr = NEXT_Q (q_ptr);
@@ -4940,9 +4941,9 @@ queue_to_ready (struct ready_list *ready)
/* Add all pending insns that can be scheduled without stalls to the
ready list. */
- for (link = insn_queue[q_ptr]; link; link = XEXP (link, 1))
+ for (link = insn_queue[q_ptr]; link; link = link->next ())
{
- insn = as_a <rtx_insn *> (XEXP (link, 0));
+ insn = link->insn ();
q_size -= 1;
if (sched_verbose >= 2)
@@ -4988,7 +4989,7 @@ queue_to_ready (struct ready_list *ready)
{
if ((link = insn_queue[NEXT_Q_AFTER (q_ptr, stalls)]))
{
- for (; link; link = XEXP (link, 1))
+ for (; link; link = link->next ())
{
insn = as_a <rtx_insn *> (XEXP (link, 0));
q_size -= 1;
@@ -5082,9 +5083,9 @@ static int
early_queue_to_ready (state_t state, struct ready_list *ready)
{
rtx_insn *insn;
- rtx link;
- rtx next_link;
- rtx prev_link;
+ rtx_insn_list *link;
+ rtx_insn_list *next_link;
+ rtx_insn_list *prev_link;
bool move_to_ready;
int cost;
state_t temp_state = alloca (dfa_state_size);
@@ -5118,8 +5119,8 @@ early_queue_to_ready (state_t state, struct ready_list *ready)
prev_link = 0;
while (link)
{
- next_link = XEXP (link, 1);
- insn = as_a <rtx_insn *> (XEXP (link, 0));
+ next_link = link->next ();
+ insn = link->insn ();
if (insn && sched_verbose > 6)
print_rtl_single (sched_dump, insn);
@@ -6038,7 +6039,7 @@ schedule_block (basic_block *target_bb, state_t init_state)
q_ptr = 0;
q_size = 0;
- insn_queue = XALLOCAVEC (rtx, max_insn_queue_index + 1);
+ insn_queue = XALLOCAVEC (rtx_insn_list *, max_insn_queue_index + 1);
memset (insn_queue, 0, (max_insn_queue_index + 1) * sizeof (rtx));
/* Start just before the beginning of time. */
@@ -6503,11 +6504,11 @@ schedule_block (basic_block *target_bb, state_t init_state)
}
for (i = 0; i <= max_insn_queue_index; i++)
{
- rtx link;
+ rtx_insn_list *link;
while ((link = insn_queue[i]) != NULL)
{
- rtx_insn *x = as_a <rtx_insn *> (XEXP (link, 0));
- insn_queue[i] = XEXP (link, 1);
+ rtx_insn *x = link->insn ();
+ insn_queue[i] = link->next ();
QUEUE_INDEX (x) = QUEUE_NOWHERE;
free_INSN_LIST_node (link);
resolve_dependencies (x);
@@ -7424,7 +7425,7 @@ add_to_speculative_block (rtx_insn *insn)
ds_t ts;
sd_iterator_def sd_it;
dep_t dep;
- rtx twins = NULL;
+ rtx_insn_list *twins = NULL;
rtx_vec_t priorities_roots;
ts = TODO_SPEC (insn);
@@ -7535,20 +7536,21 @@ add_to_speculative_block (rtx_insn *insn)
because that would make TWINS appear in the INSN_BACK_DEPS (INSN). */
while (twins)
{
- rtx twin;
+ rtx_insn *twin;
+ rtx_insn_list *next_node;
- twin = XEXP (twins, 0);
+ twin = twins->insn ();
{
dep_def _new_dep, *new_dep = &_new_dep;
- init_dep (new_dep, insn, as_a <rtx_insn *> (twin), REG_DEP_OUTPUT);
+ init_dep (new_dep, insn, twin, REG_DEP_OUTPUT);
sd_add_dep (new_dep, false);
}
- twin = XEXP (twins, 1);
+ next_node = twins->next ();
free_INSN_LIST_node (twins);
- twins = twin;
+ twins = next_node;
}
calc_priorities (priorities_roots);
@@ -8066,9 +8068,9 @@ static void
fix_recovery_deps (basic_block rec)
{
rtx_insn *note, *insn, *jump;
- rtx ready_list = 0;
+ rtx_insn_list *ready_list = 0;
bitmap_head in_ready;
- rtx link;
+ rtx_insn_list *link;
bitmap_initialize (&in_ready, 0);
@@ -8111,8 +8113,8 @@ fix_recovery_deps (basic_block rec)
bitmap_clear (&in_ready);
/* Try to add instructions to the ready or queue list. */
- for (link = ready_list; link; link = XEXP (link, 1))
- try_ready (as_a <rtx_insn *> (XEXP (link, 0)));
+ for (link = ready_list; link; link = link->next ())
+ try_ready (link->insn ());
free_INSN_LIST_list (&ready_list);
/* Fixing jump's dependences. */