aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorRamana Radhakrishnan <ramana.radhakrishnan@arm.com>2010-07-08 09:29:43 +0000
committerRamana Radhakrishnan <ramana@gcc.gnu.org>2010-07-08 09:29:43 +0000
commit2e1ec94ff0b0a954d540332b400d5376498ee7f7 (patch)
tree01b97f48f60b6b26a33e36c02e9c0c36908cc106 /gcc/cfgexpand.c
parenta03a9774c1c1ec8e9eac9c0f06cd52868d9fc452 (diff)
downloadgcc-2e1ec94ff0b0a954d540332b400d5376498ee7f7.zip
gcc-2e1ec94ff0b0a954d540332b400d5376498ee7f7.tar.gz
gcc-2e1ec94ff0b0a954d540332b400d5376498ee7f7.tar.bz2
Fix PR44768
From-SVN: r161947
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 5b0596e..b39d4db 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1252,8 +1252,8 @@ fini_vars_expansion (void)
stack_vars_alloc = stack_vars_num = 0;
}
-/* Make a fair guess for the size of the stack frame of the current
- function. This doesn't have to be exact, the result is only used
+/* Make a fair guess for the size of the stack frame of the decl
+ passed. This doesn't have to be exact, the result is only used
in the inline heuristics. So we don't want to run the full stack
var packing algorithm (which is quadratic in the number of stack
vars). Instead, we calculate the total size of all stack vars.
@@ -1261,12 +1261,15 @@ fini_vars_expansion (void)
vars doesn't happen very often. */
HOST_WIDE_INT
-estimated_stack_frame_size (void)
+estimated_stack_frame_size (tree decl)
{
HOST_WIDE_INT size = 0;
size_t i;
tree var, outer_block = DECL_INITIAL (current_function_decl);
unsigned ix;
+ tree old_cur_fun_decl = current_function_decl;
+ current_function_decl = decl;
+ push_cfun (DECL_STRUCT_FUNCTION (decl));
init_vars_expansion ();
@@ -1287,7 +1290,8 @@ estimated_stack_frame_size (void)
size += account_stack_vars ();
fini_vars_expansion ();
}
-
+ pop_cfun ();
+ current_function_decl = old_cur_fun_decl;
return size;
}