Commit 918a6124 by Geoffrey Keating

[multiple changes]

2001-07-02  Geoffrey Keating  <geoffk@redhat.com>

	* doc/tm.texi (Frame Layout): Document STACK_PUSH_CODE.

	* expr.c (emit_move_insn_1): Deal with non-default
	STACK_PUSH_CODE.

	* expr.c (emit_single_push_insn): Fix warning.

2001-07-02  Toshiyasu Morita  <toshiyasu.morita@hsa.hitachi.com>

	* expr.c (emit_move_insn_1): Avoid modifying
	cfun->expr->x_stack_pointer when PUSH_ROUNDING is defined.

From-SVN: r43703
parent f4ef873c
2001-07-02 Geoffrey Keating <geoffk@redhat.com>
* doc/tm.texi (Frame Layout): Document STACK_PUSH_CODE.
* expr.c (emit_move_insn_1): Deal with non-default
STACK_PUSH_CODE.
* expr.c (emit_single_push_insn): Fix warning.
2001-07-02 Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
* expr.c (emit_move_insn_1): Avoid modifying
cfun->expr->x_stack_pointer when PUSH_ROUNDING is defined.
Mon Jul 2 15:33:31 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Mon Jul 2 15:33:31 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (adjust_address): New function. * emit-rtl.c (adjust_address): New function.
......
...@@ -2507,6 +2507,23 @@ When we say, ``define this macro if @dots{},'' it means that the ...@@ -2507,6 +2507,23 @@ When we say, ``define this macro if @dots{},'' it means that the
compiler checks this macro only with @code{#ifdef} so the precise compiler checks this macro only with @code{#ifdef} so the precise
definition used does not matter. definition used does not matter.
@findex STACK_PUSH_CODE
@item STACK_PUSH_CODE
This macro defines the operation used when something is pushed
on the stack. In RTL, a push operation will be
@code{(set (mem (STACK_PUSH_CODE (reg sp))) ...)}
The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC},
and @code{POST_INC}. Which of these is correct depends on
the stack direction and on whether the stack pointer points
to the last item on the stack or whether it points to the
space for the next item on the stack.
The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is
defined, which is almost always right, and @code{PRE_INC} otherwise,
which is often wrong.
@findex FRAME_GROWS_DOWNWARD @findex FRAME_GROWS_DOWNWARD
@item FRAME_GROWS_DOWNWARD @item FRAME_GROWS_DOWNWARD
Define this macro if the addresses of local variable slots are at negative Define this macro if the addresses of local variable slots are at negative
......
...@@ -2964,8 +2964,39 @@ emit_move_insn_1 (x, y) ...@@ -2964,8 +2964,39 @@ emit_move_insn_1 (x, y)
X with a reference to the stack pointer. */ X with a reference to the stack pointer. */
if (push_operand (x, GET_MODE (x))) if (push_operand (x, GET_MODE (x)))
{ {
anti_adjust_stack (GEN_INT (GET_MODE_SIZE (GET_MODE (x)))); rtx temp;
x = change_address (x, VOIDmode, stack_pointer_rtx); enum rtx_code code;
/* Do not use anti_adjust_stack, since we don't want to update
stack_pointer_delta. */
temp = expand_binop (Pmode,
#ifdef STACK_GROWS_DOWNWARD
sub_optab,
#else
add_optab,
#endif
stack_pointer_rtx,
GEN_INT
(PUSH_ROUNDING (GET_MODE_SIZE (GET_MODE (x)))),
stack_pointer_rtx,
0,
OPTAB_LIB_WIDEN);
if (temp != stack_pointer_rtx)
emit_move_insn (stack_pointer_rtx, temp);
code = GET_CODE (XEXP (x, 0));
/* Just hope that small offsets off SP are OK. */
if (code == POST_INC)
temp = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (-(HOST_WIDE_INT)
GET_MODE_SIZE (GET_MODE (x))));
else if (code == POST_DEC)
temp = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (GET_MODE_SIZE (GET_MODE (x))));
else
temp = stack_pointer_rtx;
x = change_address (x, VOIDmode, temp);
} }
#endif #endif
...@@ -3133,7 +3164,7 @@ emit_single_push_insn (mode, x, type) ...@@ -3133,7 +3164,7 @@ emit_single_push_insn (mode, x, type)
{ {
#ifdef PUSH_ROUNDING #ifdef PUSH_ROUNDING
rtx dest_addr; rtx dest_addr;
int rounded_size = PUSH_ROUNDING (GET_MODE_SIZE (mode)); unsigned rounded_size = PUSH_ROUNDING (GET_MODE_SIZE (mode));
rtx dest; rtx dest;
if (GET_MODE_SIZE (mode) == rounded_size) if (GET_MODE_SIZE (mode) == rounded_size)
...@@ -3142,7 +3173,7 @@ emit_single_push_insn (mode, x, type) ...@@ -3142,7 +3173,7 @@ emit_single_push_insn (mode, x, type)
{ {
#ifdef STACK_GROWS_DOWNWARD #ifdef STACK_GROWS_DOWNWARD
dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (-rounded_size)); GEN_INT (-(HOST_WIDE_INT)rounded_size));
#else #else
dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (rounded_size)); GEN_INT (rounded_size));
......
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