diff mbox

[1/4] AArch64: Fix register_move_cost

Message ID 000c01cfc84e$bb5c33e0$32149ba0$@com
State New
Headers show

Commit Message

Wilco Sept. 4, 2014, 2:44 p.m. UTC
Hi,

This is a set of patches improving register costs on AArch64. The first fixes
aarch64_register_move_cost() to support CALLER_SAVE_REGS and POINTER_REGS so costs are calculated
correctly in the register allocator.

ChangeLog:
2014-09-04  Wilco Dijkstra  <wdijkstr@arm.com>

	* gcc/config/aarch64/aarch64.c (aarch64_register_move_cost):
	Add cost handling of CALLER_SAVE_REGS and POINTER_REGS.

---
 gcc/config/aarch64/aarch64.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Marcus Shawcroft Sept. 4, 2014, 3:22 p.m. UTC | #1
On 4 September 2014 15:44, Wilco Dijkstra <wdijkstr@arm.com> wrote:
> Hi,
>
> This is a set of patches improving register costs on AArch64. The first fixes
> aarch64_register_move_cost() to support CALLER_SAVE_REGS and POINTER_REGS so costs are calculated
> correctly in the register allocator.
>
> ChangeLog:
> 2014-09-04  Wilco Dijkstra  <wdijkstr@arm.com>
>
>         * gcc/config/aarch64/aarch64.c (aarch64_register_move_cost):
>         Add cost handling of CALLER_SAVE_REGS and POINTER_REGS.

OK /Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index befdfbb..6245f59 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5817,6 +5817,13 @@  aarch64_register_move_cost (enum machine_mode mode,
   const struct cpu_regmove_cost *regmove_cost
     = aarch64_tune_params->regmove_cost;
 
+  /* Caller save and pointer regs are equivalent to GENERAL_REGS.  */
+  if (to == CALLER_SAVE_REGS || to == POINTER_REGS)
+    to = GENERAL_REGS;
+
+  if (from == CALLER_SAVE_REGS || from == POINTER_REGS)
+    from = GENERAL_REGS;
+
   /* Moving between GPR and stack cost is the same as GP2GP.  */
   if ((from == GENERAL_REGS && to == STACK_REG)
       || (to == GENERAL_REGS && from == STACK_REG))