diff options
author | Richard Henderson <rth@redhat.com> | 2004-08-10 21:16:07 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-08-10 21:16:07 -0700 |
commit | 1a186ec5586436555a30227776d75c2516fd5911 (patch) | |
tree | e57fc8a325147e3d2f9c065e1b28d63cdcb6c70a /gcc/fortran | |
parent | 89f1a7022ee2b62d67948797837c2a683bfa4995 (diff) | |
download | gcc-1a186ec5586436555a30227776d75c2516fd5911.zip gcc-1a186ec5586436555a30227776d75c2516fd5911.tar.gz gcc-1a186ec5586436555a30227776d75c2516fd5911.tar.bz2 |
builtins.def (BUILT_IN_STACK_ALLOC): Remove.
* builtins.def (BUILT_IN_STACK_ALLOC): Remove.
* builtins.c (expand_builtin) <BUILT_IN_STACK_ALLOC>: Remove.
* dwarf2out.c (loc_descriptor): Handle PARALLEL here ...
(add_location_or_const_value_attribute): ... not here. Use
loc_descriptor_from_tree if possible.
(loc_descriptor_from_tree_1): Rename from loc_descriptor_from_tree.
Simplify address handling. Handle DECL_VALUE_EXPR. Handle register
values specially.
(loc_descriptor_from_tree): New. Update callers.
* expr.c (expand_var): Ignore DECL_VALUE_EXPR variables.
* gimplify.c (gimplify_decl_expr): Lower variable sized types to
pointer plus dereference. Set DECL_VALUE_EXPR. Set save_stack.
(gimplify_call_expr): Do not recognize BUILT_IN_STACK_ALLOC
and BUILT_IN_STACK_RESTORE.
(gimplify_expr): Lower DECL_VALUE_EXPR decls.
* stmt.c (expand_stack_alloc): Remove.
* tree-mudflap.c (mx_register_decls): Don't look for
BUILT_IN_STACK_ALLOC.
* tree-nested.c (convert_local_reference): Likewise.
* tree.h (DECL_VALUE_EXPR): New.
ada/
* utils.c (gnat_install_builtins): Remove __builtin_stack_alloc,
add __builtin_alloca.
fortran/
* f95-lang.c (gfc_init_builtin_functions): Remove
__builtin_stack_alloc, add __builtin_alloca.
* trans-array.c (gfc_trans_auto_array_allocation): Use DECL_EXPR.
* trans-decl.c (gfc_trans_auto_character_variable): Likewise.
From-SVN: r85794
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/f95-lang.c | 16 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 12 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 21 |
4 files changed, 23 insertions, 33 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1dd0bc3..b45197d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2004-08-10 Richard Henderson <rth@redhat.com> + + * f95-lang.c (gfc_init_builtin_functions): Remove + __builtin_stack_alloc, add __builtin_alloca. + * trans-array.c (gfc_trans_auto_array_allocation): Use DECL_EXPR. + * trans-decl.c (gfc_trans_auto_character_variable): Likewise. + 2004-08-10 Paul Brook <paul@codesourcery.com> * trans-io.c (transfer_expr): Handle pointters. diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 78bf19a..3e8320c 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -794,21 +794,23 @@ gfc_init_builtin_functions (void) gfc_define_builtin ("__builtin_adjust_trampoline", ftype, BUILT_IN_ADJUST_TRAMPOLINE, "adjust_trampoline", true); - tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - ftype = build_function_type (pvoid_type_node, tmp); - gfc_define_builtin ("__builtin_stack_alloc", ftype, BUILT_IN_STACK_ALLOC, - "stack_alloc", false); + /* The stack_save, stack_restore, and alloca builtins aren't used directly. + They are inserted during gimplification to implement variable sized + stack allocation. */ - /* The stack_save and stack_restore builtins aren't used directly. They - are inserted during gimplification to implement stack_alloc calls. */ ftype = build_function_type (pvoid_type_node, void_list_node); gfc_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE, "stack_save", false); + tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node); ftype = build_function_type (void_type_node, tmp); gfc_define_builtin ("__builtin_stack_restore", ftype, BUILT_IN_STACK_RESTORE, "stack_restore", false); + + tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); + ftype = build_function_type (pvoid_type_node, tmp); + gfc_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA, + "alloca", false); } #undef DEFINE_MATH_BUILTIN diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index bc825bb..e267ebf 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -2926,15 +2926,9 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) { gfc_trans_init_string_length (sym->ts.cl, &block); - DECL_DEFER_OUTPUT (decl) = 1; - - /* Generate code to allocate the automatic variable. It will be - freed automatically. */ - tmp = gfc_build_addr_expr (NULL, decl); - args = gfc_chainon_list (NULL_TREE, tmp); - args = gfc_chainon_list (args, sym->ts.cl->backend_decl); - tmp = gfc_build_function_call (built_in_decls[BUILT_IN_STACK_ALLOC], - args); + /* Emit a DECL_EXPR for this variable, which will cause the + gimplifier to allocate stoage, and all that good stuff. */ + tmp = build (DECL_EXPR, TREE_TYPE (decl), decl); gfc_add_expr_to_block (&block, tmp); } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 5c68cb57..4710e15 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1626,7 +1626,6 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody) { stmtblock_t body; tree decl; - tree args; tree tmp; assert (sym->backend_decl); @@ -1639,23 +1638,11 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody) decl = sym->backend_decl; - DECL_DEFER_OUTPUT (decl) = 1; - - /* Since we don't use a DECL_STMT or equivalent, we have to deal - with getting these gimplified. But we can't gimplify it yet since - we're still generating statements. - - ??? This should be cleaned up and handled like other front ends. */ - gfc_add_expr_to_block (&body, save_expr (DECL_SIZE (decl))); - gfc_add_expr_to_block (&body, save_expr (DECL_SIZE_UNIT (decl))); - - /* Generate code to allocate the automatic variable. It will be freed - automatically. */ - tmp = gfc_build_addr_expr (NULL, decl); - args = gfc_chainon_list (NULL_TREE, tmp); - args = gfc_chainon_list (args, sym->ts.cl->backend_decl); - tmp = gfc_build_function_call (built_in_decls[BUILT_IN_STACK_ALLOC], args); + /* Emit a DECL_EXPR for this variable, which will cause the + gimplifier to allocate stoage, and all that good stuff. */ + tmp = build (DECL_EXPR, TREE_TYPE (decl), decl); gfc_add_expr_to_block (&body, tmp); + gfc_add_expr_to_block (&body, fnbody); return gfc_finish_block (&body); } |