+2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * ddg.c (walk_mems_2, walk_mems_1): Delete.
+ (insns_may_alias_p): Use FOR_EACH_SUBRTX rather than for_each_rtx
+ to iterate over subrtxes. Return a bool rather than an int.
+
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* ddg.c: Include rtl-iter.h.
}
-static int
-walk_mems_2 (rtx *x, rtx mem)
-{
- if (MEM_P (*x))
- {
- if (may_alias_p (*x, mem))
- return 1;
-
- return -1;
- }
- return 0;
-}
-
-static int
-walk_mems_1 (rtx *x, rtx *pat)
+/* Return true if two specified instructions have mem expr with conflict
+ alias sets. */
+static bool
+insns_may_alias_p (rtx_insn *insn1, rtx_insn *insn2)
{
- if (MEM_P (*x))
+ subrtx_iterator::array_type array1;
+ subrtx_iterator::array_type array2;
+ FOR_EACH_SUBRTX (iter1, array1, PATTERN (insn1), NONCONST)
{
- /* Visit all MEMs in *PAT and check independence. */
- if (for_each_rtx (pat, (rtx_function) walk_mems_2, *x))
- /* Indicate that dependence was determined and stop traversal. */
- return 1;
-
- return -1;
+ const_rtx x1 = *iter1;
+ if (MEM_P (x1))
+ FOR_EACH_SUBRTX (iter2, array2, PATTERN (insn2), NONCONST)
+ {
+ const_rtx x2 = *iter2;
+ if (MEM_P (x2) && may_alias_p (x2, x1))
+ return true;
+ }
}
- return 0;
-}
-
-/* Return 1 if two specified instructions have mem expr with conflict alias sets*/
-static int
-insns_may_alias_p (rtx_insn *insn1, rtx_insn *insn2)
-{
- /* For each pair of MEMs in INSN1 and INSN2 check their independence. */
- return for_each_rtx (&PATTERN (insn1), (rtx_function) walk_mems_1,
- &PATTERN (insn2));
+ return false;
}
/* Given two nodes, analyze their RTL insns and add intra-loop mem deps