* [patch committed SH] Redefine TARGET_DELEGITIMIZE_ADDRESS
@ 2010-11-02 1:58 Kaz Kojima
0 siblings, 0 replies; only message in thread
From: Kaz Kojima @ 2010-11-02 1:58 UTC (permalink / raw)
To: gcc-patches
Hi,
I've missed that there are many warnings like
note: non-delegitimized UNSPEC 8 found in variable location
during building target libraries on my nightly build of
sh4-unknown-linux-gnu. The attached patch adds a minimal
target delegitimize_address routine to fix these warnings.
Tested with bootstrap and the top level "make -k check"
on sh4-unknown-linux-gnu with no new failures.
Applied on trunk.
Regards,
kaz
--
2010-11-01 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.
(sh_delegitimize_address): New function.
--- ORIG/trunk/gcc/config/sh/sh.c 2010-10-31 09:38:09.000000000 +0900
+++ trunk/gcc/config/sh/sh.c 2010-11-01 22:58:40.000000000 +0900
@@ -255,6 +255,7 @@ static int sh_pr_n_sets (void);
static rte 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_o
#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, en
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-11-02 0:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 1:58 [patch committed SH] Redefine TARGET_DELEGITIMIZE_ADDRESS Kaz Kojima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).