+2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * emit-rtl.c: Include rtl-iter.h.
+ (find_auto_inc): Turn from being a for_each_rtx callback to being
+ a function that examines each subrtx itself. Assume the first operand
+ to an RTX_AUTOINC is the automodified register.
+ (try_split): Update call accordingly.
+
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* dwarf2out.c (resolve_one_addr): Remove unused data parameter.
#include "params.h"
#include "target.h"
#include "builtins.h"
+#include "rtl-iter.h"
struct target_rtl default_target_rtl;
#if SWITCHABLE_TARGET
/* Find a RTX_AUTOINC class rtx which matches DATA. */
static int
-find_auto_inc (rtx *xp, void *data)
+find_auto_inc (const_rtx x, const_rtx reg)
{
- rtx x = *xp;
- rtx reg = (rtx) data;
-
- if (GET_RTX_CLASS (GET_CODE (x)) != RTX_AUTOINC)
- return 0;
-
- switch (GET_CODE (x))
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, x, NONCONST)
{
- case PRE_DEC:
- case PRE_INC:
- case POST_DEC:
- case POST_INC:
- case PRE_MODIFY:
- case POST_MODIFY:
- if (rtx_equal_p (reg, XEXP (x, 0)))
- return 1;
- break;
-
- default:
- gcc_unreachable ();
+ const_rtx x = *iter;
+ if (GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC
+ && rtx_equal_p (reg, XEXP (x, 0)))
+ return true;
}
- return -1;
+ return false;
}
#endif
{
rtx reg = XEXP (note, 0);
if (!FIND_REG_INC_NOTE (insn, reg)
- && for_each_rtx (&PATTERN (insn), find_auto_inc, reg) > 0)
+ && find_auto_inc (PATTERN (insn), reg))
add_reg_note (insn, REG_INC, reg);
}
break;