From c9c840c13dc62faacef97cd48369706e29da36e9 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 4 Dec 2012 09:09:12 +0000 Subject: [PATCH] ia64.c (ia64_compute_frame_size): Allocate the scratch area if the function allocates dynamic stack space. * config/ia64/ia64.c (ia64_compute_frame_size): Allocate the scratch area if the function allocates dynamic stack space. (ia64_initial_elimination_offset): Adjust offsets to above change. From-SVN: r194123 --- gcc/ChangeLog | 6 ++++++ gcc/config/ia64/ia64.c | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2eb5a7e3401b..600ebbcf4a88 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-12-03 Eric Botcazou + + * config/ia64/ia64.c (ia64_compute_frame_size): Allocate the scratch + area if the function allocates dynamic stack space. + (ia64_initial_elimination_offset): Adjust offsets to above change. + 2012-11-24 Richard Henderson PR libgcc/48076 diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 71de6978247d..ea2c549a4f4d 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -2830,8 +2830,10 @@ ia64_compute_frame_size (HOST_WIDE_INT size) /* We always use the 16-byte scratch area provided by the caller, but if we are a leaf function, there's no one to which we need to provide - a scratch area. */ - if (current_function_is_leaf) + a scratch area. However, if the function allocates dynamic stack space, + the dynamic offset is computed early and contains STACK_POINTER_OFFSET, + so we need to cope. */ + if (current_function_is_leaf && !cfun->calls_alloca) total_size = MAX (0, total_size - 16); current_frame_info.total_size = total_size; @@ -2865,18 +2867,15 @@ ia64_initial_elimination_offset (int from, int to) switch (to) { case HARD_FRAME_POINTER_REGNUM: - if (current_function_is_leaf) - offset = -current_frame_info.total_size; - else - offset = -(current_frame_info.total_size - - crtl->outgoing_args_size - 16); + offset = -current_frame_info.total_size; + if (!current_function_is_leaf || cfun->calls_alloca) + offset += 16 + crtl->outgoing_args_size; break; case STACK_POINTER_REGNUM: - if (current_function_is_leaf) - offset = 0; - else - offset = 16 + crtl->outgoing_args_size; + offset = 0; + if (!current_function_is_leaf || cfun->calls_alloca) + offset += 16 + crtl->outgoing_args_size; break; default: -- 2.47.2