aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2009-06-30 02:51:04 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2009-06-30 02:51:04 +0400
commitb52b1749191efa8f23067b86acddd4450ddbd543 (patch)
tree0f2937085f496ccc9d16a12f644463d2113bf657 /gcc
parent78bf7bd0fc9a82aff98874e0ff3e12a329f920ab (diff)
downloadgcc-b52b1749191efa8f23067b86acddd4450ddbd543.zip
gcc-b52b1749191efa8f23067b86acddd4450ddbd543.tar.gz
gcc-b52b1749191efa8f23067b86acddd4450ddbd543.tar.bz2
target.h (struct gcc_target): Add frame_pointer_required field.
* 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. From-SVN: r149065
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog95
-rw-r--r--gcc/config/arc/arc.h8
-rw-r--r--gcc/config/arm/arm.c15
-rw-r--r--gcc/config/arm/arm.h5
-rw-r--r--gcc/config/avr/avr-protos.h1
-rw-r--r--gcc/config/avr/avr.c4
-rw-r--r--gcc/config/avr/avr.h2
-rw-r--r--gcc/config/bfin/bfin-protos.h3
-rw-r--r--gcc/config/bfin/bfin.c11
-rw-r--r--gcc/config/bfin/bfin.h9
-rw-r--r--gcc/config/cris/cris.c18
-rw-r--r--gcc/config/cris/cris.h5
-rw-r--r--gcc/config/crx/crx.h4
-rw-r--r--gcc/config/fr30/fr30.c15
-rw-r--r--gcc/config/fr30/fr30.h24
-rw-r--r--gcc/config/frv/frv-protos.h3
-rw-r--r--gcc/config/frv/frv.c42
-rw-r--r--gcc/config/frv/frv.h22
-rw-r--r--gcc/config/i386/i386-protos.h3
-rw-r--r--gcc/config/i386/i386.c15
-rw-r--r--gcc/config/i386/i386.h6
-rw-r--r--gcc/config/m32c/m32c.c7
-rw-r--r--gcc/config/m32c/m32c.h5
-rw-r--r--gcc/config/m32r/m32r.h5
-rw-r--r--gcc/config/mcore/mcore.h5
-rw-r--r--gcc/config/mep/mep.h2
-rw-r--r--gcc/config/mips/mips-protos.h3
-rw-r--r--gcc/config/mips/mips.c7
-rw-r--r--gcc/config/mips/mips.h2
-rw-r--r--gcc/config/mmix/mmix.c17
-rw-r--r--gcc/config/mmix/mmix.h3
-rw-r--r--gcc/config/moxie/moxie.c3
-rw-r--r--gcc/config/moxie/moxie.h2
-rw-r--r--gcc/config/pa/pa.h7
-rw-r--r--gcc/config/score/score.h5
-rw-r--r--gcc/config/sh/sh.h5
-rw-r--r--gcc/config/sparc/sparc-protos.h3
-rw-r--r--gcc/config/sparc/sparc.c24
-rw-r--r--gcc/config/sparc/sparc.h10
-rw-r--r--gcc/config/vax/vax.c3
-rw-r--r--gcc/config/vax/vax.h6
-rw-r--r--gcc/config/xtensa/xtensa-protos.h3
-rw-r--r--gcc/config/xtensa/xtensa.c14
-rw-r--r--gcc/config/xtensa/xtensa.h6
-rw-r--r--gcc/defaults.h4
-rw-r--r--gcc/doc/tm.texi18
-rw-r--r--gcc/ira.c2
-rw-r--r--gcc/reload1.c3
-rw-r--r--gcc/system.h2
-rw-r--r--gcc/target-def.h5
-rw-r--r--gcc/target.h3
51 files changed, 277 insertions, 217 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1566160..97b6fba5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,98 @@
+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.
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 4153ad6..e19048d 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1,6 +1,6 @@
/* 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.
@@ -516,12 +516,6 @@ extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER];
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) \
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 7e8b8a3..85b4995 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -204,6 +204,8 @@ static const char *arm_invalid_return_type (const_tree t);
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);
+
/* Table of machine attributes. */
static const struct attribute_spec arm_attribute_table[] =
@@ -461,6 +463,9 @@ 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;
/* Obstack for minipool constant handling. */
@@ -20023,4 +20028,14 @@ arm_optimization_options (int level, int size ATTRIBUTE_UNUSED)
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"
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 87441ce..58ced2e 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1044,11 +1044,6 @@ extern int arm_structure_size_boundary;
#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
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 6a0e26d..c2d199d 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -30,7 +30,6 @@ extern int avr_ret_register (void);
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);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 0ed9788..7dd2a6f 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -89,6 +89,7 @@ static struct machine_function * avr_init_machine_status (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
@@ -188,6 +189,9 @@ static const struct attribute_spec avr_attribute_table[] =
#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;
void
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 31a7cac..97e3e2a 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -400,8 +400,6 @@ enum reg_class {
#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
diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h
index 1354241..72698a2 100644
--- a/gcc/config/bfin/bfin-protos.h
+++ b/gcc/config/bfin/bfin-protos.h
@@ -1,5 +1,5 @@
/* 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.
@@ -112,7 +112,6 @@ extern int log2constp (unsigned HOST_WIDE_INT);
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);
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 715ec81..4f21306 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -812,20 +812,20 @@ setup_incoming_varargs (CUMULATIVE_ARGS *cum,
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. */
@@ -6339,4 +6339,7 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
#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;
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 29e4f91..a794204 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -1,5 +1,5 @@
/* 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.
@@ -313,13 +313,6 @@ extern const char *bfin_library_id_string;
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
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index bc634dd..66fc05d 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -1,6 +1,6 @@
/* 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.
@@ -122,6 +122,8 @@ static tree cris_md_asm_clobbers (tree, tree, tree);
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;
@@ -180,6 +182,8 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#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;
@@ -3814,6 +3818,18 @@ cris_md_asm_clobbers (tree outputs, tree inputs, tree in_clobbers)
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,
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index d908cfb..920e354 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -850,11 +850,6 @@ enum reg_class
/* 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}, \
diff --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h
index d22db7d..dcddaf0 100644
--- a/gcc/config/crx/crx.h
+++ b/gcc/config/crx/crx.h
@@ -1,6 +1,6 @@
/* 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.
@@ -291,8 +291,6 @@ enum reg_class
#define FIRST_PARM_OFFSET(FNDECL) 0
-#define FRAME_POINTER_REQUIRED (cfun->calls_alloca)
-
#define ELIMINABLE_REGS \
{ \
{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 5642c54..fc412ee 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -1,5 +1,5 @@
/* 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.
@@ -119,7 +119,7 @@ static void fr30_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
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))
@@ -158,6 +158,9 @@ static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#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;
/* Returns the number of bytes offset between FROM_REG and TO_REG
@@ -899,6 +902,14 @@ fr30_move_double (rtx * operands)
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 */
diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h
index b958a67..9af74a9 100644
--- a/gcc/config/fr30/fr30.h
+++ b/gcc/config/fr30/fr30.h
@@ -1,7 +1,7 @@
/*{{{ 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.
@@ -519,28 +519,6 @@ enum reg_class
/*}}}*/
/*{{{ 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
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index 56f4243..8734694 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -1,5 +1,5 @@
/* 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.
@@ -43,7 +43,6 @@ extern void frv_optimization_options (int, int);
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
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index c7e717e..658b5b4 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -1,5 +1,5 @@
/* 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.
@@ -381,6 +381,7 @@ static void frv_output_dwarf_dtprel (FILE *, int, rtx)
static bool frv_secondary_reload (bool, rtx, enum reg_class,
enum machine_mode,
secondary_reload_info *);
+static bool frv_frame_pointer_required (void);
/* Allow us to easily change the default for -malloc-cc. */
#ifndef DEFAULT_NO_ALLOC_CC
@@ -471,6 +472,9 @@ static bool frv_secondary_reload (bool, rtx, enum reg_class,
#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) \
@@ -2105,28 +2109,10 @@ frv_asm_output_mi_thunk (FILE *file,
}
-/* 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
@@ -2135,27 +2121,27 @@ frv_frame_pointer_required (void)
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;
}
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index 15047e3..483ed77 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -1,5 +1,5 @@
/* 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.
@@ -1564,26 +1564,6 @@ typedef struct frv_stack {
/* 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
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 663b4bf..54d30b7 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -1,6 +1,6 @@
/* 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.
@@ -24,7 +24,6 @@ extern void override_options (bool);
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);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 42bf323..c8c4bbf 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7421,18 +7421,18 @@ ix86_can_use_return_insn_p (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
@@ -7440,12 +7440,12 @@ ix86_frame_pointer_required (void)
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. */
@@ -30525,6 +30525,9 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#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;
#include "gt-i386.h"
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index d762c29..2d49927 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1152,12 +1152,6 @@ do { \
#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
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index 989f823..9672dfa 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -4259,6 +4259,13 @@ m32c_output_compare (rtx insn, rtx *operands)
#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;
diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h
index 691bc994..dea5b55 100644
--- a/gcc/config/m32c/m32c.h
+++ b/gcc/config/m32c/m32c.h
@@ -488,11 +488,6 @@ enum reg_class
/* 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}, \
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index d06452d..0ddbcfa 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -770,11 +770,6 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
/* 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.
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 9b33a1a..acc5449 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -325,11 +325,6 @@ extern int mcore_stack_increment;
{ 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) \
diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h
index 511abfc..a80f7aa 100644
--- a/gcc/config/mep/mep.h
+++ b/gcc/config/mep/mep.h
@@ -492,8 +492,6 @@ extern unsigned int mep_selected_isa;
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{ \
{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index bbae18a..d5d6eee 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -1,6 +1,6 @@
/* 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).
@@ -272,7 +272,6 @@ extern void mips_finish_declare_object (FILE *, tree, int, int);
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);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 62753a3..3615892 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -8918,9 +8918,9 @@ 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
@@ -14931,6 +14931,9 @@ mips_final_postscan_insn (FILE *file, rtx insn, rtx *opvec, int noperands)
#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;
#include "gt-mips.h"
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 3d2fcac..c8ea605 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -1767,8 +1767,6 @@ enum mips_code_readable_setting {
#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)
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index d2115a5..67b1b23 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -1,5 +1,5 @@
/* 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)
@@ -137,6 +137,7 @@ static bool mmix_rtx_costs (rtx, int, int, int *, bool);
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. */
@@ -210,6 +211,9 @@ static bool mmix_pass_by_reference (CUMULATIVE_ARGS *,
#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.
@@ -2697,6 +2701,17 @@ mmix_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
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")
diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h
index 03a747f..72e3568 100644
--- a/gcc/config/mmix/mmix.h
+++ b/gcc/config/mmix/mmix.h
@@ -585,9 +585,6 @@ enum reg_class
/* 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
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 03e9f3f..3991cee 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -475,6 +475,9 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum,
#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"
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index cbe8eed..01cf9d2 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -519,8 +519,6 @@ do \
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)
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 576916f..3b0dded 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1,6 +1,7 @@
/* 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.
@@ -356,10 +357,6 @@ typedef struct GTY(()) machine_function
/* 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). */
diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h
index e6c8b75..ed3f1a4 100644
--- a/gcc/config/score/score.h
+++ b/gcc/config/score/score.h
@@ -557,11 +557,6 @@ extern enum reg_class score_char_to_class[256];
#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}, \
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 7f90147..d8b9a29 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1031,11 +1031,6 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \
{ 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. */
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index 8b3547a..552d559 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -1,5 +1,5 @@
/* 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,
@@ -50,6 +50,7 @@ extern int short_branch (int, int);
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);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index af67a46..baba1d9 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -417,6 +417,7 @@ static int sparc_arg_partial_bytes (CUMULATIVE_ARGS *,
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
@@ -591,6 +592,9 @@ static bool fpu_option_set = false;
#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
@@ -9137,4 +9141,24 @@ sparc_expand_compare_and_swap_12 (rtx result, rtx mem, rtx oldval, rtx newval)
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"
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 406ee68..31c7409 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -967,13 +967,6 @@ extern int sparc_mode_class[];
} \
} 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
@@ -1390,8 +1383,7 @@ extern char leaf_reg_remap[];
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
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index a783b6f..d0543da 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -98,6 +98,9 @@ static rtx vax_builtin_setjmp_frame_value (void);
#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;
/* Set global variables as needed for the options enabled. */
diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h
index e22fbd7..4ff2d54 100644
--- a/gcc/config/vax/vax.h
+++ b/gcc/config/vax/vax.h
@@ -175,12 +175,6 @@ along with GCC; see the file COPYING3. If not see
/* 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
diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index c60917f..73176f6 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -1,5 +1,5 @@
/* 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.
@@ -84,7 +84,6 @@ extern void xtensa_setup_frame_addresses (void);
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 *);
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 773223b..38f300a 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1,5 +1,5 @@
/* 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.
@@ -145,6 +145,7 @@ static void xtensa_init_builtins (void);
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;
@@ -227,6 +228,9 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#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;
@@ -1534,7 +1538,7 @@ xtensa_expand_atomic (enum rtx_code code, rtx target, rtx mem, rtx val,
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
@@ -2495,7 +2499,7 @@ compute_frame_size (int size)
}
-int
+bool
xtensa_frame_pointer_required (void)
{
/* The code to expand builtin_frame_addr and builtin_return_addr
@@ -2504,9 +2508,9 @@ xtensa_frame_pointer_required (void)
This function is derived from the i386 code. */
if (cfun->machine->accesses_prev_frame)
- return 1;
+ return true;
- return 0;
+ return false;
}
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 120ae75..a9987c7 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -380,12 +380,6 @@ extern char xtensa_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
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)
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 0db07a9..11873a8 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1154,8 +1154,4 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GO_IF_MODE_DEPENDENT_ADDRESS(X, WIN)
#endif
-#ifndef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED false
-#endif
-
#endif /* ! GCC_DEFAULTS_H */
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index a2c7562..e328210 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3737,12 +3737,12 @@ return @code{@var{regno}}.
@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.
@@ -3752,15 +3752,15 @@ 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
-@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})
@@ -3772,7 +3772,7 @@ registers @code{regs_ever_live} and @code{call_used_regs}.
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
diff --git a/gcc/ira.c b/gcc/ira.c
index a633514..98dd645 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1411,7 +1411,7 @@ setup_eliminable_regset (void)
|| (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;
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 064166f..6b6da1b 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3702,7 +3702,8 @@ update_eliminables (HARD_REG_SET *pset)
struct elim_table *ep;
for (ep = reg_eliminate; ep < &reg_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
diff --git a/gcc/system.h b/gcc/system.h
index 51d9c99..780fda4 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -682,7 +682,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
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
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 8aeebeb..ddf3e0a 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -666,6 +666,10 @@
#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
@@ -938,6 +942,7 @@
TARGET_INSTANTIATE_DECLS, \
TARGET_HARD_REGNO_SCRATCH_OK, \
TARGET_CASE_VALUES_THRESHOLD, \
+ TARGET_FRAME_POINTER_REQUIRED, \
TARGET_C, \
TARGET_CXX, \
TARGET_EMUTLS, \
diff --git a/gcc/target.h b/gcc/target.h
index bbc6cd8..bd10717 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -960,6 +960,9 @@ struct gcc_target
/* 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 {