diff mbox

[AArch64] Remove an unused reload hook.

Message ID 54C672FF.4040209@arm.com
State New
Headers show

Commit Message

Matthew Wahab Jan. 26, 2015, 5:01 p.m. UTC
Hello,

The LEGITIMIZE_RELOAD_ADDRESS macro is only needed for reload. Since the 
Aarch64 backend no longer supports reload, this macro is not needed and 
this patch removes it.

Tested aarch64-none-linux-gnu with gcc-check. No new failures.

Ok for trunk?
Matthew

gcc/
2015-01-26  Matthew Wahab  <matthew.wahab@arm.com>

	* config/aarch64/aarch64.h (LEGITIMIZE_RELOAD_ADDRESS): Remove.
	* config/aarch64/arch64-protos.h
	(aarch64_legitimize_reload_address): Remove.
	* config/aarch64/aarch64.c (aarch64_legitimize_reload_address):
	Remove.

Comments

Yvan Roux Feb. 25, 2016, 11 a.m. UTC | #1
Hi,

On 26 January 2015 at 18:01, Matthew Wahab <matthew.wahab@arm.com> wrote:
> Hello,
>
> The LEGITIMIZE_RELOAD_ADDRESS macro is only needed for reload. Since the
> Aarch64 backend no longer supports reload, this macro is not needed and this
> patch removes it.
>
> Tested aarch64-none-linux-gnu with gcc-check. No new failures.
>
> Ok for trunk?
> Matthew
>
> gcc/
> 2015-01-26  Matthew Wahab  <matthew.wahab@arm.com>
>
>         * config/aarch64/aarch64.h (LEGITIMIZE_RELOAD_ADDRESS): Remove.
>         * config/aarch64/arch64-protos.h
>         (aarch64_legitimize_reload_address): Remove.
>         * config/aarch64/aarch64.c (aarch64_legitimize_reload_address):
>         Remove.

It seems that this old patch was forgotten, I guess that it'll have to
wait for GCC 7 now, but I think it's a good thing top cleanup the
reload specific hooks and constructions (I've another patch on for
that under on-going).

Cheers,
Yvan
James Greenhalgh Feb. 26, 2016, 3:45 p.m. UTC | #2
On Thu, Feb 25, 2016 at 12:00:58PM +0100, Yvan Roux wrote:
> Hi,
> 
> On 26 January 2015 at 18:01, Matthew Wahab <matthew.wahab@arm.com> wrote:
> > Hello,
> >
> > The LEGITIMIZE_RELOAD_ADDRESS macro is only needed for reload. Since the
> > Aarch64 backend no longer supports reload, this macro is not needed and this
> > patch removes it.
> >
> > Tested aarch64-none-linux-gnu with gcc-check. No new failures.
> >
> > Ok for trunk?
> > Matthew
> >
> > gcc/
> > 2015-01-26  Matthew Wahab  <matthew.wahab@arm.com>
> >
> >         * config/aarch64/aarch64.h (LEGITIMIZE_RELOAD_ADDRESS): Remove.
> >         * config/aarch64/arch64-protos.h
> >         (aarch64_legitimize_reload_address): Remove.
> >         * config/aarch64/aarch64.c (aarch64_legitimize_reload_address):
> >         Remove.
> 
> It seems that this old patch was forgotten, I guess that it'll have to
> wait for GCC 7 now, but I think it's a good thing top cleanup the
> reload specific hooks and constructions (I've another patch on for
> that under on-going).

Agreed. Please repost the patch once GCC 7 development opens and I'll take
a look at it then.

Thanks,
James
Matthew Wahab Feb. 29, 2016, 10:43 a.m. UTC | #3
On 25/02/16 11:00, Yvan Roux wrote:
> Hi,
>
> On 26 January 2015 at 18:01, Matthew Wahab <matthew.wahab@arm.com> wrote:
>> Hello,
>>
>> The LEGITIMIZE_RELOAD_ADDRESS macro is only needed for reload. Since the
>> Aarch64 backend no longer supports reload, this macro is not needed and this
>> patch removes it.
>>
>> Tested aarch64-none-linux-gnu with gcc-check. No new failures.
>>
>> Ok for trunk?
>> Matthew
>>
>> gcc/
>> 2015-01-26  Matthew Wahab  <matthew.wahab@arm.com>
>>
>>          * config/aarch64/aarch64.h (LEGITIMIZE_RELOAD_ADDRESS): Remove.
>>          * config/aarch64/arch64-protos.h
>>          (aarch64_legitimize_reload_address): Remove.
>>          * config/aarch64/aarch64.c (aarch64_legitimize_reload_address):
>>          Remove.
>
> It seems that this old patch was forgotten, I guess that it'll have to
> wait for GCC 7 now, but I think it's a good thing top cleanup the
> reload specific hooks and constructions (I've another patch on for
> that under on-going).
>

Thanks for spotting this. I'll take of it when stage 1 opens.
Matthew
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 59c5824..da31d49 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -236,7 +236,6 @@  int aarch64_hard_regno_nregs (unsigned, machine_mode);
 int aarch64_simd_attr_length_move (rtx_insn *);
 int aarch64_uxt_size (int, HOST_WIDE_INT);
 rtx aarch64_final_eh_return_addr (void);
