diff mbox series

[v2] S/390: Remove literal pool chunkification loop

Message ID 20180815105039.75001-1-iii@linux.ibm.com
State New
Headers show
Series [v2] S/390: Remove literal pool chunkification loop | expand

Commit Message

Ilya Leoshkevich Aug. 15, 2018, 10:50 a.m. UTC
Since there is no branch splitting anymore, the loop is no longer
necessary: pool chunkification can be done in one step.

gcc/ChangeLog:

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

	* config/s390/s390.c (s390_reorg): remove loop
---
 gcc/config/s390/s390.c | 68 ++++++++++--------------------------------
 1 file changed, 16 insertions(+), 52 deletions(-)

Comments

Andreas Krebbel Aug. 15, 2018, 12:25 p.m. UTC | #1
On 08/15/2018 12:50 PM, Ilya Leoshkevich wrote:
> gcc/ChangeLog:
> 
> 2018-08-13  Ilya Leoshkevich  <iii@linux.ibm.com>
> 
> 	* config/s390/s390.c (s390_reorg): remove loop

Applied. Thanks!

Andreas
diff mbox series

Patch

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 50bd316abfd..3e183ddb55c 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -13902,7 +13902,7 @@  s390_adjust_loops ()
 static void
 s390_reorg (void)
 {
-  bool pool_overflow = false;
+  struct constant_pool *pool;
   rtx_insn *insn;
   int hw_before, hw_after;
 
@@ -13914,62 +13914,26 @@  s390_reorg (void)
   split_all_insns_noflow ();
 
   /* Install the main literal pool and the associated base
-     register load insns.
-
-     In addition, there are two problematic situations we need
-     to correct:
-
-     - the literal pool might be > 4096 bytes in size, so that
-       some of its elements cannot be directly accessed
+     register load insns.  The literal pool might be > 4096 bytes in
+     size, so that some of its elements cannot be directly accessed.
 
-     - a branch target might be > 64K away from the branch, so that
-       it is not possible to use a PC-relative instruction.
-
-     To fix those, we split the single literal pool into multiple
+     To fix this, we split the single literal pool into multiple
      pool chunks, reloading the pool base register at various
      points throughout the function to ensure it always points to
-     the pool chunk the following code expects, and / or replace
-     PC-relative branches by absolute branches.
-
-     However, the two problems are interdependent: splitting the
-     literal pool can move a branch further away from its target,
-     causing the 64K limit to overflow, and on the other hand,
-     replacing a PC-relative branch by an absolute branch means
-     we need to put the branch target address into the literal
-     pool, possibly causing it to overflow.
+     the pool chunk the following code expects.  */
 
-     So, we loop trying to fix up both problems until we manage
-     to satisfy both conditions at the same time.  Note that the
-     loop is guaranteed to terminate as every pass of the loop
-     strictly decreases the total number of PC-relative branches
-     in the function.  (This is not completely true as there
-     might be branch-over-pool insns introduced by chunkify_start.
-     Those never need to be split however.)  */
-
-  for (;;)
+  /* Collect the literal pool.  */
+  pool = s390_mainpool_start ();
+  if (pool)
     {
-      struct constant_pool *pool = NULL;
-
-      /* Collect the literal pool.  */
-      if (!pool_overflow)
-	{
-	  pool = s390_mainpool_start ();
-	  if (!pool)
-	    pool_overflow = true;
-	}
-
-      /* If literal pool overflowed, start to chunkify it.  */
-      if (pool_overflow)
-	pool = s390_chunkify_start ();
-
-      /* If we made it up to here, both conditions are satisfied.
-	 Finish up literal pool related changes.  */
-      if (pool_overflow)
-	s390_chunkify_finish (pool);
-      else
-	s390_mainpool_finish (pool);
-
-      break;
+      /* Finish up literal pool related changes.  */
+      s390_mainpool_finish (pool);
+    }
+  else
+    {
+      /* If literal pool overflowed, chunkify it.  */
+      pool = s390_chunkify_start ();
+      s390_chunkify_finish (pool);
     }
 
   /* Generate out-of-pool execute target insns.  */