This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch committed] SH: Hookize GO_IF_LEGITIMATE_ADDRESS
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 May 2009 07:32:51 +0900 (JST)
- Subject: [patch committed] SH: Hookize GO_IF_LEGITIMATE_ADDRESS
Hi,
I've applied the attached patch which is a SH portion of
the hookization of GO_IF_LEGITIMATE_ADDRESS. It's tested
with bootstrap and the top level "make -k check" with no new
failures on sh4-unknown-linux-gnu.
Regards,
kaz
--
2009-05-18 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh-protos.h (sh_legitimate_address_p): Remove.
* config/sh/sh.c (sh_legitimate_address_p): Make static.
(TARGET_LEGITIMATE_ADDRESS_P): New.
* config/sh/sh.h (GO_IF_LEGITIMATE_ADDRESS): Delete.
* config/sh/sh.md: Clean up references to GO_IF_LEGITIMATE_ADDRESS.
diff -uprN ORIG/trunk/gcc/config/sh/sh-protos.h trunk/gcc/config/sh/sh-protos.h
--- ORIG/trunk/gcc/config/sh/sh-protos.h 2009-05-14 10:07:12.000000000 +0900
+++ trunk/gcc/config/sh/sh-protos.h 2009-05-18 22:12:38.000000000 +0900
@@ -59,7 +59,6 @@ extern int fp_one_operand (rtx);
extern int fp_int_operand (rtx);
extern rtx get_fpscr_rtx (void);
extern bool sh_legitimate_index_p (enum machine_mode, rtx);
-extern bool sh_legitimate_address_p (enum machine_mode, rtx, bool);
extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
extern int nonpic_symbol_mentioned_p (rtx);
extern void emit_sf_insn (rtx);
diff -uprN ORIG/trunk/gcc/config/sh/sh.c trunk/gcc/config/sh/sh.c
--- ORIG/trunk/gcc/config/sh/sh.c 2009-05-18 21:54:59.000000000 +0900
+++ trunk/gcc/config/sh/sh.c 2009-05-18 22:12:38.000000000 +0900
@@ -238,6 +238,7 @@ static bool sh_rtx_costs (rtx, int, int,
static int sh_address_cost (rtx, bool);
static int sh_pr_n_sets (void);
static rtx sh_allocate_initial_value (rtx);
+static bool sh_legitimate_address_p (enum machine_mode, rtx, bool);
static rtx sh_legitimize_address (rtx, rtx, enum machine_mode);
static int shmedia_target_regs_stack_space (HARD_REG_SET *);
static int shmedia_reserve_space_for_target_registers_p (int, HARD_REG_SET *);
@@ -480,6 +481,9 @@ static int sh2a_function_vector_p (tree)
#undef TARGET_SECONDARY_RELOAD
#define TARGET_SECONDARY_RELOAD sh_secondary_reload
+#undef TARGET_LEGITIMATE_ADDRESS_P
+#define TARGET_LEGITIMATE_ADDRESS_P sh_legitimate_address_p
+
/* Machine-specific symbol_ref flags. */
#define SYMBOL_FLAG_FUNCVEC_FUNCTION (SYMBOL_FLAG_MACH_DEP << 0)
@@ -9029,7 +9033,7 @@ sh_legitimate_index_p (enum machine_mode
REG++
--REG */
-bool
+static bool
sh_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
{
if (MAYBE_BASE_REGISTER_RTX_P (x, strict))
diff -uprN ORIG/trunk/gcc/config/sh/sh.h trunk/gcc/config/sh/sh.h
--- ORIG/trunk/gcc/config/sh/sh.h 2009-05-14 10:07:12.000000000 +0900
+++ trunk/gcc/config/sh/sh.h 2009-05-18 22:12:38.000000000 +0900
@@ -2320,20 +2320,6 @@ struct sh_args {
if (sh_legitimate_index_p ((MODE), (OP))) \
goto WIN; \
} while (0)
-
-#ifdef REG_OK_STRICT
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
- do { \
- if (sh_legitimate_address_p ((MODE), (X), true)) \
- goto LABEL; \
- } while (0)
-#else
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
- do { \
- if (sh_legitimate_address_p ((MODE), (X), false)) \
- goto LABEL; \
- } while (0)
-#endif
/* A C compound statement that attempts to replace X, which is an address
that needs reloading, with a valid memory address for an operand of
diff -uprN ORIG/trunk/gcc/config/sh/sh.md trunk/gcc/config/sh/sh.md
--- ORIG/trunk/gcc/config/sh/sh.md 2009-05-14 10:07:12.000000000 +0900
+++ trunk/gcc/config/sh/sh.md 2009-05-18 22:12:38.000000000 +0900
@@ -9564,7 +9564,7 @@ mov.l\\t1f,r0\\n\\
;; The c / m alternative is a fake to guide reload to load directly into
;; fpscr, since reload doesn't know how to use post-increment.
-;; GO_IF_LEGITIMATE_ADDRESS guards about bogus addresses before reload,
+;; TARGET_LEGITIMATE_ADDRESS_P guards about bogus addresses before reload,
;; SECONDARY_INPUT_RELOAD_CLASS does this during reload, and the insn's
;; predicate after reload.
;; The mac_gp type for r/!c might look a bit odd, but it actually schedules