-rtx aarch64_legitimize_reload_address (rtx *, machine_mode, int, int, int);
 const char *aarch64_output_move_struct (rtx *operands);
 rtx aarch64_return_addr (int, rtx);
 rtx aarch64_simd_gen_const_vector_dup (machine_mode, int);
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index dd49fcd..bfc9cfe 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4667,120 +4667,6 @@  aarch64_legitimize_address (rtx x, rtx /* orig_x  */, machine_mode mode)
   return x;
 }
 
-/* Try a machine-dependent way of reloading an illegitimate address
-   operand.  If we find one, push the reload and return the new rtx.  */
-
-rtx
-aarch64_legitimize_reload_address (rtx *x_p,
-				   machine_mode mode,
-				   int opnum, int type,
-				   int ind_levels ATTRIBUTE_UNUSED)
-{
-  rtx x = *x_p;
-
-  /* Do not allow mem (plus (reg, const)) if vector struct mode.  */
-  if (aarch64_vect_struct_mode_p (mode)
-      && GET_CODE (x) == PLUS
-      && REG_P (XEXP (x, 0))
-      && CONST_INT_P (XEXP (x, 1)))
-    {
-      rtx orig_rtx = x;
-      x = copy_rtx (x);
-      push_reload (orig_rtx, NULL_RTX, x_p, NULL,
-		   BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
-		   opnum, (enum reload_type) type);
-      return x;
-    }
-
-  /* We must recognize output that we have already generated ourselves.  */
-  if (GET_CODE (x) == PLUS
-      && GET_CODE (XEXP (x, 0)) == PLUS
-      && REG_P (XEXP (XEXP (x, 0), 0))
-      && CONST_INT_P (XEXP (XEXP (x, 0), 1))
-      && CONST_INT_P (XEXP (x, 1)))
-    {
-      push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
-		   BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0,
-		   opnum, (enum reload_type) type);
-      return x;
-    }
-
-  /* We wish to handle large displacements off a base register by splitting
-     the addend across an add and the mem insn.  This can cut the number of
-     extra insns needed from 3 to 1.  It is only useful for load/store of a
-     single register with 12 bit offset field.  */
-  if (GET_CODE (x) == PLUS
-      && REG_P (XEXP (x, 0))
-      && CONST_INT_P (XEXP (x, 1))
-      && HARD_REGISTER_P (XEXP (x, 0))
-      && mode != TImode
-      && mode != TFmode
-      && aarch64_regno_ok_for_base_p (REGNO (XEXP (x, 0)), true))
-    {
-      HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
-      HOST_WIDE_INT low = val & 0xfff;
-      HOST_WIDE_INT high = val - low;
-      HOST_WIDE_INT offs;
-      rtx cst;
-      machine_mode xmode = GET_MODE (x);
-
-      /* In ILP32, xmode can be either DImode or SImode.  */
-      gcc_assert (xmode == DImode || xmode == SImode);
-
-      /* Reload non-zero BLKmode offsets.  This is because we cannot ascertain
-	 BLKmode alignment.  */
-      if (GET_MODE_SIZE (mode) == 0)
-	return NULL_RTX;
-
-      offs = low % GET_MODE_SIZE (mode);
-
-      /* Align misaligned offset by adjusting high part to compensate.  */
-      if (offs != 0)
-	{
-	  if (aarch64_uimm12_shift (high + offs))
-	    {
-	      /* Align down.  */
-	      low = low - offs;
-	      high = high + offs;
-	    }
-	  else
-	    {
-	      /* Align up.  */
-	      offs = GET_MODE_SIZE (mode) - offs;
-	      low = low + offs;
-	      high = high + (low & 0x1000) - offs;
-	      low &= 0xfff;
-	    }
-	}
-
-      /* Check for overflow.  */
-      if (high + low != val)
-	return NULL_RTX;
-
-      cst = GEN_INT (high);
-      if (!aarch64_uimm12_shift (high))
-	cst = force_const_mem (xmode, cst);
-
-      /* Reload high part into base reg, leaving the low part
-	 in the mem instruction.
-	 Note that replacing this gen_rtx_PLUS with plus_constant is
-	 wrong in this case because we rely on the
-	 (plus (plus reg c1) c2) structure being preserved so that
-	 XEXP (*p, 0) in push_reload below uses the correct term.  */
-      x = gen_rtx_PLUS (xmode,
-			gen_rtx_PLUS (xmode, XEXP (x, 0), cst),
-			GEN_INT (low));
-
-      push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
-		   BASE_REG_CLASS, xmode, VOIDmode, 0, 0,
-		   opnum, (enum reload_type) type);
-      return x;
-    }
-
-  return NULL_RTX;
-}
-
-
 static reg_class_t
 aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x,
 			  reg_class_t rclass,
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index bf59e40..4568699 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -685,21 +685,6 @@  typedef struct
 
 #define CONSTANT_ADDRESS_P(X)		aarch64_constant_address_p(X)
 
-/* Try a machine-dependent way of reloading an illegitimate address
-   operand.  If we find one, push the reload and jump to WIN.  This
-   macro is used in only one place: `find_reloads_address' in reload.c.  */
-
-#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_L, WIN)	     \
-do {									     \
-  rtx new_x = aarch64_legitimize_reload_address (&(X), MODE, OPNUM, TYPE,    \
-						 IND_L);		     \
-  if (new_x)								     \
-    {									     \
-      X = new_x;							     \
-      goto WIN;								     \
-    }									     \
-} while (0)
-
 #define REGNO_OK_FOR_BASE_P(REGNO)	\
   aarch64_regno_ok_for_base_p (REGNO, true)