alpha.c (alpha_expand_prologue): Use gen_adddi3 instead of emit_move_insn+plus_constant.

* alpha.c (alpha_expand_prologue): Use gen_adddi3 instead of
        emit_move_insn+plus_constant.  For NT, don't use the stack probe
        loop pointer to allocate stack space.
        * alpha.md (adddi3): Always use lda to set the stack pointer.

From-SVN: r26524
This commit is contained in:
Richard Henderson 1999-04-17 12:03:04 -07:00 committed by Richard Henderson
parent 01198c2f1f
commit f9d7e5cd9e
3 changed files with 70 additions and 20 deletions

View File

@ -1,3 +1,10 @@
Mon Apr 19 08:12:30 1999 Richard Henderson <rth@cygnus.com>
* alpha.c (alpha_expand_prologue): Use gen_adddi3 instead of
emit_move_insn+plus_constant. For NT, don't use the stack probe
loop pointer to allocate stack space.
* alpha.md (adddi3): Always use lda to set the stack pointer.
1999-04-17 20:11 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* c-aux-info.c, emit-rtl.c, explow.c, expmed.c, gcse.c,

View File

@ -3405,8 +3405,8 @@ alpha_expand_prologue ()
if (frame_size != 0)
{
FRP (emit_move_insn (stack_pointer_rtx,
plus_constant (stack_pointer_rtx, -frame_size)));
FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (-frame_size))));
}
}
else
@ -3423,7 +3423,7 @@ alpha_expand_prologue ()
rtx count = gen_rtx_REG (DImode, 23);
emit_move_insn (count, GEN_INT (blocks));
emit_move_insn (ptr, plus_constant (stack_pointer_rtx, 4096));
emit_insn (gen_adddi3 (ptr, stack_pointer_rtx, GEN_INT (4096)));
/* Because of the difficulty in emitting a new basic block this
late in the compilation, generate the loop as a single insn. */
@ -3436,18 +3436,38 @@ alpha_expand_prologue ()
emit_move_insn (last, const0_rtx);
}
ptr = emit_move_insn (stack_pointer_rtx, plus_constant (ptr, -leftover));
if (TARGET_WINDOWS_NT)
{
/* For NT stack unwind (done by 'reverse execution'), it's
not OK to take the result of a loop, even though the value
is already in ptr, so we reload it via a single operation
and add it to sp. */
/* This alternative is special, because the DWARF code cannot possibly
intuit through the loop above. So we invent this note it looks at
instead. */
RTX_FRAME_RELATED_P (ptr) = 1;
REG_NOTES (ptr)
= gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
gen_rtx_SET (VOIDmode, stack_pointer_rtx,
gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (-frame_size))),
REG_NOTES (ptr));
HOST_WIDE_INT lo, hi;
lo = ((-frame_size & 0xffff) ^ 0x8000) - 0x8000;
hi = -frame_size - lo;
FRP (emit_insn (gen_adddi3 (ptr, stack_pointer_rtx, GEN_INT (hi))));
FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, ptr, GEN_INT (lo))));
}
else
{
rtx seq;
seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr,
GEN_INT (-leftover)));
/* This alternative is special, because the DWARF code cannot
possibly intuit through the loop above. So we invent this
note it looks at instead. */
RTX_FRAME_RELATED_P (seq) = 1;
REG_NOTES (seq)
= gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
gen_rtx_SET (VOIDmode, stack_pointer_rtx,
gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (-frame_size))),
REG_NOTES (seq));
}
}
/* Cope with very large offsets to the register save area. */
@ -3463,7 +3483,7 @@ alpha_expand_prologue ()
bias = reg_offset, reg_offset = 0;
sa_reg = gen_rtx_REG (DImode, 24);
FRP (emit_move_insn (sa_reg, plus_constant (stack_pointer_rtx, bias)));
FRP (emit_insn (gen_adddi3 (sa_reg, stack_pointer_rtx, GEN_INT (bias))));
}
/* Save regs in stack order. Beginning with VMS PV. */

View File

@ -534,11 +534,34 @@
(plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
(match_operand:DI 2 "add_operand" "rI,O,K,L")))]
""
"@
addq %r1,%2,%0
subq %r1,%n2,%0
lda %0,%2(%r1)
ldah %0,%h2(%r1)")
"*
{
const char * const pattern[4] = {
\"addq %r1,%2,%0\",
\"subq %r1,%n2,%0\",
\"lda %0,%2(%r1)\",
\"ldah %0,%h2(%r1)\"
};
/* The NT stack unwind code can't handle a subq to adjust the stack
(that's a bug, but not one we can do anything about). As of NT4.0 SP3,
the exception handling code will loop if a subq is used and an
exception occurs.
The 19980616 change to emit prologues as RTL also confused some
versions of GDB, which also interprets prologues. This has been
fixed as of GDB 4.18, but it does not harm to unconditionally
use lda here. */
int which = which_alternative;
if (operands[0] == stack_pointer_rtx
&& GET_CODE (operands[2]) == CONST_INT
&& CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))
which = 2;
return pattern[which];
}")
;; Don't do this if we are adjusting SP since we don't want to do
;; it in two steps.