+2009-06-30 Anatoly Sokolov <aesok@post.ru>
+
+ * target.h (struct gcc_target): Add frame_pointer_required field.
+ * target-def.h (TARGET_FRAME_POINTER_REQUIRED): New.
+ (TARGET_INITIALIZER): Use TARGET_FRAME_POINTER_REQUIRED.
+ * ira.c (setup_eliminable_regset): Use frame_pointer_required target
+ hook.
+ * reload1.c (update_eliminables): (Ditto.).
+ * gcc/system.h (FRAME_POINTER_REQUIRED): Poison.
+ * doc/tm.texi (FRAME_POINTER_REQUIRED): Revise documentation.
+ (INITIAL_FRAME_POINTER_OFFSET): (Ditto.).
+
+ * config/arc/arc.h (FRAME_POINTER_REQUIRED): Remove macro.
+
+ * config/arm/arm.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/arm/arm.c (TARGET_FRAME_POINTER_REQUIRED): Define.
+ (arm_frame_pointer_required): New function.
+
+ * config/avr/avr.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/avr/avr.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (avr_frame_pointer_required_p): Declare as static.
+ * config/avr/avr-protos.h (avr_frame_pointer_required_p): Remove.
+
+ * config/bfin/bfin.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/bfin/bfin.c (TARGET_FRAME_POINTER_REQUIRED): Define.
+ (bfin_frame_pointer_required): Make as static, change return type
+ to bool.
+ * config/bfin/bfin-protos.h (bfin_frame_pointer_required): Remove.
+
+ * config/cris/cris.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/cris/cris.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (cris_frame_pointer_required): New function.
+
+ * config/crx/crx.h (FRAME_POINTER_REQUIRED): Remove macro.
+
+ * config/fr30/fr30.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/fr30/fr30.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (fr30_frame_pointer_required): New function.
+
+ * config/frv/frv.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/frv/frv.c (TARGET_FRAME_POINTER_REQUIRED): Define.
+ (frv_frame_pointer_required): Make as static, change return type
+ to bool.
+ * config/bfin/bfin-protos.h (frv_frame_pointer_required): Remove.
+
+ * config/i386/i386.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/i386/i386.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (ix86_frame_pointer_required): Make as static, change return type to
+ bool.
+ * config/i386/i386-protos.h (ix86_frame_pointer_required): Remove.
+
+ * config/m32c/m32c.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/m32c/m32c.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+
+ * config/m32r/m32r.h (FRAME_POINTER_REQUIRED): Remove macro.
+
+ * config/mcore/mcore.h (CAN_ELIMINATE): Remove macro.
+
+ * config/mep/mep.h (FRAME_POINTER_REQUIRED): Remove macro.
+
+ * config/mips/mips.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/mips/mips.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (mips_frame_pointer_required): Make as static.
+ * config/mips/mips-protos.h (mips_frame_pointer_required): Remove.
+
+ * config/mmix/mmix.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/mmix/mmix.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (mmix_frame_pointer_required): Mew function.
+
+ * config/moxie/moxie.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/moxie/moxie.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+
+ * config/pa/pa.h (FRAME_POINTER_REQUIRED): Remove macro.
+
+ * config/score/score.h (FRAME_POINTER_REQUIRED): Remove macro.
+
+ * config/sh/sh.h (CAN_ELIMINATE): Remove macro.
+
+ * config/sparc/sparc.h (FRAME_POINTER_REQUIRED): Remove macro.
+ (CAN_ELIMINATE): Redefine.
+ * config/sparc/sparc.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
+ (sparc_frame_pointer_required): New function.
+ (sparc_can_eliminate): New function.
+ * config/sparc/sparc-protos.h (sparc_can_eliminate): Declare.
+
+ * config/vax/vax.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/vax/vax.c (TARGET_FRAME_POINTER_REQUIRED): Define.
+
+ * config/xtensa/xtensa.h (FRAME_POINTER_REQUIRED): Remove macro.
+ * config/xtensa/xtensa.c (TARGET_FRAME_POINTER_REQUIRED): Define.
+ (xtensa_frame_pointer_required): Make as static, change return type
+ to bool.
+ * config/xtensa/xtensa-protos.h (xtensa_frame_pointer_required):
+ Remove.
+
2009-06-29 Olatunji Ruwase <tjruwase@google.com>
* doc/plugins.texi: Document PLUGIN_START_UNIT.
/* Definitions of target machine for GNU compiler, Argonaut ARC cpu.
Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
- 2007, 2008 Free Software Foundation, Inc.
+ 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GCC.
not be a register used by the prologue. */
#define STATIC_CHAIN_REGNUM 24
-/* A C expression which is nonzero if a function must have and use a
- frame pointer. This expression is evaluated in the reload pass.
- If its value is nonzero the function will have a frame pointer. */
-#define FRAME_POINTER_REQUIRED \
-(cfun->calls_alloca)
-
/* C statement to store the difference between the frame pointer
and the stack pointer values immediately after the function prologue. */
#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
static tree arm_promoted_type (const_tree t);
static tree arm_convert_to_type (tree type, tree expr);
static bool arm_scalar_mode_supported_p (enum machine_mode);
+static bool arm_frame_pointer_required (void);
+
\f
/* Table of machine attributes. */
static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P arm_scalar_mode_supported_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED arm_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
/* Obstack for minipool constant handling. */
flag_section_anchors = 2;
}
+/* Implement TARGET_FRAME_POINTER_REQUIRED. */
+
+bool
+arm_frame_pointer_required (void)
+{
+ return (cfun->has_nonlocal_label
+ || SUBTARGET_FRAME_POINTER_REQUIRED
+ || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()));
+}
+
#include "gt-arm.h"
#define SUBTARGET_FRAME_POINTER_REQUIRED 0
#endif
-#define FRAME_POINTER_REQUIRED \
- (cfun->has_nonlocal_label \
- || SUBTARGET_FRAME_POINTER_REQUIRED \
- || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()))
-
/* Return number of consecutive hard regs needed starting at reg REGNO
to hold something of mode MODE.
This is ordinarily the length in words of a value of mode MODE
extern bool class_likely_spilled_p (int c);
extern enum reg_class avr_regno_reg_class (int r);
extern enum reg_class avr_reg_class_from_letter (int c);
-extern bool avr_frame_pointer_required_p (void);
extern void asm_globalize_label (FILE *file, const char *name);
extern void avr_asm_declare_function_name (FILE *, const char *, tree);
extern void order_regs_for_local_alloc (void);
static rtx avr_builtin_setjmp_frame_value (void);
static bool avr_hard_regno_scratch_ok (unsigned int);
static unsigned int avr_case_values_threshold (void);
+static bool avr_frame_pointer_required_p (void);
/* Allocate registers from r25 to r8 for parameters for function calls. */
#define FIRST_CUM_REG 26
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P avr_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED avr_frame_pointer_required_p
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
void
#define STATIC_CHAIN_REGNUM 2
-#define FRAME_POINTER_REQUIRED avr_frame_pointer_required_p()
-
/* Offset from the frame pointer register value to the top of the stack. */
#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
/* Prototypes for Blackfin functions used in the md file & elsewhere.
- Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU CC.
extern bool bfin_legitimate_constant_p (rtx);
extern int hard_regno_mode_ok (int, Mmode);
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);
-extern int bfin_frame_pointer_required (void);
extern HOST_WIDE_INT bfin_initial_elimination_offset (int, int);
extern int effective_address_32bit_p (rtx, Mmode);
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
+static bool
bfin_frame_pointer_required (void)
{
e_funkind fkind = funkind (TREE_TYPE (current_function_decl));
if (fkind != SUBROUTINE)
- return 1;
+ return true;
/* We turn on -fomit-frame-pointer if -momit-leaf-frame-pointer is used,
so we have to override it for non-leaf functions. */
if (TARGET_OMIT_LEAF_FRAME_POINTER && ! current_function_is_leaf)
- return 1;
+ return true;
- return 0;
+ return false;
}
/* Return the number of registers pushed during the prologue. */
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P bfin_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED bfin_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Definitions for the Blackfin port.
- Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Analog Devices.
This file is part of GCC.
found in the variable crtl->outgoing_args_size. */
#define ACCUMULATE_OUTGOING_ARGS 1
-/* 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.
- This is computed in `reload', in reload1.c.
-*/
-#define FRAME_POINTER_REQUIRED (bfin_frame_pointer_required ())
-
/*#define DATA_ALIGNMENT(TYPE, BASIC-ALIGN) for arrays.. */
/* If defined, a C expression to compute the alignment for a local
/* Definitions for GCC. Part of the machine description for CRIS.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008 Free Software Foundation, Inc.
+ 2008, 2009 Free Software Foundation, Inc.
Contributed by Axis Communications. Written by Hans-Peter Nilsson.
This file is part of GCC.
static bool cris_handle_option (size_t, const char *, int);
+static bool cris_frame_pointer_required (void);
+
/* This is the parsed result of the "-max-stack-stackframe=" option. If
it (still) is zero, then there was no such option given. */
int cris_max_stackframe = 0;
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | CRIS_SUBTARGET_DEFAULT)
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION cris_handle_option
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED cris_frame_pointer_required
struct gcc_target targetm = TARGET_INITIALIZER;
clobbers);
}
+/* Implement TARGET_FRAME_POINTER_REQUIRED.
+
+ Really only needed if the stack frame has variable length (alloca
+ or variable sized local arguments (GNU C extension). See PR39499 and
+ PR38609 for the reason this isn't just 0. */
+
+bool
+cris_frame_pointer_required (void)
+{
+ return !current_function_sp_is_unchanging;
+}
+
#if 0
/* Various small functions to replace macros. Only called from a
debugger. They might collide with gcc functions or system functions,
/* Node: Elimination */
-/* Really only needed if the stack frame has variable length (alloca
- or variable sized local arguments (GNU C extension). See PR39499 and
- PR38609 for the reason this isn't just 0. */
-#define FRAME_POINTER_REQUIRED (!current_function_sp_is_unchanging)
-
#define ELIMINABLE_REGS \
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
/* Definitions of target machine for GNU compiler, for CRX.
Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
#define FIRST_PARM_OFFSET(FNDECL) 0
-#define FRAME_POINTER_REQUIRED (cfun->calls_alloca)
-
#define ELIMINABLE_REGS \
{ \
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
/* FR30 specific functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
static bool fr30_must_pass_in_stack (enum machine_mode, const_tree);
static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
-
+static bool fr30_frame_pointer_required (void);
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
#define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM))
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK fr30_must_pass_in_stack
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED fr30_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
/* Returns the number of bytes offset between FROM_REG and TO_REG
return val;
}
+/* Implement TARGET_FRAME_POINTER_REQUIRED. */
+
+bool
+fr30_frame_pointer_required (void)
+{
+ return (flag_omit_frame_pointer == 0 || crtl->args.pretend_args_size > 0);
+}
+
/*}}}*/
/* Local Variables: */
/* folded-file: t */
/*{{{ Comment. */
/* Definitions of FR30 target.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007, 2008
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
/*}}}*/ \f
/*{{{ Eliminating the Frame Pointer and the Arg Pointer. */
-/* A C expression which is nonzero if a function must have and use a frame
- pointer. This expression is evaluated in the reload pass. If its value is
- nonzero the function will have a frame pointer.
-
- The expression can in principle examine the current function and decide
- according to the facts, but on most machines the constant 0 or the constant
- 1 suffices. Use 0 when the machine allows code to be generated with no
- frame pointer, and doing so saves some time or space. Use 1 when there is
- no possible advantage to avoiding a frame pointer.
-
- In certain cases, the compiler does not know how to produce valid code
- without a frame pointer. The compiler recognizes those cases and
- automatically gives the function a frame pointer regardless of what
- `FRAME_POINTER_REQUIRED' says. You don't need to worry about them.
-
- In a function that does not require a frame pointer, the frame pointer
- register can be allocated for ordinary usage, unless you mark it as a fixed
- register. See `FIXED_REGISTERS' for more information. */
-/* #define FRAME_POINTER_REQUIRED 0 */
-#define FRAME_POINTER_REQUIRED \
- (flag_omit_frame_pointer == 0 || crtl->args.pretend_args_size > 0)
-
/* If defined, this macro specifies a table of register pairs used to eliminate
unneeded registers that point into the stack frame. If it is not defined,
the only elimination attempted by the compiler is to replace references to
/* Frv prototypes.
- Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
extern void frv_conditional_register_usage (void);
extern frv_stack_t *frv_stack_info (void);
extern void frv_debug_stack (frv_stack_t *);
-extern int frv_frame_pointer_required (void);
extern int frv_initial_elimination_offset (int, int);
#ifdef RTX_CODE
/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
- 2008 Free Software Foundation, Inc.
+ 2008, 2009 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GCC.
static bool frv_secondary_reload (bool, rtx, enum reg_class,
enum machine_mode,
secondary_reload_info *);
+static bool frv_frame_pointer_required (void);
\f
/* Allow us to easily change the default for -malloc-cc. */
#ifndef DEFAULT_NO_ALLOC_CC
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P frv_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED frv_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
#define FRV_SYMBOL_REF_TLS_P(RTX) \
}
\f
-/* A C expression which is nonzero if a function must have and use a frame
- pointer. This expression is evaluated in the reload pass. If its value is
- nonzero the function will have a frame pointer.
-
- The expression can in principle examine the current function and decide
- according to the facts, but on most machines the constant 0 or the constant
- 1 suffices. Use 0 when the machine allows code to be generated with no
- frame pointer, and doing so saves some time or space. Use 1 when there is
- no possible advantage to avoiding a frame pointer.
-
- In certain cases, the compiler does not know how to produce valid code
- without a frame pointer. The compiler recognizes those cases and
- automatically gives the function a frame pointer regardless of what
- `FRAME_POINTER_REQUIRED' says. You don't need to worry about them.
-
- In a function that does not require a frame pointer, the frame pointer
- register can be allocated for ordinary usage, unless you mark it as a fixed
- register. See `FIXED_REGISTERS' for more information. */
/* On frv, create a frame whenever we need to create stack. */
-int
+static bool
frv_frame_pointer_required (void)
{
/* If we forgoing the usual linkage requirements, we only need
return !current_function_sp_is_unchanging;
if (! current_function_is_leaf)
- return TRUE;
+ return true;
if (get_frame_size () != 0)
- return TRUE;
+ return true;
if (cfun->stdarg)
- return TRUE;
+ return true;
if (!current_function_sp_is_unchanging)
- return TRUE;
+ return true;
if (!TARGET_FDPIC && flag_pic && crtl->uses_pic_offset_table)
- return TRUE;
+ return true;
if (profile_flag)
- return TRUE;
+ return true;
if (cfun->machine->frame_needed)
- return TRUE;
+ return true;
- return FALSE;
+ return false;
}
\f
/* Target macros for the FRV port of GCC.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Red Hat Inc.
\f
/* Eliminating the Frame Pointer and the Arg Pointer. */
-/* A C expression which is nonzero if a function must have and use a frame
- pointer. This expression is evaluated in the reload pass. If its value is
- nonzero the function will have a frame pointer.
-
- The expression can in principle examine the current function and decide
- according to the facts, but on most machines the constant 0 or the constant
- 1 suffices. Use 0 when the machine allows code to be generated with no
- frame pointer, and doing so saves some time or space. Use 1 when there is
- no possible advantage to avoiding a frame pointer.
-
- In certain cases, the compiler does not know how to produce valid code
- without a frame pointer. The compiler recognizes those cases and
- automatically gives the function a frame pointer regardless of what
- `FRAME_POINTER_REQUIRED' says. You don't need to worry about them.
-
- In a function that does not require a frame pointer, the frame pointer
- register can be allocated for ordinary usage, unless you mark it as a fixed
- register. See `FIXED_REGISTERS' for more information. */
-#define FRAME_POINTER_REQUIRED frv_frame_pointer_required ()
-
/* If defined, this macro specifies a table of register pairs used to eliminate
unneeded registers that point into the stack frame. If it is not defined,
the only elimination attempted by the compiler is to replace references to
/* Definitions of target machine for GCC for IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
extern void optimization_options (int, int);
extern int ix86_can_use_return_insn_p (void);
-extern int ix86_frame_pointer_required (void);
extern void ix86_setup_frame_addresses (void);
extern void ix86_file_end (void);
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
+static bool
ix86_frame_pointer_required (void)
{
/* 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;
+ return true;
/* Several x86 os'es need a frame pointer for other reasons,
usually pertaining to setjmp. */
if (SUBTARGET_FRAME_POINTER_REQUIRED)
- return 1;
+ return true;
/* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER turns off
the frame pointer by default. Turn it back on now if we've not
if (TARGET_OMIT_LEAF_FRAME_POINTER
&& (!current_function_is_leaf
|| ix86_current_function_calls_tls_descriptor))
- return 1;
+ return true;
if (crtl->profile)
- return 1;
+ return true;
- return 0;
+ return false;
}
/* Record that the current function accesses previous call frames. */
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P ix86_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED ix86_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
#include "gt-i386.h"
#define FIRST_REX_SSE_REG (LAST_REX_INT_REG + 1)
#define LAST_REX_SSE_REG (FIRST_REX_SSE_REG + 7)
-/* 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.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED ix86_frame_pointer_required ()
-
/* Override this in other tm.h files to cope with various OS lossage
requiring a frame pointer. */
#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
#undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO m32c_encode_section_info
+/* If the frame pointer isn't used, we detect it manually. But the
+ stack pointer doesn't have as flexible addressing as the frame
+ pointer, so we always assume we have it. */
+
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
+
/* The Global `targetm' Variable. */
struct gcc_target targetm = TARGET_INITIALIZER;
/* Eliminating Frame Pointer and Arg Pointer */
-/* If the frame pointer isn't used, we detect it manually. But the
- stack pointer doesn't have as flexible addressing as the frame
- pointer, so we always assume we have it. */
-#define FRAME_POINTER_REQUIRED 1
-
#define ELIMINABLE_REGS \
{{AP_REGNO, SP_REGNO}, \
{AP_REGNO, FB_REGNO}, \
\f
/* Eliminating the frame and arg pointers. */
-/* A C expression which is nonzero if a function must have and use a
- frame pointer. This expression is evaluated in the reload pass.
- If its value is nonzero the function will have a frame pointer. */
-#define FRAME_POINTER_REQUIRED cfun->calls_alloca
-
#if 0
/* C statement to store the difference between the frame pointer
and the stack pointer values immediately after the function prologue.
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},}
-/* Given FROM and TO register numbers, say whether this elimination
- is allowed. */
-#define CAN_ELIMINATE(FROM, TO) \
- (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))
-
/* Define the offset between two registers, one to be eliminated, and the other
its replacement, at the start of a routine. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
\f
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{ \
{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
/* Prototypes of target machine for GNU compiler. MIPS version.
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by A. Lichnewsky (lich@inria.inria.fr).
Changed by Michael Meissner (meissner@osf.org).
extern bool mips_small_data_pattern_p (rtx);
extern rtx mips_rewrite_small_data (rtx);
-extern bool mips_frame_pointer_required (void);
extern HOST_WIDE_INT mips_initial_elimination_offset (int, int);
extern rtx mips_return_addr (int, rtx);
extern enum mips_loadgp_style mips_current_loadgp_style (void);
return TARGET_NEWABI ? LOADGP_NEWABI : LOADGP_OLDABI;
}
-/* Implement FRAME_POINTER_REQUIRED. */
+/* Implement TARGET_FRAME_POINTER_REQUIRED. */
-bool
+static bool
mips_frame_pointer_required (void)
{
/* If the function contains dynamic stack allocations, we need to
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P mips_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED mips_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
#include "gt-mips.h"
#define HARD_FRAME_POINTER_REGNUM \
(TARGET_MIPS16 ? GP_REG_FIRST + 17 : GP_REG_FIRST + 30)
-#define FRAME_POINTER_REQUIRED (mips_frame_pointer_required ())
-
/* Register in which static-chain is passed to a function. */
#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 15)
/* Definitions of target machine for GNU compiler, for MMIX.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson (hp@bitrange.com)
static rtx mmix_struct_value_rtx (tree, int);
static bool mmix_pass_by_reference (CUMULATIVE_ARGS *,
enum machine_mode, const_tree, bool);
+static bool mmix_frame_pointer_required (void);
/* Target structure macros. Listed by node. See `Using and Porting GCC'
for a general description. */
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P mmix_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED mmix_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Functions that are expansions for target macros.
return gen_rtx_REG (Pmode, MMIX_STRUCT_VALUE_REGNUM);
}
+/* Worker function for TARGET_FRAME_POINTER_REQUIRED.
+
+ FIXME: Is this requirement built-in? Anyway, we should try to get rid
+ of it; we can deduce the value. */
+
+bool
+mmix_frame_pointer_required (void)
+{
+ return (cfun->has_nonlocal_label);
+}
+
/*
* Local variables:
* eval: (c-set-style "gnu")
/* Node: Elimination */
-/* FIXME: Is this requirement built-in? Anyway, we should try to get rid
- of it; we can deduce the value. */
-#define FRAME_POINTER_REQUIRED cfun->has_nonlocal_label
/* The frame-pointer is stored in a location that either counts to the
offset of incoming parameters, or that counts to the offset of the
#undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE moxie_function_value
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-moxie.h"
an immediate operand on the target machine. */
#define LEGITIMATE_CONSTANT_P(X) 1
-#define FRAME_POINTER_REQUIRED 1
-
/* A C expression that is 1 if the RTX X is a constant which is a
valid address. */
#define CONSTANT_ADDRESS_P(X) CONSTANT_P(X)
/* Definitions of target machine for GNU compiler, for the HP Spectrum.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support
and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
Software Science at the University of Utah.
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM 3
-/* Value should be nonzero if functions must have frame pointers. */
-#define FRAME_POINTER_REQUIRED \
- (cfun->calls_alloca)
-
/* Don't allow hard registers to be renamed into r2 unless r2
is already live or already being saved (due to eh). */
#define STATIC_CHAIN_REGNUM 23
/* Elimination Frame Pointer and Arg Pointer */
-/* 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.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED cfun->calls_alloca
#define ELIMINABLE_REGS \
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},}
-/* Given FROM and TO register numbers, say whether this elimination
- is allowed. */
-#define CAN_ELIMINATE(FROM, TO) \
- (!((FROM) == HARD_FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))
-
/* Define the offset between two registers, one to be eliminated, and the other
its replacement, at the start of a routine. */
/* Prototypes of target machine for SPARC.
- Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com).
64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
extern void sparc_profile_hook (int);
extern void sparc_override_options (void);
extern void sparc_output_scratch_registers (FILE *);
+extern bool sparc_can_eliminate (const int, const int);
#ifdef RTX_CODE
extern enum machine_mode select_cc_mode (enum rtx_code, rtx, rtx);
static void sparc_dwarf_handle_frame_unspec (const char *, rtx, int);
static void sparc_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static void sparc_file_end (void);
+static bool sparc_frame_pointer_required (void);
#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
static const char *sparc_mangle_type (const_tree);
#endif
#undef TARGET_ASM_FILE_END
#define TARGET_ASM_FILE_END sparc_file_end
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED sparc_frame_pointer_required
+
#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
#undef TARGET_MANGLE_TYPE
#define TARGET_MANGLE_TYPE sparc_mangle_type
emit_move_insn (result, gen_lowpart (GET_MODE (result), res));
}
+/* Implement TARGET_FRAME_POINTER_REQUIRED. */
+
+bool
+sparc_frame_pointer_required (void)
+{
+ return !(leaf_function_p () && only_leaf_regs_used ());
+}
+
+/* The way this is structured, we can't eliminate SFP in favor of SP
+ if the frame pointer is required: we want to use the SFP->HFP elimination
+ in that case. But the test in update_eliminables doesn't know we are
+ assuming below that we only do the former elimination. */
+
+bool
+sparc_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
+{
+ return (to == HARD_FRAME_POINTER_REGNUM
+ || !targetm.frame_pointer_required ());
+}
+
#include "gt-sparc.h"
} \
} while (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.
- Used in flow.c, global.c, ra.c and reload1.c. */
-#define FRAME_POINTER_REQUIRED \
- (! (leaf_function_p () && only_leaf_regs_used ()))
-
/* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
if the frame pointer is required: we want to use the SFP->HFP elimination
in that case. But the test in update_eliminables doesn't know we are
assuming below that we only do the former elimination. */
-#define CAN_ELIMINATE(FROM, TO) \
- ((TO) == HARD_FRAME_POINTER_REGNUM || !FRAME_POINTER_REQUIRED)
+#define CAN_ELIMINATE(FROM, TO) sparc_can_eliminate((FROM), (TO))
/* We always pretend that this is a leaf function because if it's not,
there's no point in trying to eliminate the frame pointer. If it
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P vax_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
/* Set global variables as needed for the options enabled. */
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM VAX_FP_REGNUM
-/* 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.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
/* Offset from the frame pointer register value to the top of stack. */
#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
/* Prototypes of target machine for GNU compiler for Xtensa.
- Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
extern int xtensa_dbx_register_number (int);
extern void override_options (void);
extern long compute_frame_size (int);
-extern int xtensa_frame_pointer_required (void);
extern void xtensa_expand_prologue (void);
extern void order_regs_for_local_alloc (void);
extern void xtensa_trampoline_template (FILE *);
/* Subroutines for insn-output.c for Tensilica's Xtensa architecture.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
static tree xtensa_fold_builtin (tree, tree, bool);
static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static void xtensa_va_start (tree, rtx);
+static bool xtensa_frame_pointer_required (void);
static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
REG_ALLOC_ORDER;
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P xtensa_legitimate_address_p
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED xtensa_frame_pointer_required
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
void
xtensa_setup_frame_addresses (void)
{
- /* Set flag to cause FRAME_POINTER_REQUIRED to be set. */
+ /* Set flag to cause TARGET_FRAME_POINTER_REQUIRED to return true. */
cfun->machine->accesses_prev_frame = 1;
emit_library_call
}
-int
+bool
xtensa_frame_pointer_required (void)
{
/* The code to expand builtin_frame_addr and builtin_return_addr
This function is derived from the i386 code. */
if (cfun->machine->accesses_prev_frame)
- return 1;
+ return true;
- return 0;
+ return false;
}
either the stack pointer or the hard frame pointer. */
#define FRAME_POINTER_REGNUM (GP_REG_FIRST + 16)
-/* 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.
- This is computed in 'reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED xtensa_frame_pointer_required ()
-
/* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM (GP_REG_FIRST + 17)
#define GO_IF_MODE_DEPENDENT_ADDRESS(X, WIN)
#endif
-#ifndef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED false
-#endif
-
#endif /* ! GCC_DEFAULTS_H */
@c prevent bad page break with this line
This is about eliminating the frame pointer and arg pointer.
-@defmac FRAME_POINTER_REQUIRED
-A C expression which is @code{true} if a function must have and use a frame
-pointer. This expression is evaluated in the reload pass. If its value is
-@code{true} the function will have a frame pointer.
+@deftypefn {Target Hook} bool TARGET_FRAME_POINTER_REQUIRED (void)
+This target hook should return @code{true} if a function must have and use
+a frame pointer. This target hook is called in the reload pass. If its return
+value is @code{true} the function will have a frame pointer.
-The expression can in principle examine the current function and decide
+This target hook can in principle examine the current function and decide
according to the facts, but on most machines the constant @code{false} or the
constant @code{true} suffices. Use @code{false} when the machine allows code
to be generated with no frame pointer, and doing so saves some time or space.
In certain cases, the compiler does not know how to produce valid code
without a frame pointer. The compiler recognizes those cases and
automatically gives the function a frame pointer regardless of what
-@code{FRAME_POINTER_REQUIRED} says. You don't need to worry about
+@code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry about
them.
In a function that does not require a frame pointer, the frame pointer
register can be allocated for ordinary usage, unless you mark it as a
fixed register. See @code{FIXED_REGISTERS} for more information.
-Default value is @code{false}.
-@end defmac
+Default return value is @code{false}.
+@end deftypefn
@findex get_frame_size
@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
need not be defined. Otherwise, it must be defined even if
-@code{FRAME_POINTER_REQUIRED} is defined to always be true; in that
+@code{TARGET_FRAME_POINTER_REQUIRED} is always return true; in that
case, you may set @var{depth-var} to anything.
@end defmac
|| (cfun->calls_alloca && EXIT_IGNORE_STACK)
|| crtl->accesses_prior_frames
|| crtl->stack_realign_needed
- || FRAME_POINTER_REQUIRED);
+ || targetm.frame_pointer_required ());
frame_pointer_needed = need_fp;
struct elim_table *ep;
for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if ((ep->from == HARD_FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED)
+ if ((ep->from == HARD_FRAME_POINTER_REGNUM
+ && targetm.frame_pointer_required ())
#ifdef ELIMINABLE_REGS
|| ! CAN_ELIMINATE (ep->from, ep->to)
#endif
MUST_PASS_IN_STACK FUNCTION_ARG_PASS_BY_REFERENCE \
VECTOR_MODE_SUPPORTED_P TARGET_SUPPORTS_HIDDEN \
FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \
- ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS
+ ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED
/* Other obsolete target macros, or macros that used to be in target
headers and were not used, and may be obsolete or may never have
#define TARGET_CASE_VALUES_THRESHOLD default_case_values_threshold
#endif
+#ifndef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_false
+#endif
+
/* C specific. */
#ifndef TARGET_C_MODE_FOR_SUFFIX
#define TARGET_C_MODE_FOR_SUFFIX default_mode_for_suffix
TARGET_INSTANTIATE_DECLS, \
TARGET_HARD_REGNO_SCRATCH_OK, \
TARGET_CASE_VALUES_THRESHOLD, \
+ TARGET_FRAME_POINTER_REQUIRED, \
TARGET_C, \
TARGET_CXX, \
TARGET_EMUTLS, \
/* Return the smallest number of different values for which it is best to
use a jump-table instead of a tree of conditional branches. */
unsigned int (* case_values_threshold) (void);
+
+ /* Retutn true if a function must have and use a frame pointer. */
+ bool (* frame_pointer_required) (void);
/* Functions specific to the C family of frontends. */
struct c {