[AArch64] Simplify aarch64_can_eliminate
authorWilco Dijkstra <wdijkstr@arm.com>
Wed, 8 Nov 2017 15:36:34 +0000 (15:36 +0000)
committerWilco Dijkstra <wilco@gcc.gnu.org>
Wed, 8 Nov 2017 15:36:34 +0000 (15:36 +0000)
Simplify aarch64_can_eliminate - if we need a frame pointer, we must
eliminate to HARD_FRAME_POINTER_REGNUM.  Rather than hardcoding all
combinations from the ELIMINABLE_REGS list, just do the correct check.

    gcc/
* config/aarch64/aarch64.c (aarch64_can_eliminate): Simplify logic.

From-SVN: r254534

gcc/ChangeLog
gcc/config/aarch64/aarch64.c

index d39de6b0320c73aec2f2899e4e71b8330d9fccac..e546a12d09ff1158d06e720e5a886458eb648f34 100644 (file)
@@ -1,3 +1,7 @@
+2017-11-08  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * config/aarch64/aarch64.c (aarch64_can_eliminate): Simplify logic.
+
 2017-11-08  Wilco Dijkstra  <wdijkstr@arm.com>
 
        * config/aarch64/aarch64.c (aarch64_frame_pointer_required)
index f58f192273e3ad313e154f28df0a88188cde36db..0c67e2b5c67ad7c31da4a7bda98f754b7d57192f 100644 (file)
@@ -5913,26 +5913,14 @@ aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x,
 }
 
 static bool
-aarch64_can_eliminate (const int from, const int to)
+aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
 {
-  /* If we need a frame pointer, we must eliminate FRAME_POINTER_REGNUM into
-     HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM.  */
+  gcc_assert (from == ARG_POINTER_REGNUM || from == FRAME_POINTER_REGNUM);
 
+  /* If we need a frame pointer, ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM
+     can only eliminate to HARD_FRAME_POINTER_REGNUM.  */
   if (frame_pointer_needed)
-    {
-      if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
-       return true;
-      if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
-       return false;
-      if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM
-         && !cfun->calls_alloca)
-       return true;
-      if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
-       return true;
-
-      return false;
-    }
-
+    return to == HARD_FRAME_POINTER_REGNUM;
   return true;
 }