Commit 6fca22eb by Richard Henderson

i386.c (ix86_frame_pointer_required): New.

        * config/i386/i386.c (ix86_frame_pointer_required): New.
        (ix86_setup_frame_addresses): New.
        (struct machine_funciton): Add accesses_prev_frame.
        * config/i386/i386.h (FRAME_POINTER_REQUIRED): Call
        ix86_frame_pointer_required.
        (SUBTARGET_FRAME_POINTER_REQUIRED): New.
        (SETUP_FRAME_ADDRESSES): New.
        * config/i386/i386-protos.h: Update.
        * config/i386/sco5.h (SUBTARGET_FRAME_POINTER_REQUIRED): Rename
        from FRAME_POINTER_REQUIRED.
        * config/i386/svr3gas.h: Likewise.
        * config/i386/sysv3.h: Likewise.
        * config/i386/v3gas.h: Likewise.

From-SVN: r39545
parent 0020b823
2001-02-08 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (ix86_frame_pointer_required): New.
(ix86_setup_frame_addresses): New.
(struct machine_funciton): Add accesses_prev_frame.
* config/i386/i386.h (FRAME_POINTER_REQUIRED): Call
ix86_frame_pointer_required.
(SUBTARGET_FRAME_POINTER_REQUIRED): New.
(SETUP_FRAME_ADDRESSES): New.
* config/i386/i386-protos.h: Update.
* config/i386/sco5.h (SUBTARGET_FRAME_POINTER_REQUIRED): Rename
from FRAME_POINTER_REQUIRED.
* config/i386/svr3gas.h: Likewise.
* config/i386/sysv3.h: Likewise.
* config/i386/v3gas.h: Likewise.
2001-02-08 Richard Henderson <rth@redhat.com>
* config/sparc/sparc.c (function_arg_record_value_3): Fix
calculation of the number of integer registers required.
(function_arg_record_value): Likewise.
......
......@@ -25,6 +25,8 @@ extern void order_regs_for_local_alloc PARAMS ((void));
extern void optimization_options PARAMS ((int, int));
extern int ix86_can_use_return_insn_p PARAMS ((void));
extern int ix86_frame_pointer_required PARAMS ((void));
extern void ix86_setup_frame_addresses PARAMS ((void));
extern void ix86_asm_file_end PARAMS ((FILE *));
extern void load_pic_register PARAMS ((void));
......
......@@ -331,6 +331,7 @@ struct rtx_def *ix86_compare_op1 = NULL_RTX;
struct machine_function
{
rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
int accesses_prev_frame;
};
#define ix86_stack_locals (cfun->machine->stack_locals)
......@@ -1701,6 +1702,40 @@ ix86_can_use_return_insn_p ()
return tsize == 0 && nregs == 0;
}
/* Value should be nonzero if functions must have frame pointers.
Zero means the frame pointer need not be set up (and parms may
be accessed via the stack pointer) in functions that seem suitable. */
int
ix86_frame_pointer_required ()
{
/* If we accessed previous frames, then the generated code expects
to be able to access the saved ebp value in our frame. */
if (cfun->machine->accesses_prev_frame)
return 1;
/* Several x86 os'es need a frame pointer for other reasons,
usually pertaining to setjmp. */
if (SUBTARGET_FRAME_POINTER_REQUIRED)
return 1;
/* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER turns off
the frame pointer by default. Turn it back on now if we've not
got a leaf function. */
if (TARGET_OMIT_LEAF_FRAME_POINTER && ! leaf_function_p ())
return 1;
return 0;
}
/* Record that the current function accesses previous call frames. */
void
ix86_setup_frame_addresses ()
{
cfun->machine->accesses_prev_frame = 1;
}
static char pic_label_name[32];
/* This function generates code for -fpic that loads %ebx with
......
......@@ -852,7 +852,16 @@ extern int ix86_arch;
Zero means the frame pointer need not be set up (and parms
may be accessed via the stack pointer) in functions that seem suitable.
This is computed in `reload', in reload1.c. */
#define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ())
#define FRAME_POINTER_REQUIRED ix86_frame_pointer_required ()
/* Override this in other tm.h files to cope with various OS losage
requiring a frame pointer. */
#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED 0
#endif
/* Make sure we can access arbitrary call frames. */
#define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses ()
/* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM 16
......
......@@ -632,8 +632,8 @@ dtors_section () \
} \
}
#undef FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \
#undef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED \
((TARGET_ELF) ? 0 : \
(current_function_calls_setjmp || current_function_calls_longjmp))
......
......@@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */
Since a frame pointer will be required in such a function, it is OK
that the stack pointer is not restored. */
#undef FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \
#undef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED \
(current_function_calls_setjmp || current_function_calls_longjmp)
/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */
......
......@@ -78,8 +78,8 @@ Boston, MA 02111-1307, USA. */
Since a frame pointer will be required in such a function, it is OK
that the stack pointer is not restored. */
#undef FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \
#undef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED \
(current_function_calls_setjmp || current_function_calls_longjmp)
/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib. */
......
......@@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */
Since a frame pointer will be required in such a function, it is OK
that the stack pointer is not restored. */
#undef FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \
#undef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED \
(current_function_calls_setjmp || current_function_calls_longjmp)
/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */
......
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