From e9f56944fd8af31ed0d9cdef134d5f0a68bcb719 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 28 Aug 2014 06:21:59 +0000 Subject: [PATCH] calls.c: Include rtl-iter.h. gcc/ * 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. From-SVN: r214622 --- gcc/ChangeLog | 7 +++++++ gcc/calls.c | 31 ++++++++++++------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9b89e4..b5ea9b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2014-08-28 Richard Sandiford + * 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 + * caller-save.c: Include rtl-iter.h. (add_used_regs_1): Delete. (add_used_regs): Use FOR_EACH_SUBRTX rather than for_each_rtx diff --git a/gcc/calls.c b/gcc/calls.c index 10f52bb..03ed9c8 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #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) @@ -1696,7 +1697,7 @@ static struct vec 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 @@ -1744,28 +1745,13 @@ internal_arg_pointer_based_exp_scan (void) 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; @@ -1799,8 +1785,15 @@ internal_arg_pointer_based_exp (rtx rtl, bool toplevel) 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; } -- 2.7.4