summaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-06-06 17:10:51 +0200
committerYvan Roux <yvan.roux@linaro.org>2017-06-14 08:14:22 +0000
commita8e9362a9d31366981b14725883eded20cd867c9 (patch)
tree96d834aed4a7a88ba21fe3b0919c7bd4b9f92176 /gcc/config/arm
parent0a6f6b8deca08bfc496752eb94cda35aa73c5b33 (diff)
downloadgcc-a8e9362a9d31366981b14725883eded20cd867c9.tar.gz
gcc/
Backport from trunk r247750. 2017-05-08 Bernd Edlinger <bernd.edlinger@hotmail.de> * target.def (compute_frame_layout): New optional target hook. * doc/tm.texi.in (TARGET_COMPUTE_FRAME_LAYOUT): Add hook. * doc/tm.texi (TARGET_COMPUTE_FRAME_LAYOUT): Add documentation. * lra-eliminations.c (update_reg_eliminate): Call compute_frame_layout target hook. * reload1.c (verify_initial_elim_offsets): Likewise. * config/arm/arm.c (TARGET_COMPUTE_FRAME_LAYOUT): Define. (use_simple_return_p): Call arm_compute_frame_layout if needed. (arm_get_frame_offsets): Split up into this ... (arm_compute_frame_layout): ... and this function. Change-Id: Id438fc023af71b802eddf333f138767a706303fa
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 83914913433..acf821a594d 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -85,6 +85,7 @@ static bool arm_const_not_ok_for_debug_p (rtx);
static int arm_needs_doubleword_align (machine_mode, const_tree);
static int arm_compute_static_chain_stack_bytes (void);
static arm_stack_offsets *arm_get_frame_offsets (void);
+static void arm_compute_frame_layout (void);
static void arm_add_gc_roots (void);
static int arm_gen_constant (enum rtx_code, machine_mode, rtx,
unsigned HOST_WIDE_INT, rtx, rtx, int, int);
@@ -680,6 +681,9 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P arm_scalar_mode_supported_p
+#undef TARGET_COMPUTE_FRAME_LAYOUT
+#define TARGET_COMPUTE_FRAME_LAYOUT arm_compute_frame_layout
+
#undef TARGET_FRAME_POINTER_REQUIRED
#define TARGET_FRAME_POINTER_REQUIRED arm_frame_pointer_required
@@ -4031,6 +4035,10 @@ use_simple_return_p (void)
{
arm_stack_offsets *offsets;
+ /* Note this function can be called before or after reload. */
+ if (!reload_completed)
+ arm_compute_frame_layout ();
+
offsets = arm_get_frame_offsets ();
return offsets->outgoing_args != 0;
}
@@ -19105,7 +19113,7 @@ arm_compute_static_chain_stack_bytes (void)
/* Compute a bit mask of which registers need to be
saved on the stack for the current function.
- This is used by arm_get_frame_offsets, which may add extra registers. */
+ This is used by arm_compute_frame_layout, which may add extra registers. */
static unsigned long
arm_compute_save_reg_mask (void)
@@ -20739,12 +20747,25 @@ any_sibcall_could_use_r3 (void)
alignment. */
+/* Return cached stack offsets. */
+
+static arm_stack_offsets *
+arm_get_frame_offsets (void)
+{
+ struct arm_stack_offsets *offsets;
+
+ offsets = &cfun->machine->stack_offsets;
+
+ return offsets;
+}
+
+
/* Calculate stack offsets. These are used to calculate register elimination
offsets and in prologue/epilogue code. Also calculates which registers
should be saved. */
-static arm_stack_offsets *
-arm_get_frame_offsets (void)
+static void
+arm_compute_frame_layout (void)
{
struct arm_stack_offsets *offsets;
unsigned long func_type;
@@ -20755,9 +20776,6 @@ arm_get_frame_offsets (void)
offsets = &cfun->machine->stack_offsets;
- if (reload_completed)
- return offsets;
-
/* Initially this is the size of the local variables. It will translated
into an offset once we have determined the size of preceding data. */
frame_size = ROUND_UP_WORD (get_frame_size ());
@@ -20822,7 +20840,7 @@ arm_get_frame_offsets (void)
{
offsets->outgoing_args = offsets->soft_frame;
offsets->locals_base = offsets->soft_frame;
- return offsets;
+ return;
}
/* Ensure SFP has the correct alignment. */
@@ -20898,8 +20916,6 @@ arm_get_frame_offsets (void)
offsets->outgoing_args += 4;
gcc_assert (!(offsets->outgoing_args & 7));
}
-
- return offsets;
}