diff mbox

[1/4] AArch64: Fix register_move_cost

Message ID 001801cfcdd3$1b87ec80$5297c580$@com
State New
Headers show

Commit Message

Wilco Sept. 11, 2014, 3:14 p.m. UTC
Patch attached for commit as I don't have write access.

> -----Original Message-----
> From: Marcus Shawcroft [mailto:marcus.shawcroft@gmail.com]
> Sent: 04 September 2014 16:23
> To: Wilco Dijkstra
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH 1/4] AArch64: Fix register_move_cost
> 
> 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
---
 gcc/config/aarch64/aarch64.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 023f9fd..56b8eda 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5932,6 +5932,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))