Commit a15b25dc by Richard Sandiford Committed by Richard Sandiford

poly_int: push_block/emit_push_insn

This patch changes the "extra" parameters to push_block and
emit_push_insn from int to poly_int64.

2017-12-21  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* expr.h (push_block, emit_push_insn): Change the "extra" parameter
	from HOST_WIDE_INT to poly_int64.
	* expr.c (push_block, emit_push_insn): Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r255918
parent f075bd95
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
* expr.h (push_block, emit_push_insn): Change the "extra" parameter
from HOST_WIDE_INT to poly_int64.
* expr.c (push_block, emit_push_insn): Likewise.
2017-12-21 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* function.h (frame_space): Change start and length from HOST_WIDE_INT * function.h (frame_space): Change start and length from HOST_WIDE_INT
to poly_int64. to poly_int64.
(get_frame_size): Return the size as a poly_int64 rather than a (get_frame_size): Return the size as a poly_int64 rather than a
...@@ -3867,19 +3867,19 @@ compress_float_constant (rtx x, rtx y) ...@@ -3867,19 +3867,19 @@ compress_float_constant (rtx x, rtx y)
otherwise, the padding comes at high addresses. */ otherwise, the padding comes at high addresses. */
rtx rtx
push_block (rtx size, int extra, int below) push_block (rtx size, poly_int64 extra, int below)
{ {
rtx temp; rtx temp;
size = convert_modes (Pmode, ptr_mode, size, 1); size = convert_modes (Pmode, ptr_mode, size, 1);
if (CONSTANT_P (size)) if (CONSTANT_P (size))
anti_adjust_stack (plus_constant (Pmode, size, extra)); anti_adjust_stack (plus_constant (Pmode, size, extra));
else if (REG_P (size) && extra == 0) else if (REG_P (size) && known_eq (extra, 0))
anti_adjust_stack (size); anti_adjust_stack (size);
else else
{ {
temp = copy_to_mode_reg (Pmode, size); temp = copy_to_mode_reg (Pmode, size);
if (extra != 0) if (maybe_ne (extra, 0))
temp = expand_binop (Pmode, add_optab, temp, temp = expand_binop (Pmode, add_optab, temp,
gen_int_mode (extra, Pmode), gen_int_mode (extra, Pmode),
temp, 0, OPTAB_LIB_WIDEN); temp, 0, OPTAB_LIB_WIDEN);
...@@ -3889,7 +3889,7 @@ push_block (rtx size, int extra, int below) ...@@ -3889,7 +3889,7 @@ push_block (rtx size, int extra, int below)
if (STACK_GROWS_DOWNWARD) if (STACK_GROWS_DOWNWARD)
{ {
temp = virtual_outgoing_args_rtx; temp = virtual_outgoing_args_rtx;
if (extra != 0 && below) if (maybe_ne (extra, 0) && below)
temp = plus_constant (Pmode, temp, extra); temp = plus_constant (Pmode, temp, extra);
} }
else else
...@@ -3897,7 +3897,7 @@ push_block (rtx size, int extra, int below) ...@@ -3897,7 +3897,7 @@ push_block (rtx size, int extra, int below)
if (CONST_INT_P (size)) if (CONST_INT_P (size))
temp = plus_constant (Pmode, virtual_outgoing_args_rtx, temp = plus_constant (Pmode, virtual_outgoing_args_rtx,
-INTVAL (size) - (below ? 0 : extra)); -INTVAL (size) - (below ? 0 : extra));
else if (extra != 0 && !below) else if (maybe_ne (extra, 0) && !below)
temp = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx, temp = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx,
negate_rtx (Pmode, plus_constant (Pmode, size, negate_rtx (Pmode, plus_constant (Pmode, size,
extra))); extra)));
...@@ -4274,7 +4274,7 @@ memory_load_overlap (rtx x, rtx y, HOST_WIDE_INT size) ...@@ -4274,7 +4274,7 @@ memory_load_overlap (rtx x, rtx y, HOST_WIDE_INT size)
bool bool
emit_push_insn (rtx x, machine_mode mode, tree type, rtx size, emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
unsigned int align, int partial, rtx reg, int extra, unsigned int align, int partial, rtx reg, poly_int64 extra,
rtx args_addr, rtx args_so_far, int reg_parm_stack_space, rtx args_addr, rtx args_so_far, int reg_parm_stack_space,
rtx alignment_pad, bool sibcall_p) rtx alignment_pad, bool sibcall_p)
{ {
...@@ -4362,9 +4362,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size, ...@@ -4362,9 +4362,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
/* Push padding now if padding above and stack grows down, /* Push padding now if padding above and stack grows down,
or if padding below and stack grows up. or if padding below and stack grows up.
But if space already allocated, this has already been done. */ But if space already allocated, this has already been done. */
if (extra && args_addr == 0 if (maybe_ne (extra, 0)
&& where_pad != PAD_NONE && where_pad != stack_direction) && args_addr == 0
anti_adjust_stack (GEN_INT (extra)); && where_pad != PAD_NONE
&& where_pad != stack_direction)
anti_adjust_stack (gen_int_mode (extra, Pmode));
move_by_pieces (NULL, xinner, INTVAL (size) - used, align, 0); move_by_pieces (NULL, xinner, INTVAL (size) - used, align, 0);
} }
...@@ -4485,9 +4487,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size, ...@@ -4485,9 +4487,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
/* Push padding now if padding above and stack grows down, /* Push padding now if padding above and stack grows down,
or if padding below and stack grows up. or if padding below and stack grows up.
But if space already allocated, this has already been done. */ But if space already allocated, this has already been done. */
if (extra && args_addr == 0 if (maybe_ne (extra, 0)
&& where_pad != PAD_NONE && where_pad != stack_direction) && args_addr == 0
anti_adjust_stack (GEN_INT (extra)); && where_pad != PAD_NONE
&& where_pad != stack_direction)
anti_adjust_stack (gen_int_mode (extra, Pmode));
/* If we make space by pushing it, we might as well push /* If we make space by pushing it, we might as well push
the real data. Otherwise, we can leave OFFSET nonzero the real data. Otherwise, we can leave OFFSET nonzero
...@@ -4536,9 +4540,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size, ...@@ -4536,9 +4540,11 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
/* Push padding now if padding above and stack grows down, /* Push padding now if padding above and stack grows down,
or if padding below and stack grows up. or if padding below and stack grows up.
But if space already allocated, this has already been done. */ But if space already allocated, this has already been done. */
if (extra && args_addr == 0 if (maybe_ne (extra, 0)
&& where_pad != PAD_NONE && where_pad != stack_direction) && args_addr == 0
anti_adjust_stack (GEN_INT (extra)); && where_pad != PAD_NONE
&& where_pad != stack_direction)
anti_adjust_stack (gen_int_mode (extra, Pmode));
#ifdef PUSH_ROUNDING #ifdef PUSH_ROUNDING
if (args_addr == 0 && PUSH_ARGS) if (args_addr == 0 && PUSH_ARGS)
...@@ -4583,8 +4589,8 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size, ...@@ -4583,8 +4589,8 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
} }
} }
if (extra && args_addr == 0 && where_pad == stack_direction) if (maybe_ne (extra, 0) && args_addr == 0 && where_pad == stack_direction)
anti_adjust_stack (GEN_INT (extra)); anti_adjust_stack (gen_int_mode (extra, Pmode));
if (alignment_pad && args_addr == 0) if (alignment_pad && args_addr == 0)
anti_adjust_stack (alignment_pad); anti_adjust_stack (alignment_pad);
......
...@@ -233,11 +233,11 @@ extern rtx emit_move_resolve_push (machine_mode, rtx); ...@@ -233,11 +233,11 @@ extern rtx emit_move_resolve_push (machine_mode, rtx);
/* Push a block of length SIZE (perhaps variable) /* Push a block of length SIZE (perhaps variable)
and return an rtx to address the beginning of the block. */ and return an rtx to address the beginning of the block. */
extern rtx push_block (rtx, int, int); extern rtx push_block (rtx, poly_int64, int);
/* Generate code to push something onto the stack, given its mode and type. */ /* Generate code to push something onto the stack, given its mode and type. */
extern bool emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int, extern bool emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int,
int, rtx, int, rtx, rtx, int, rtx, bool); int, rtx, poly_int64, rtx, rtx, int, rtx, bool);
/* Extract the accessible bit-range from a COMPONENT_REF. */ /* Extract the accessible bit-range from a COMPONENT_REF. */
extern void get_bit_range (poly_uint64_pod *, poly_uint64_pod *, tree, extern void get_bit_range (poly_uint64_pod *, poly_uint64_pod *, tree,
......
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