This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Lowering of VLA's, part 2
On Wed, 27 Aug 2003 23:31:29 +0200, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
> Hello,
>
>> > * gimplify.c (struct tree_p_list): New type.
>> > (join_tree_p_list, add_tree_p_list, free_tree_p_list,
>> > build_stack_save_restore, prepend_to_exit_gotos): New functions.
>>
>> Use a TRY_FINALLY_EXPR instead.
>
> here it is.
Thank you.
> gimplify_stmt (&BIND_EXPR_BODY (bind_expr));
> + if (gimplify_ctxp->save_stack)
> + {
> + tree stack_save, stack_restore;
> +
> + /* Save stack on entry and restore it on exit. Add a try_finally
> + block to achieve this. */
> + build_stack_save_restore (&stack_save, &stack_restore);
> + add_tree (stack_save, pre_p);
> + BIND_EXPR_BODY (bind_expr) = build (TRY_FINALLY_EXPR, void_type_node,
> + BIND_EXPR_BODY (bind_expr),
> + stack_restore);
The stack save should also go inside the BIND_EXPR, but before the
TRY_FINALLY_EXPR.
Also, you need to make sure that you don't add these again if the BIND_EXPR
gets gimplified again.
Some style notes:
+ /* Prepare calls to builtins to SAVE and RESTORE the stack as well as temporary
+ through that they comunicate. */
+ static void
+ build_stack_save_restore (tree *save, tree *restore)
Blank line between comment and function.
+ {
+ tree save_call, tmp_var;
+
+ save_call = build_function_call_expr (
+ implicit_built_in_decls[BUILT_IN_STACK_SAVE],
+ NULL_TREE);
I'd format this as
save_call
= build_function_call_expr (implicit_built_in_decls[BUILT_IN_STACK_SAVE],
NULL_TREE);
or, if that doesn't fit in 80 columns either,
save_call = build_function_call_expr
(implicit_built_in_decls[BUILT_IN_STACK_SAVE],
NULL_TREE);
Jason