diff options
author | Marcus Shawcroft <marcus.shawcroft@arm.com> | 2014-06-05 13:19:44 +0000 |
---|---|---|
committer | Marcus Shawcroft <mshawcroft@gcc.gnu.org> | 2014-06-05 13:19:44 +0000 |
commit | 1c960e02e70a5dce595b909867d888206da010a5 (patch) | |
tree | 9b13e1d65f2053cf31324ea269dd219493af9c5c | |
parent | 95cc0a1aca2eaf2303ab49d09ce4525ece4fd3e6 (diff) | |
download | gcc-1c960e02e70a5dce595b909867d888206da010a5.zip gcc-1c960e02e70a5dce595b909867d888206da010a5.tar.gz gcc-1c960e02e70a5dce595b909867d888206da010a5.tar.bz2 |
[AArch64] Add frame_size and hard_fp_offset to machine.frame
From-SVN: r211275
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 89 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.h | 11 |
3 files changed, 59 insertions, 53 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b553eca..7f70e2b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -4,6 +4,18 @@ before accessing it. 2014-06-05 Marcus Shawcroft <marcus.shawcroft@arm.com> + + * config/aarch64/aarch64.h (aarch64_frame): Add hard_fp_offset and + frame_size. + * config/aarch64/aarch64.c (aarch64_layout_frame): Initialize + aarch64_frame hard_fp_offset and frame_size. + (aarch64_expand_prologue): Use aarch64_frame hard_fp_offset and + frame_size; remove original_frame_size. + (aarch64_expand_epilogue, aarch64_final_eh_return_addr): Likewise. + (aarch64_initial_elimination_offset): Remove frame_size and + offset. Use aarch64_frame frame_size. + +2014-06-05 Marcus Shawcroft <marcus.shawcroft@arm.com> Jiong Wang <jiong.wang@arm.com> * config/aarch64/aarch64.c (aarch64_layout_frame): Correct diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 1aa951c..621692e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1868,6 +1868,18 @@ aarch64_layout_frame (void) offset = AARCH64_ROUND_UP (offset, STACK_BOUNDARY / BITS_PER_UNIT); cfun->machine->frame.saved_regs_size = offset; + + cfun->machine->frame.hard_fp_offset + = AARCH64_ROUND_UP (cfun->machine->frame.saved_varargs_size + + get_frame_size () + + cfun->machine->frame.saved_regs_size, + STACK_BOUNDARY / BITS_PER_UNIT); + + cfun->machine->frame.frame_size + = AARCH64_ROUND_UP (cfun->machine->frame.hard_fp_offset + + crtl->outgoing_args_size, + STACK_BOUNDARY / BITS_PER_UNIT); + cfun->machine->frame.laid_out = true; } @@ -2118,26 +2130,20 @@ aarch64_expand_prologue (void) sub sp, sp, <final_adjustment_if_any> */ - HOST_WIDE_INT original_frame_size; /* local variables + vararg save */ HOST_WIDE_INT frame_size, offset; - HOST_WIDE_INT fp_offset; /* FP offset from SP */ + HOST_WIDE_INT fp_offset; /* Offset from hard FP to SP. */ rtx insn; aarch64_layout_frame (); - original_frame_size = get_frame_size () + cfun->machine->frame.saved_varargs_size; - gcc_assert ((!cfun->machine->frame.saved_varargs_size || cfun->stdarg) - && (cfun->stdarg || !cfun->machine->frame.saved_varargs_size)); - frame_size = (original_frame_size + cfun->machine->frame.saved_regs_size - + crtl->outgoing_args_size); - offset = frame_size = AARCH64_ROUND_UP (frame_size, - STACK_BOUNDARY / BITS_PER_UNIT); if (flag_stack_usage_info) - current_function_static_stack_size = frame_size; + current_function_static_stack_size = cfun->machine->frame.frame_size; + + frame_size = cfun->machine->frame.frame_size; + offset = cfun->machine->frame.frame_size; - fp_offset = (offset - - original_frame_size - - cfun->machine->frame.saved_regs_size); + fp_offset = cfun->machine->frame.frame_size + - cfun->machine->frame.hard_fp_offset; /* Store pairs and load pairs have a range only -512 to 504. */ if (offset >= 512) @@ -2148,7 +2154,7 @@ aarch64_expand_prologue (void) register area. This will allow the pre-index write-back store pair instructions to be used for setting up the stack frame efficiently. */ - offset = original_frame_size + cfun->machine->frame.saved_regs_size; + offset = cfun->machine->frame.hard_fp_offset; if (offset >= 512) offset = cfun->machine->frame.saved_regs_size; @@ -2284,28 +2290,23 @@ aarch64_expand_prologue (void) void aarch64_expand_epilogue (bool for_sibcall) { - HOST_WIDE_INT original_frame_size, frame_size, offset; + HOST_WIDE_INT frame_size, offset; HOST_WIDE_INT fp_offset; rtx insn; rtx cfa_reg; aarch64_layout_frame (); - original_frame_size = get_frame_size () + cfun->machine->frame.saved_varargs_size; - frame_size = (original_frame_size + cfun->machine->frame.saved_regs_size - + crtl->outgoing_args_size); - offset = frame_size = AARCH64_ROUND_UP (frame_size, - STACK_BOUNDARY / BITS_PER_UNIT); - fp_offset = (offset - - original_frame_size - - cfun->machine->frame.saved_regs_size); + offset = frame_size = cfun->machine->frame.frame_size; + fp_offset = cfun->machine->frame.frame_size + - cfun->machine->frame.hard_fp_offset; cfa_reg = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx; /* Store pairs and load pairs have a range only -512 to 504. */ if (offset >= 512) { - offset = original_frame_size + cfun->machine->frame.saved_regs_size; + offset = cfun->machine->frame.hard_fp_offset; if (offset >= 512) offset = cfun->machine->frame.saved_regs_size; @@ -2487,16 +2488,12 @@ aarch64_expand_epilogue (bool for_sibcall) rtx aarch64_final_eh_return_addr (void) { - HOST_WIDE_INT original_frame_size, frame_size, offset, fp_offset; + HOST_WIDE_INT fp_offset; + aarch64_layout_frame (); - original_frame_size = get_frame_size () + cfun->machine->frame.saved_varargs_size; - frame_size = (original_frame_size + cfun->machine->frame.saved_regs_size - + crtl->outgoing_args_size); - offset = frame_size = AARCH64_ROUND_UP (frame_size, - STACK_BOUNDARY / BITS_PER_UNIT); - fp_offset = offset - - original_frame_size - - cfun->machine->frame.saved_regs_size; + + fp_offset = cfun->machine->frame.frame_size + - cfun->machine->frame.hard_fp_offset; if (cfun->machine->frame.reg_offset[LR_REGNUM] < 0) return gen_rtx_REG (DImode, LR_REGNUM); @@ -4246,42 +4243,28 @@ aarch64_can_eliminate (const int from, const int to) HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned from, unsigned to) { - HOST_WIDE_INT frame_size; - HOST_WIDE_INT offset; - aarch64_layout_frame (); - frame_size = (get_frame_size () + cfun->machine->frame.saved_regs_size - + crtl->outgoing_args_size - + cfun->machine->frame.saved_varargs_size); - - frame_size = AARCH64_ROUND_UP (frame_size, STACK_BOUNDARY / BITS_PER_UNIT); - offset = frame_size; if (to == HARD_FRAME_POINTER_REGNUM) { if (from == ARG_POINTER_REGNUM) - return offset - crtl->outgoing_args_size; + return cfun->machine->frame.frame_size - crtl->outgoing_args_size; if (from == FRAME_POINTER_REGNUM) - return cfun->machine->frame.saved_regs_size + get_frame_size (); + return (cfun->machine->frame.hard_fp_offset + - cfun->machine->frame.saved_varargs_size); } if (to == STACK_POINTER_REGNUM) { if (from == FRAME_POINTER_REGNUM) - { - HOST_WIDE_INT elim = crtl->outgoing_args_size - + cfun->machine->frame.saved_regs_size - + get_frame_size (); - elim = AARCH64_ROUND_UP (elim, STACK_BOUNDARY / BITS_PER_UNIT); - return elim; - } + return (cfun->machine->frame.frame_size + - cfun->machine->frame.saved_varargs_size); } - return offset; + return cfun->machine->frame.frame_size; } - /* Implement RETURN_ADDR_RTX. We do not support moving back to a previous frame. */ diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 392d095..ae94356 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -527,6 +527,17 @@ struct GTY (()) aarch64_frame HOST_WIDE_INT padding0; HOST_WIDE_INT hardfp_offset; /* HARD_FRAME_POINTER_REGNUM */ + /* Offset from the base of the frame (incomming SP) to the + hard_frame_pointer. This value is always a multiple of + STACK_BOUNDARY. */ + HOST_WIDE_INT hard_fp_offset; + + /* The size of the frame. This value is the offset from base of the + * frame (incomming SP) to the stack_pointer. This value is always + * a multiple of STACK_BOUNDARY. */ + + HOST_WIDE_INT frame_size; + bool laid_out; }; |