+2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * calls.c: Include rtl-iter.h.
+ (internal_arg_pointer_based_exp_1): Delete.
+ (internal_arg_pointer_based_exp): Take a const_rtx.
+ Use FOR_EACH_SUBRTX to iterate over subrtxes.
+
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* caller-save.c: Include rtl-iter.h.
#include "cgraph.h"
#include "except.h"
#include "dbgcnt.h"
+#include "rtl-iter.h"
/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
vec<rtx> cache;
} internal_arg_pointer_exp_state;
-static rtx internal_arg_pointer_based_exp (rtx, bool);
+static rtx internal_arg_pointer_based_exp (const_rtx, bool);
/* Helper function for internal_arg_pointer_based_exp. Scan insns in
the tail call sequence, starting with first insn that hasn't been
internal_arg_pointer_exp_state.scan_start = scan_start;
}
-/* Helper function for internal_arg_pointer_based_exp, called through
- for_each_rtx. Return 1 if *LOC is a register based on
- crtl->args.internal_arg_pointer. Return -1 if *LOC is not based on it
- and the subexpressions need not be examined. Otherwise return 0. */
-
-static int
-internal_arg_pointer_based_exp_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
-{
- if (REG_P (*loc) && internal_arg_pointer_based_exp (*loc, false) != NULL_RTX)
- return 1;
- if (MEM_P (*loc))
- return -1;
- return 0;
-}
-
/* Compute whether RTL is based on crtl->args.internal_arg_pointer. Return
NULL_RTX if RTL isn't based on it, a CONST_INT offset if RTL is based on
it with fixed offset, or PC if this is with variable or unknown offset.
TOPLEVEL is true if the function is invoked at the topmost level. */
static rtx
-internal_arg_pointer_based_exp (rtx rtl, bool toplevel)
+internal_arg_pointer_based_exp (const_rtx rtl, bool toplevel)
{
if (CONSTANT_P (rtl))
return NULL_RTX;
return NULL_RTX;
}
- if (for_each_rtx (&rtl, internal_arg_pointer_based_exp_1, NULL))
- return pc_rtx;
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, rtl, NONCONST)
+ {
+ const_rtx x = *iter;
+ if (REG_P (x) && internal_arg_pointer_based_exp (x, false) != NULL_RTX)
+ return pc_rtx;
+ if (MEM_P (x))
+ iter.skip_subrtxes ();
+ }
return NULL_RTX;
}