Commit e9f56944 by Richard Sandiford Committed by Richard Sandiford

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
parent 1cb22a67
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 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. * caller-save.c: Include rtl-iter.h.
(add_used_regs_1): Delete. (add_used_regs_1): Delete.
(add_used_regs): Use FOR_EACH_SUBRTX rather than for_each_rtx (add_used_regs): Use FOR_EACH_SUBRTX rather than for_each_rtx
......
...@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h" #include "cgraph.h"
#include "except.h" #include "except.h"
#include "dbgcnt.h" #include "dbgcnt.h"
#include "rtl-iter.h"
/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
...@@ -1696,7 +1697,7 @@ static struct ...@@ -1696,7 +1697,7 @@ static struct
vec<rtx> cache; vec<rtx> cache;
} internal_arg_pointer_exp_state; } 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 /* Helper function for internal_arg_pointer_based_exp. Scan insns in
the tail call sequence, starting with first insn that hasn't been the tail call sequence, starting with first insn that hasn't been
...@@ -1744,28 +1745,13 @@ internal_arg_pointer_based_exp_scan (void) ...@@ -1744,28 +1745,13 @@ internal_arg_pointer_based_exp_scan (void)
internal_arg_pointer_exp_state.scan_start = scan_start; 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 /* 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 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. 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. */ TOPLEVEL is true if the function is invoked at the topmost level. */
static rtx 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)) if (CONSTANT_P (rtl))
return NULL_RTX; return NULL_RTX;
...@@ -1799,8 +1785,15 @@ internal_arg_pointer_based_exp (rtx rtl, bool toplevel) ...@@ -1799,8 +1785,15 @@ internal_arg_pointer_based_exp (rtx rtl, bool toplevel)
return NULL_RTX; return NULL_RTX;
} }
if (for_each_rtx (&rtl, internal_arg_pointer_based_exp_1, NULL)) subrtx_iterator::array_type array;
return pc_rtx; 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; return NULL_RTX;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment