summaryrefslogtreecommitdiff
path: root/gcc/sched-deps.c
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-27 19:53:39 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-27 19:53:39 +0000
commit54267fdfa2487c67f4773fc664b0919b07fa221a (patch)
tree6b70cdb662152458e90a78b8cb9af235f424d8a0 /gcc/sched-deps.c
parent13be9dc6f5f79a971db138df17efa7afc92b4121 (diff)
downloadgcc-54267fdfa2487c67f4773fc664b0919b07fa221a.tar.gz
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 *. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r--gcc/sched-deps.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 31272f66652..fb1b658b60c 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -483,9 +483,11 @@ static bool mark_as_hard;
static int deps_may_trap_p (const_rtx);
static void add_dependence_1 (rtx_insn *, rtx_insn *, enum reg_note);
-static void add_dependence_list (rtx_insn *, rtx, int, enum reg_note, bool);
+static void add_dependence_list (rtx_insn *, rtx_insn_list *, int,
+ enum reg_note, bool);
static void add_dependence_list_and_free (struct deps_desc *, rtx_insn *,
- rtx *, int, enum reg_note, bool);
+ rtx_insn_list **, int, enum reg_note,
+ bool);
static void delete_all_dependences (rtx);
static void chain_to_prev_insn (rtx_insn *);
@@ -1561,14 +1563,14 @@ add_dependence (rtx_insn *con, rtx_insn *pro, enum reg_note dep_type)
true if DEP_NONREG should be set on newly created dependencies. */
static void
-add_dependence_list (rtx_insn *insn, rtx list, int uncond, enum reg_note dep_type,
- bool hard)
+add_dependence_list (rtx_insn *insn, rtx_insn_list *list, int uncond,
+ enum reg_note dep_type, bool hard)
{
mark_as_hard = hard;
- for (; list; list = XEXP (list, 1))
+ for (; list; list = list->next ())
{
- if (uncond || ! sched_insns_conditions_mutex_p (insn, XEXP (list, 0)))
- add_dependence (insn, as_a <rtx_insn *> (XEXP (list, 0)), dep_type);
+ if (uncond || ! sched_insns_conditions_mutex_p (insn, list->insn ()))
+ add_dependence (insn, list->insn (), dep_type);
}
mark_as_hard = false;
}
@@ -1578,7 +1580,8 @@ add_dependence_list (rtx_insn *insn, rtx list, int uncond, enum reg_note dep_typ
newly created dependencies. */
static void
-add_dependence_list_and_free (struct deps_desc *deps, rtx_insn *insn, rtx *listp,
+add_dependence_list_and_free (struct deps_desc *deps, rtx_insn *insn,
+ rtx_insn_list **listp,
int uncond, enum reg_note dep_type, bool hard)
{
add_dependence_list (insn, *listp, uncond, dep_type, hard);
@@ -1596,20 +1599,20 @@ add_dependence_list_and_free (struct deps_desc *deps, rtx_insn *insn, rtx *listp
occurrences removed. */
static int
-remove_from_dependence_list (rtx insn, rtx* listp)
+remove_from_dependence_list (rtx insn, rtx_insn_list **listp)
{
int removed = 0;
while (*listp)
{
- if (XEXP (*listp, 0) == insn)
+ if ((*listp)->insn () == insn)
{
remove_free_INSN_LIST_node (listp);
removed++;
continue;
}
- listp = &XEXP (*listp, 1);
+ listp = (rtx_insn_list **)&XEXP (*listp, 1);
}
return removed;
@@ -1617,7 +1620,9 @@ remove_from_dependence_list (rtx insn, rtx* listp)
/* Same as above, but process two lists at once. */
static int
-remove_from_both_dependence_lists (rtx insn, rtx *listp, rtx *exprp)
+remove_from_both_dependence_lists (rtx insn,
+ rtx_insn_list **listp,
+ rtx *exprp)
{
int removed = 0;
@@ -1631,7 +1636,7 @@ remove_from_both_dependence_lists (rtx insn, rtx *listp, rtx *exprp)
continue;
}
- listp = &XEXP (*listp, 1);
+ listp = (rtx_insn_list **)&XEXP (*listp, 1);
exprp = &XEXP (*exprp, 1);
}
@@ -1712,9 +1717,10 @@ static void
add_insn_mem_dependence (struct deps_desc *deps, bool read_p,
rtx_insn *insn, rtx mem)
{
- rtx *insn_list;
+ rtx_insn_list **insn_list;
+ rtx_insn_list *insn_node;
rtx *mem_list;
- rtx link;
+ rtx mem_node;
gcc_assert (!deps->readonly);
if (read_p)
@@ -1731,8 +1737,8 @@ add_insn_mem_dependence (struct deps_desc *deps, bool read_p,
deps->pending_write_list_length++;
}
- link = alloc_INSN_LIST (insn, *insn_list);
- *insn_list = link;
+ insn_node = alloc_INSN_LIST (insn, *insn_list);
+ *insn_list = insn_node;
if (sched_deps_info->use_cselib)
{
@@ -1740,8 +1746,8 @@ add_insn_mem_dependence (struct deps_desc *deps, bool read_p,
XEXP (mem, 0) = cselib_subst_to_values_from_insn (XEXP (mem, 0),
GET_MODE (mem), insn);
}
- link = alloc_EXPR_LIST (VOIDmode, canon_rtx (mem), *mem_list);
- *mem_list = link;
+ mem_node = alloc_EXPR_LIST (VOIDmode, canon_rtx (mem), *mem_list);
+ *mem_list = mem_node;
}
/* Make a dependency between every memory reference on the pending lists
@@ -3603,7 +3609,7 @@ deps_analyze_insn (struct deps_desc *deps, rtx_insn *insn)
rtx t;
sched_get_condition_with_rev (insn, NULL);
t = INSN_CACHED_COND (insn);
- INSN_COND_DEPS (insn) = NULL_RTX;
+ INSN_COND_DEPS (insn) = NULL;
if (reload_completed
&& (current_sched_info->flags & DO_PREDICATION)
&& COMPARISON_P (t)
@@ -3612,18 +3618,18 @@ deps_analyze_insn (struct deps_desc *deps, rtx_insn *insn)
{
unsigned int regno;
int nregs;
+ rtx_insn_list *cond_deps = NULL;
t = XEXP (t, 0);
regno = REGNO (t);
nregs = hard_regno_nregs[regno][GET_MODE (t)];
- t = NULL_RTX;
while (nregs-- > 0)
{
struct deps_reg *reg_last = &deps->reg_last[regno + nregs];
- t = concat_INSN_LIST (reg_last->sets, t);
- t = concat_INSN_LIST (reg_last->clobbers, t);
- t = concat_INSN_LIST (reg_last->implicit_sets, t);
+ cond_deps = concat_INSN_LIST (reg_last->sets, cond_deps);
+ cond_deps = concat_INSN_LIST (reg_last->clobbers, cond_deps);
+ cond_deps = concat_INSN_LIST (reg_last->implicit_sets, cond_deps);
}
- INSN_COND_DEPS (insn) = t;
+ INSN_COND_DEPS (insn) = cond_deps;
}
}
@@ -3968,7 +3974,7 @@ free_deps (struct deps_desc *deps)
/* Remove INSN from dependence contexts DEPS. */
void
-remove_from_deps (struct deps_desc *deps, rtx insn)
+remove_from_deps (struct deps_desc *deps, rtx_insn *insn)
{
int removed;
unsigned i;