[NDS32] Optimize nds32_register_priority.
authorChung-Ju Wu <jasonwucj@gmail.com>
Sat, 17 Mar 2018 11:51:46 +0000 (11:51 +0000)
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>
Sat, 17 Mar 2018 11:51:46 +0000 (11:51 +0000)
gcc/
* config/nds32/nds32.c (nds32_register_priority): Modify cost.

From-SVN: r258619

gcc/ChangeLog
gcc/config/nds32/nds32.c

index 1063fd82f839e51084b6d96d71fd740f392d7552..0ff36d1ba2c617d41334a54372f9a837f25db43d 100644 (file)
@@ -1,3 +1,7 @@
+2018-03-17  Chung-Ju Wu  <jasonwucj@gmail.com>
+
+       * config/nds32/nds32.c (nds32_register_priority): Modify cost.
+
 2018-03-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/84902
index 80b00f147dd7110698bc9728dea3075fc9b8ace5..02b1eb40a9e408029b48c1a81266b9ea20e347ba 100644 (file)
@@ -1234,9 +1234,24 @@ static int
 nds32_register_priority (int hard_regno)
 {
   /* Encourage to use r0-r7 for LRA when optimize for size.  */
-  if (optimize_size && hard_regno < 8)
-    return 4;
-  return 3;
+  if (optimize_size)
+    {
+      if (hard_regno < 8)
+       return 4;
+      else if (hard_regno < 16)
+       return 3;
+      else if (hard_regno < 28)
+       return 2;
+      else
+       return 1;
+    }
+  else
+    {
+      if (hard_regno > 27)
+       return 1;
+      else
+       return 4;
+    }
 }
 
 \f