This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] S/390: Remove UNSPEC_LTREL_BASE


It was needed only for g5/g6 machines, which are now gone.

gcc/ChangeLog:

2018-08-14  Ilya Leoshkevich  <iii@linux.ibm.com>

	* config/s390/s390.c (s390_decompose_constant_pool_ref):
	Remove UNSPEC_LTREL_BASE check.
	(annotate_constant_pool_refs): Likewise.
	(find_constant_pool_ref): Likewise.
	(find_ltrel_base): Removed.
	(replace_ltrel_base): Removed.
	(s390_mainpool_finish): Remove replace_ltrel_base call.
	(s390_chunkify_start): Remove pending LTREL_BASE logic.
	(s390_chunkify_finish): Remove replace_ltrel_base call.
	* config/s390/s390.md: Remove UNSPEC_LTREL_BASE.
---
 gcc/config/s390/s390.c  | 131 ++--------------------------------------
 gcc/config/s390/s390.md |   1 -
 2 files changed, 5 insertions(+), 127 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 4b0c6e7c147..285fdaacafa 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -2748,9 +2748,8 @@ s390_short_displacement (rtx disp)
   return false;
 }
 
-/* Attempts to split `ref', which should be either UNSPEC_LTREF or
-   UNSPEC_LTREL_BASE, into (base + `disp').  In case pool base is not known,
-   caller-provided `pool_base' is used.  If successful, also determines the
+/* Attempts to split `ref', which should be UNSPEC_LTREF, into (base + `disp').
+   If successful, also determines the
    following characteristics of `ref': `is_ptr' - whether it can be an
    LA argument, `is_base_ptr' - whether the resulting base is a well-known
    base register (stack/frame pointer, etc), `is_pool_ptr` - whether it is
@@ -2758,8 +2757,7 @@ s390_short_displacement (rtx disp)
    literal pool pointers per insn during or after reload (`B' constraint).  */
 static bool
 s390_decompose_constant_pool_ref (rtx *ref, rtx *disp, bool *is_ptr,
-				  bool *is_base_ptr, bool *is_pool_ptr,
-				  rtx pool_base)
+				  bool *is_base_ptr, bool *is_pool_ptr)
 {
   if (!*ref)
     return true;
@@ -2778,13 +2776,6 @@ s390_decompose_constant_pool_ref (rtx *ref, rtx *disp, bool *is_ptr,
 	*ref = XVECEXP (*ref, 0, 1);
 	break;
 
-      case UNSPEC_LTREL_BASE:
-	if (XVECLEN (*ref, 0) == 1)
-	  *ref = pool_base, *is_pool_ptr = true;
-	else
-	  *ref = XVECEXP (*ref, 0, 1);
-	break;
-
       default:
 	return false;
       }
@@ -2921,12 +2912,12 @@ s390_decompose_address (rtx addr, struct s390_address *out)
 
   /* Validate base register.  */
   if (!s390_decompose_constant_pool_ref (&base, &disp, &pointer, &base_ptr,
-					 &literal_pool, fake_pool_base))
+					 &literal_pool))
     return false;
 
   /* Validate index register.  */
   if (!s390_decompose_constant_pool_ref (&indx, &disp, &pointer, &indx_ptr,
-					 &literal_pool, fake_pool_base))
+					 &literal_pool))
     return false;
 
   /* Prefer to use pointer as base, not index.  */
@@ -8156,16 +8147,6 @@ annotate_constant_pool_refs (rtx *x)
 	}
     }
 
-  /* Annotate LTREL_BASE as well.  */
-  if (GET_CODE (*x) == UNSPEC
-      && XINT (*x, 1) == UNSPEC_LTREL_BASE)
-    {
-      rtx base = cfun->machine->base_reg;
-      *x = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, XVECEXP (*x, 0, 0), base),
-				  UNSPEC_LTREL_BASE);
-      return;
-    }
-
   fmt = GET_RTX_FORMAT (GET_CODE (*x));
   for (i = GET_RTX_LENGTH (GET_CODE (*x)) - 1; i >= 0; i--)
     {
@@ -8195,10 +8176,6 @@ find_constant_pool_ref (rtx x, rtx *ref)
   int i, j;
   const char *fmt;
 
-  /* Ignore LTREL_BASE references.  */
-  if (GET_CODE (x) == UNSPEC
-      && XINT (x, 1) == UNSPEC_LTREL_BASE)
-    return;
   /* Likewise POOL_ENTRY insns.  */
   if (GET_CODE (x) == UNSPEC_VOLATILE
       && XINT (x, 1) == UNSPECV_POOL_ENTRY)
@@ -8281,73 +8258,6 @@ replace_constant_pool_ref (rtx *x, rtx ref, rtx offset)
     }
 }
 
