summaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-26 05:27:14 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-26 05:27:14 +0000
commita331ea1be592e3f0aaa83ec98705380680183f3f (patch)
tree8c9bcda4847f4df544cda5ec12d8094d3a8ec3f4 /gcc/calls.c
parent7008e67aa57e10dccfcae00dc5f05c3b53466e8c (diff)
downloadgcc-a331ea1be592e3f0aaa83ec98705380680183f3f.tar.gz
PR middle-end/17965
* calls.c (expand_call, emit_library_call_value_1): Use xmalloc/free instead of alloca for really big argument sizes. * gcc.c-torture/compile/20050622-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101333 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index b06830dcf82..1613e883746 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1864,6 +1864,7 @@ expand_call (tree exp, rtx target, int ignore)
int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
char *initial_stack_usage_map = stack_usage_map;
+ char *stack_usage_map_buf = NULL;
int old_stack_allocated;
@@ -2350,7 +2351,10 @@ expand_call (tree exp, rtx target, int ignore)
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
- stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
+ stack_usage_map = stack_usage_map_buf;
if (initial_highest_arg_in_use)
memcpy (stack_usage_map, initial_stack_usage_map,
@@ -2455,7 +2459,10 @@ expand_call (tree exp, rtx target, int ignore)
= stack_arg_under_construction;
stack_arg_under_construction = 0;
/* Make a new map for the new argument list. */
- stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
+ stack_usage_map = stack_usage_map_buf;
memset (stack_usage_map, 0, highest_outgoing_arg_in_use);
highest_outgoing_arg_in_use = 0;
}
@@ -3009,6 +3016,9 @@ expand_call (tree exp, rtx target, int ignore)
emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx);
}
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+
return target;
}
@@ -3203,6 +3213,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
/* Size of the stack reserved for parameter registers. */
int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
char *initial_stack_usage_map = stack_usage_map;
+ char *stack_usage_map_buf = NULL;
rtx struct_value = targetm.calls.struct_value_rtx (0, 0);
@@ -3481,7 +3492,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
- stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
+ stack_usage_map = stack_usage_map_buf;
if (initial_highest_arg_in_use)
memcpy (stack_usage_map, initial_stack_usage_map,
@@ -3835,6 +3847,9 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
stack_usage_map = initial_stack_usage_map;
}
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+
return value;
}