aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-09-14 17:02:23 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-09-14 17:02:23 -0400
commit8dfe5673a08e6d48ee0820c7669b8651e19e905f (patch)
tree1cd425566dda133f77983ee3cbc86690530910c0 /gcc
parent578b58f55e206934fd5df07a8840fb38652398b5 (diff)
downloadgcc-8dfe5673a08e6d48ee0820c7669b8651e19e905f.zip
gcc-8dfe5673a08e6d48ee0820c7669b8651e19e905f.tar.gz
gcc-8dfe5673a08e6d48ee0820c7669b8651e19e905f.tar.bz2
({function,ix86_expand}_prologue): Use __alloca to allocate stack if
desired and beyond CHECK_STACK_LIMIT in size. From-SVN: r12709
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/i386.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8c7569f..af2562b 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -45,6 +45,10 @@ Boston, MA 02111-1307, USA. */
even if the conditional was untrue. */
#endif
+#ifndef CHECK_STACK_LIMIT
+#define CHECK_STACK_LIMIT -1
+#endif
+
enum reg_mem /* Type of an operand for ix86_{binary,unary}_operator_ok */
{
reg_p,
@@ -1742,14 +1746,25 @@ function_prologue (file, size)
xops[0] = stack_pointer_rtx;
xops[1] = frame_pointer_rtx;
xops[2] = GEN_INT (tsize);
+
if (frame_pointer_needed)
{
output_asm_insn ("push%L1 %1", xops);
output_asm_insn (AS2 (mov%L0,%0,%1), xops);
}
- if (tsize)
+ if (tsize == 0)
+ ;
+ else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
output_asm_insn (AS2 (sub%L0,%2,%0), xops);
+ else
+ {
+ xops[3] = gen_rtx (REG, SImode, 0);
+ output_asm_insn (AS2 (mov%L0,%2,%3), xops);
+
+ xops[3] = gen_rtx (SYMBOL_REF, Pmode, "_alloca");
+ output_asm_insn (AS1 (call,%P3), xops);
+ }
/* Note If use enter it is NOT reversed args.
This one is not reversed from intel!!
@@ -1820,12 +1835,19 @@ ix86_expand_prologue ()
emit_move_insn (xops[1], xops[0]);
}
- if (tsize)
- emit_insn (gen_rtx (SET, SImode,
- xops[0],
- gen_rtx (MINUS, SImode,
- xops[0],
- xops[2])));
+ if (tsize == 0)
+ ;
+ else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
+ emit_insn (gen_subsi3 (xops[0], xops[0], xops[2]));
+ else
+ {
+ xops[3] = gen_rtx (REG, SImode, 0);
+ emit_move_insn (xops[3], xops[2]);
+ xops[3] = gen_rtx (MEM, FUNCTION_MODE,
+ gen_rtx (SYMBOL_REF, Pmode, "_alloca"));
+ emit_call_insn (gen_rtx (CALL, VOIDmode,
+ xops[3], const0_rtx));
+ }
/* Note If use enter it is NOT reversed args.
This one is not reversed from intel!!