aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2010-11-02 00:12:14 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2010-11-02 00:12:14 +0000
commit90833f7f2f047fec74c5db971594b525efd8a21b (patch)
tree80b9e8d9ec2f7dff96f27e43c30c1ff39e93c664
parentbaf3ead600703fb6640b34bc43361b5f964628a2 (diff)
downloadgcc-90833f7f2f047fec74c5db971594b525efd8a21b.zip
gcc-90833f7f2f047fec74c5db971594b525efd8a21b.tar.gz
gcc-90833f7f2f047fec74c5db971594b525efd8a21b.tar.bz2
sh.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.
* config/sh/sh.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine. (sh_delegitimize_address): New function. From-SVN: r166157
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/sh/sh.c43
2 files changed, 48 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1ca5b0b..e0e3e22 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-01 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.
+ (sh_delegitimize_address): New function.
+
2010-11-01 Joseph Myers <joseph@codesourcery.com>
* config/alpha/alpha.h (WORD_SWITCH_TAKES_ARG): Remove.
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 54e7be8..a1eec59 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -255,6 +255,7 @@ 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 rtx sh_delegitimize_address (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 *);
@@ -459,6 +460,9 @@ static const struct default_options sh_option_optimization_table[] =
#undef TARGET_SCHED_INIT
#define TARGET_SCHED_INIT sh_md_init
+#undef TARGET_DELEGITIMIZE_ADDRESS
+#define TARGET_DELEGITIMIZE_ADDRESS sh_delegitimize_address
+
#undef TARGET_LEGITIMIZE_ADDRESS
#define TARGET_LEGITIMIZE_ADDRESS sh_legitimize_address
@@ -9873,6 +9877,45 @@ sh_legitimize_reload_address (rtx *p, enum machine_mode mode, int opnum,
return true;
}
+/* In the name of slightly smaller debug output, and to cater to
+ general assembler lossage, recognize various UNSPEC sequences
+ and turn them back into a direct symbol reference. */
+
+static rtx
+sh_delegitimize_address (rtx orig_x)
+{
+ rtx x, y;
+
+ orig_x = delegitimize_mem_from_attrs (orig_x);
+
+ x = orig_x;
+ if (MEM_P (x))
+ x = XEXP (x, 0);
+ if (GET_CODE (x) == CONST)
+ {
+ y = XEXP (x, 0);
+ if (GET_CODE (y) == UNSPEC)
+ {
+ if (XINT (y, 1) == UNSPEC_GOT
+ || XINT (y, 1) == UNSPEC_GOTOFF)
+ return XVECEXP (y, 0, 0);
+ else if (TARGET_SHMEDIA
+ && (XINT (y, 1) == UNSPEC_EXTRACT_S16
+ || XINT (y, 1) == UNSPEC_EXTRACT_U16))
+ {
+ rtx offset = XVECEXP (y, 0, 1);
+
+ x = gen_rtx_PLUS (Pmode, XVECEXP (y, 0, 0), offset);
+ if (MEM_P (orig_x))
+ x = replace_equiv_address_nv (orig_x, x);
+ return x;
+ }
+ }
+ }
+
+ return orig_x;
+}
+
/* Mark the use of a constant in the literal table. If the constant
has multiple labels, make it unique. */
static rtx