aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2005-06-29 01:24:27 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2005-06-29 01:24:27 +0000
commitb48f503c9806fab41f3a9e484822b5b00dd31e0a (patch)
tree6e5206234e2011fe87ca88acfe08dfbe38d900ca /gcc/config/sh
parentdcb081fc082c2c6ba19b6d82f5fa067d987c30d6 (diff)
downloadgcc-b48f503c9806fab41f3a9e484822b5b00dd31e0a.zip
gcc-b48f503c9806fab41f3a9e484822b5b00dd31e0a.tar.gz
gcc-b48f503c9806fab41f3a9e484822b5b00dd31e0a.tar.bz2
target.h (gcc_target): New field allocate_initial_value.
* target.h (gcc_target): New field allocate_initial_value. * target-def.h (TARGET_ALLOCATE_INITIAL_VALUE): New macro. (TARGET_INITIALIZER): Include it. * integrate.c (allocate_initial_values): Use targetm.allocate_initial_value. * system.h: Poison ALLOCATE_INITIAL_VALUE. * config/sh/sh-protos.h (sh_pr_n_sets): Delete. * config/sh/sh.c (sh_pr_n_sets): Make it static. (sh_allocate_initila_value): New function. (TARGET_ALLOCATE_INITIAL_VALUE): Override default. * config/sh/sh.h (ALLOCATE_INITIAL_VALUE): Delete. * doc/tm.texi (TARGET_ALLOCATE_INITIAL_VALUE): Rename and update from ALLOCATE_INITIAL_VALUE. From-SVN: r101411
Diffstat (limited to 'gcc/config/sh')
-rw-r--r--gcc/config/sh/sh-protos.h1
-rw-r--r--gcc/config/sh/sh.c33
-rw-r--r--gcc/config/sh/sh.h12
3 files changed, 31 insertions, 15 deletions
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index abfd2c4..564c1be 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -132,7 +132,6 @@ extern int sh_need_epilogue (void);
extern void sh_set_return_address (rtx, rtx);
extern int initial_elimination_offset (int, int);
extern int fldi_ok (void);
-extern int sh_pr_n_sets (void);
extern int sh_hard_regno_rename_ok (unsigned int, unsigned int);
extern int sh_cfun_interrupt_handler_p (void);
extern int sh_attr_renesas_p (tree);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 9500364..300c104 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -271,6 +271,8 @@ static int sh_address_cost (rtx);
#ifdef TARGET_ADJUST_UNROLL_MAX
static int sh_adjust_unroll_max (struct loop *, int, int, int, int);
#endif
+static int sh_pr_n_sets (void);
+static rtx sh_allocate_initial_value (rtx);
static int shmedia_target_regs_stack_space (HARD_REG_SET *);
static int shmedia_reserve_space_for_target_registers_p (int, HARD_REG_SET *);
static int shmedia_target_regs_stack_adjust (HARD_REG_SET *);
@@ -422,6 +424,8 @@ static int hard_regs_intersect_p (HARD_REG_SET *, HARD_REG_SET *);
#define TARGET_RTX_COSTS sh_rtx_costs
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST sh_address_cost
+#undef TARGET_ALLOCATE_INITIAL_VALUE
+#define TARGET_ALLOCATE_INITIAL_VALUE sh_allocate_initial_value
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG sh_reorg
@@ -8348,16 +8352,41 @@ flow_dependent_p_1 (rtx x, rtx pat ATTRIBUTE_UNUSED, void *data)
*pinsn = NULL_RTX;
}
-/* For use by ALLOCATE_INITIAL_VALUE. Note that sh.md contains some
+/* For use by sh_allocate_initial_value. Note that sh.md contains some
'special function' patterns (type sfunc) that clobber pr, but that
do not look like function calls to leaf_function_p. Hence we must
do this extra check. */
-int
+static int
sh_pr_n_sets (void)
{
return REG_N_SETS (TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG);
}
+/* Return where to allocate pseudo for a given hard register initial
+ value. */
+static rtx
+sh_allocate_initial_value (rtx hard_reg)
+{
+ rtx x;
+
+ if (REGNO (hard_reg) == (TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG))
+ {
+ if (current_function_is_leaf
+ && ! sh_pr_n_sets ()
+ && ! (TARGET_SHCOMPACT
+ && ((current_function_args_info.call_cookie
+ & ~ CALL_COOKIE_RET_TRAMP (1))
+ || current_function_has_nonlocal_label)))
+ x = hard_reg;
+ else
+ x = gen_rtx_MEM (Pmode, return_address_pointer_rtx);
+ }
+ else
+ x = NULL_RTX;
+
+ return x;
+}
+
/* This function returns "2" to indicate dual issue for the SH4
processor. To be used by the DFA pipeline description. */
static int
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index fafa09e..c803d55 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -3360,18 +3360,6 @@ extern struct rtx_def *sp_switch;
2:\n" TEXT_SECTION_ASM_OP);
#endif /* (defined CRT_BEGIN || defined CRT_END) && ! __SHMEDIA__ */
-#define ALLOCATE_INITIAL_VALUE(hard_reg) \
- (REGNO (hard_reg) == (TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG) \
- ? (current_function_is_leaf \
- && ! sh_pr_n_sets () \
- && ! (TARGET_SHCOMPACT \
- && ((current_function_args_info.call_cookie \
- & ~ CALL_COOKIE_RET_TRAMP (1)) \
- || current_function_has_nonlocal_label)) \
- ? (hard_reg) \
- : gen_rtx_MEM (Pmode, return_address_pointer_rtx)) \
- : NULL_RTX)
-
#define SIMULTANEOUS_PREFETCHES 2
/* FIXME: middle-end support for highpart optimizations is missing. */