Commit 53e5ace2 by Renlin Li Committed by Marcus Shawcroft

[AArch64] Fix aarch64_initial_elimination_offset calculation.

This patch fixes the elimination offset calculation.  This is a latent
bug hidden by the frame alignment calculation.


Co-Authored-By: Jiong Wang <jiong.wang@arm.com>

From-SVN: r209636
parent 78c29983
2014-04-22 Renlin <renlin.li@arm.com>
Jiong Wang <jiong.wang@arm.com>
* config/aarch64/aarch64.h (aarch64_frame): Delete "fp_lr_offset".
* config/aarch64/aarch64.c (aarch64_layout_frame)
(aarch64_initial_elimination_offset): Likewise.
2014-04-22 Marcus Shawcroft <marcus.shawcroft@arm.com> 2014-04-22 Marcus Shawcroft <marcus.shawcroft@arm.com>
* config/aarch64/aarch64.c (aarch64_initial_elimination_offset): * config/aarch64/aarch64.c (aarch64_initial_elimination_offset):
......
...@@ -1713,8 +1713,6 @@ aarch64_layout_frame (void) ...@@ -1713,8 +1713,6 @@ aarch64_layout_frame (void)
if (reload_completed && cfun->machine->frame.laid_out) if (reload_completed && cfun->machine->frame.laid_out)
return; return;
cfun->machine->frame.fp_lr_offset = 0;
/* First mark all the registers that really need to be saved... */ /* First mark all the registers that really need to be saved... */
for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++)
cfun->machine->frame.reg_offset[regno] = -1; cfun->machine->frame.reg_offset[regno] = -1;
...@@ -1764,14 +1762,12 @@ aarch64_layout_frame (void) ...@@ -1764,14 +1762,12 @@ aarch64_layout_frame (void)
{ {
cfun->machine->frame.reg_offset[R29_REGNUM] = offset; cfun->machine->frame.reg_offset[R29_REGNUM] = offset;
offset += UNITS_PER_WORD; offset += UNITS_PER_WORD;
cfun->machine->frame.fp_lr_offset = UNITS_PER_WORD;
} }
if (cfun->machine->frame.reg_offset[R30_REGNUM] != -1) if (cfun->machine->frame.reg_offset[R30_REGNUM] != -1)
{ {
cfun->machine->frame.reg_offset[R30_REGNUM] = offset; cfun->machine->frame.reg_offset[R30_REGNUM] = offset;
offset += UNITS_PER_WORD; offset += UNITS_PER_WORD;
cfun->machine->frame.fp_lr_offset += UNITS_PER_WORD;
} }
cfun->machine->frame.padding0 = cfun->machine->frame.padding0 =
...@@ -4165,8 +4161,7 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) ...@@ -4165,8 +4161,7 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to)
{ {
HOST_WIDE_INT elim = crtl->outgoing_args_size HOST_WIDE_INT elim = crtl->outgoing_args_size
+ cfun->machine->frame.saved_regs_size + cfun->machine->frame.saved_regs_size
+ get_frame_size () + get_frame_size ();
- cfun->machine->frame.fp_lr_offset;
elim = AARCH64_ROUND_UP (elim, STACK_BOUNDARY / BITS_PER_UNIT); elim = AARCH64_ROUND_UP (elim, STACK_BOUNDARY / BITS_PER_UNIT);
return elim; return elim;
} }
......
...@@ -520,7 +520,6 @@ struct GTY (()) aarch64_frame ...@@ -520,7 +520,6 @@ struct GTY (()) aarch64_frame
been saved. */ been saved. */
HOST_WIDE_INT padding0; HOST_WIDE_INT padding0;
HOST_WIDE_INT hardfp_offset; /* HARD_FRAME_POINTER_REGNUM */ HOST_WIDE_INT hardfp_offset; /* HARD_FRAME_POINTER_REGNUM */
HOST_WIDE_INT fp_lr_offset; /* Space needed for saving fp and/or lr */
bool laid_out; bool laid_out;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment