aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/rs6000/rs6000.c
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>1999-12-04 03:00:04 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>1999-12-04 03:00:04 +0000
commita157febd0ca69d5b4570fc714c141fd5da555a7a (patch)
tree9c9c8b5fa8e01f95d849e7b0f24402c7081b73d4 /gcc/config/rs6000/rs6000.c
parent3c12fcc27809a223032e1b0ad2beba1f6844a5c6 (diff)
downloadgcc-a157febd0ca69d5b4570fc714c141fd5da555a7a.zip
gcc-a157febd0ca69d5b4570fc714c141fd5da555a7a.tar.gz
gcc-a157febd0ca69d5b4570fc714c141fd5da555a7a.tar.bz2
c-common.c (enum attrs): Add A_NO_LIMIT_STACK.
* c-common.c (enum attrs): Add A_NO_LIMIT_STACK. (init_attributes): Add A_NO_LIMIT_STACK. (decl_attributes): Handle A_NO_LIMIT_STACK. * c-decl.c (duplicate_decls): Handle DECL_NO_LIMIT_STACK. * explow.c (allocate_dynamic_stack_space) [!HAVE_allocate_stack]: Handle stack bounds checking. * flags.h (flag_stack_check): Use the word 'probe' rather than 'check', because the flag doesn't actually cause any checking to be done. * function.c (expand_function_start): Set current_function_limit_stack. * function.h (struct function): Add limit_stack. (current_function_limit_stack): Define. * invoke.texi (Code Gen Options): Document new options. * rtl.h: Declare stack_limit_rtx. * toplev.c (stack_limit_rtx): New variable. (decode_f_option): Handle new options -fstack-limit-register=REG, -fstack-limit-symbol=IDENT, -fno-stack-limit. (main): Add stack_limit_rtx as GC root. * tree.h (DECL_NO_LIMIT_STACK): New macro. (struct tree_decl): New member no_limit_stack. * config/rs6000/rs6000.c (rs6000_allocate_stack_space): Handle stack_limit_rtx. * config/rs6000/rs6000.md (allocate_stack): Handle stack_limit_rtx. (conditional_trap+1): Get new mnemonic correct. (conditional_trap+2): New pattern for DImode traps. * config/m68k/m68k.c (output_function_prologue): Handle stack_limit_rtx. * config/m68k/m68k.md (trap): New insn. (conditional_trap): New insn. * md.texi (Standard Names): Document `trap' and `conditional_trap'. * optabs.c (gen_cond_trap): Use start_sequence()/end_sequence() so a cc0 setter doesn't get emitted at some random place in the function. * config/i960/i960.md (trap): New insn. (conditional_trap): New expander. (conditional_trap+1, conditional_trap+2): New insns for signed and unsigned cases. * config/i960/i960.c (i960_function_prologue): Use STARTING_FRAME_OFFSET. Handle stack_limit_rtx. Co-Authored-By: Greg McGary <gkm@gnu.org> From-SVN: r30771
Diffstat (limited to 'gcc/config/rs6000/rs6000.c')
-rw-r--r--gcc/config/rs6000/rs6000.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 250c8cd..a8db6d0 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4176,6 +4176,53 @@ rs6000_allocate_stack_space (file, size, copy_r12)
int copy_r12;
{
int neg_size = -size;
+
+ if (current_function_limit_stack)
+ {
+ if (REG_P (stack_limit_rtx)
+ && REGNO (stack_limit_rtx) > 1
+ && REGNO (stack_limit_rtx) <= 31)
+ {
+ if (size <= 32767)
+ asm_fprintf (file, "\t{cal %s,%d(%s)|addi %s,%s,%d}\n",
+ reg_names[0], reg_names[REGNO (stack_limit_rtx)],
+ size);
+ else
+ {
+ asm_fprintf (file, "\t{cau|addis} %s,%s,0x%x\n",
+ reg_names[0], reg_names[REGNO (stack_limit_rtx)],
+ ((size + 0x8000) >> 16) & 0xffff);
+ asm_fprintf (file, "\t{ai|addic} %s,%s,%d\n",
+ reg_names[0], reg_names[0],
+ (size & 0x7fff) | -(size & 0x8000));
+ }
+ if (TARGET_32BIT)
+ asm_fprintf (file, "\t{t|tw}llt %s,%s\n",
+ reg_names[1], reg_names[0]);
+ else
+ asm_fprintf (file, "\ttdllt %s,%s\n", reg_names[1], reg_names[0]);
+ }
+ else if (GET_CODE (stack_limit_rtx) == SYMBOL_REF
+ && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))
+ {
+ char * l_name = XSTR (stack_limit_rtx, 0);
+ const char * stripped_name;
+
+ STRIP_NAME_ENCODING (stripped_name, l_name);
+ asm_fprintf (file, "\t{liu|lis} %s,%s@ha+%d\n",
+ reg_names[0], stripped_name, size);
+ asm_fprintf (file, "\t{ai|addic} %s,%s,%s@l+%d\n",
+ reg_names[0], reg_names[0], stripped_name, size);
+ if (TARGET_32BIT)
+ asm_fprintf (file, "\t{t|tw}llt %s,%s\n",
+ reg_names[1], reg_names[0]);
+ else
+ asm_fprintf (file, "\ttdllt %s,%s\n", reg_names[1], reg_names[0]);
+ }
+ else
+ warning ("stack limit expression is not supported");
+ }
+
if (TARGET_UPDATE)
{
if (size < 32767)