-/* Check whether X contains an UNSPEC_LTREL_BASE.
-   Return its constant pool symbol if found, NULL_RTX otherwise.  */
-
-static rtx
-find_ltrel_base (rtx x)
-{
-  int i, j;
-  const char *fmt;
-
-  if (GET_CODE (x) == UNSPEC
-      && XINT (x, 1) == UNSPEC_LTREL_BASE)
-    return XVECEXP (x, 0, 0);
-
-  fmt = GET_RTX_FORMAT (GET_CODE (x));
-  for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
-    {
-      if (fmt[i] == 'e')
-	{
-	  rtx fnd = find_ltrel_base (XEXP (x, i));
-	  if (fnd)
-	    return fnd;
-	}
-      else if (fmt[i] == 'E')
-	{
-	  for (j = 0; j < XVECLEN (x, i); j++)
-	    {
-	      rtx fnd = find_ltrel_base (XVECEXP (x, i, j));
-	      if (fnd)
-		return fnd;
-	    }
-	}
-    }
-
-  return NULL_RTX;
-}
-
-/* Replace any occurrence of UNSPEC_LTREL_BASE in X with its base.  */
-
-static void
-replace_ltrel_base (rtx *x)
-{
-  int i, j;
-  const char *fmt;
-
-  if (GET_CODE (*x) == UNSPEC
-      && XINT (*x, 1) == UNSPEC_LTREL_BASE)
-    {
-      *x = XVECEXP (*x, 0, 1);
-      return;
-    }
-
-  fmt = GET_RTX_FORMAT (GET_CODE (*x));
-  for (i = GET_RTX_LENGTH (GET_CODE (*x)) - 1; i >= 0; i--)
-    {
-      if (fmt[i] == 'e')
-	{
-	  replace_ltrel_base (&XEXP (*x, i));
-	}
-      else if (fmt[i] == 'E')
-	{
-	  for (j = 0; j < XVECLEN (*x, i); j++)
-	    replace_ltrel_base (&XVECEXP (*x, i, j));
-	}
-    }
-}
-
-
 /* We keep a list of constants which we have to add to internal
    constant tables in the middle of large functions.  */
 
@@ -8832,9 +8742,6 @@ s390_mainpool_finish (struct constant_pool *pool)
 
   for (rtx_insn *insn = get_insns (); insn; insn = NEXT_INSN (insn))
     {
-      if (INSN_P (insn))
-	replace_ltrel_base (&PATTERN (insn));
-
       if (NONJUMP_INSN_P (insn) || CALL_P (insn))
 	{
 	  rtx addr, pool_ref = NULL_RTX;
@@ -8868,7 +8775,6 @@ s390_chunkify_start (void)
 {
   struct constant_pool *curr_pool = NULL, *pool_list = NULL;
   bitmap far_labels;
-  rtx pending_ltrel = NULL_RTX;
   rtx_insn *insn;
 
   /* We need correct insn addresses.  */
@@ -8879,17 +8785,6 @@ s390_chunkify_start (void)
 
   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
     {
-      /* Check for pending LTREL_BASE.  */
-      if (INSN_P (insn))
-	{
-	  rtx ltrel_base = find_ltrel_base (PATTERN (insn));
-	  if (ltrel_base)
-	    {
-	      gcc_assert (ltrel_base == pending_ltrel);
-	      pending_ltrel = NULL_RTX;
-	    }
-	}
-
       if (NONJUMP_INSN_P (insn) || CALL_P (insn))
 	{
 	  rtx pool_ref = NULL_RTX;
@@ -8904,16 +8799,6 @@ s390_chunkify_start (void)
 
 	      s390_add_constant (curr_pool, constant, mode);
 	      s390_add_pool_insn (curr_pool, insn);
-
-	      /* Don't split the pool chunk between a LTREL_OFFSET load
-		 and the corresponding LTREL_BASE.  */
-	      if (GET_CODE (constant) == CONST
-		  && GET_CODE (XEXP (constant, 0)) == UNSPEC
-		  && XINT (XEXP (constant, 0), 1) == UNSPEC_LTREL_OFFSET)
-		{
-		  gcc_assert (!pending_ltrel);
-		  pending_ltrel = pool_ref;
-		}
 	    }
 	}
 
@@ -8921,8 +8806,6 @@ s390_chunkify_start (void)
 	{
 	  if (curr_pool)
 	    s390_add_pool_insn (curr_pool, insn);
-	  /* An LTREL_BASE must follow within the same basic block.  */
-	  gcc_assert (!pending_ltrel);
 	}
 
       if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION)
@@ -8942,7 +8825,6 @@ s390_chunkify_start (void)
 
   if (curr_pool)
     s390_end_pool (curr_pool, NULL);
-  gcc_assert (!pending_ltrel);
 
   /* Find all labels that are branched into
      from an insn belonging to a different chunk.  */
@@ -9056,9 +8938,6 @@ s390_chunkify_finish (struct constant_pool *pool_list)
 
   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
     {
-      if (INSN_P (insn))
-	replace_ltrel_base (&PATTERN (insn));
-
       curr_pool = s390_find_pool (pool_list, insn);
       if (!curr_pool)
 	continue;
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index db260e41bfd..0d0f2181bfd 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -75,7 +75,6 @@
 
    ; GOT/PLT and lt-relative accesses
    UNSPEC_LTREL_OFFSET
-   UNSPEC_LTREL_BASE
    UNSPEC_POOL_OFFSET
    UNSPEC_GOTENT
    UNSPEC_GOT
-- 
2.18.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]