Commit f21add07 by Jason Merrill Committed by Jason Merrill

C++ ABI change: destroy value arguments in caller.

        * calls.c (initialize_argument_information): Pass the address of
        the TARGET_EXPR temporary rather than storing it into another.
        * semantics.c (genrtl_start_function, genrtl_finish_function): Don't
        create an extra binding level for the parameters.
        * decl.c (store_parm_decls): Don't do parameter cleanups.

From-SVN: r48154
parent 769317c5
2001-12-18 Jason Merrill <jason@redhat.com>
C++ ABI change: destroy value arguments in caller.
* calls.c (initialize_argument_information): Pass the address of
the TARGET_EXPR temporary rather than storing it into another.
Tue Dec 18 07:09:06 2001 Douglas B. Rupp <rupp@gnat.com> Tue Dec 18 07:09:06 2001 Douglas B. Rupp <rupp@gnat.com>
* config/alpha/xm-vms.h (INCLUDE_DEFAULTS): Add /gnu/include. * config/alpha/xm-vms.h (INCLUDE_DEFAULTS): Add /gnu/include.
......
...@@ -1212,6 +1212,16 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args, ...@@ -1212,6 +1212,16 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args,
args[i].tree_value); args[i].tree_value);
type = build_pointer_type (type); type = build_pointer_type (type);
} }
else if (TREE_CODE (args[i].tree_value) == TARGET_EXPR)
{
/* In the V3 C++ ABI, parameters are destroyed in the caller.
We implement this by passing the address of the temporary
rather than expanding it into another allocated slot. */
args[i].tree_value = build1 (ADDR_EXPR,
build_pointer_type (type),
args[i].tree_value);
type = build_pointer_type (type);
}
else else
{ {
/* We make a copy of the object and pass the address to the /* We make a copy of the object and pass the address to the
......
2001-12-18 Jason Merrill <jason@redhat.com>
C++ ABI change: destroy value arguments in caller.
* semantics.c (genrtl_start_function, genrtl_finish_function): Don't
create an extra binding level for the parameters.
* decl.c (store_parm_decls): Don't do parameter cleanups.
2001-12-18 Nathan Sidwell <nathan@codesourcery.com> 2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
* call.c (build_new_method_call): Use '%#V'. * call.c (build_new_method_call): Use '%#V'.
......
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
forms of `operator delete[]', and declared the two-argument form forms of `operator delete[]', and declared the two-argument form
before the one-argument form. before the one-argument form.
* The C++ ABI has been changed so that when a parameter is passed by value,
any cleanup for that parameter is performed in the caller, as specified
by the ia64 C++ ABI, rather than the called function as before.
*** Changes in GCC 3.0: *** Changes in GCC 3.0:
* Support for guiding declarations has been removed. * Support for guiding declarations has been removed.
......
...@@ -13790,7 +13790,6 @@ store_parm_decls (current_function_parms) ...@@ -13790,7 +13790,6 @@ store_parm_decls (current_function_parms)
{ {
register tree fndecl = current_function_decl; register tree fndecl = current_function_decl;
register tree parm; register tree parm;
tree cleanups = NULL_TREE;
/* This is a chain of any other decls that came in among the parm /* This is a chain of any other decls that came in among the parm
declarations. If a parm is declared with enum {foo, bar} x; declarations. If a parm is declared with enum {foo, bar} x;
...@@ -13821,20 +13820,11 @@ store_parm_decls (current_function_parms) ...@@ -13821,20 +13820,11 @@ store_parm_decls (current_function_parms)
next = TREE_CHAIN (parm); next = TREE_CHAIN (parm);
if (TREE_CODE (parm) == PARM_DECL) if (TREE_CODE (parm) == PARM_DECL)
{ {
tree cleanup;
if (DECL_NAME (parm) == NULL_TREE if (DECL_NAME (parm) == NULL_TREE
|| TREE_CODE (parm) != VOID_TYPE) || TREE_CODE (parm) != VOID_TYPE)
pushdecl (parm); pushdecl (parm);
else else
error ("parameter `%D' declared void", parm); error ("parameter `%D' declared void", parm);
cleanup = (processing_template_decl
? NULL_TREE
: maybe_build_cleanup (parm));
if (cleanup)
cleanups = tree_cons (parm, cleanup, cleanups);
} }
else else
{ {
...@@ -13860,16 +13850,6 @@ store_parm_decls (current_function_parms) ...@@ -13860,16 +13850,6 @@ store_parm_decls (current_function_parms)
DECL_ARGUMENTS is not modified. */ DECL_ARGUMENTS is not modified. */
storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl))); storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl)));
/* Now that we have initialized the parms, we can start their
cleanups. We cannot do this before, since expand_decl_cleanup
should not be called before the parm can be used. */
while (cleanups)
{
finish_decl_cleanup (TREE_PURPOSE (cleanups),
TREE_VALUE (cleanups));
cleanups = TREE_CHAIN (cleanups);
}
/* Do the starting of the exception specifications, if we have any. */ /* Do the starting of the exception specifications, if we have any. */
if (flag_exceptions && !processing_template_decl if (flag_exceptions && !processing_template_decl
&& flag_enforce_eh_specs && flag_enforce_eh_specs
......
...@@ -2610,7 +2610,6 @@ genrtl_start_function (fn) ...@@ -2610,7 +2610,6 @@ genrtl_start_function (fn)
++function_depth; ++function_depth;
/* Create a binding level for the parameters. */ /* Create a binding level for the parameters. */
expand_start_bindings (2);
expand_function_start (fn, /*parms_have_cleanups=*/0); expand_function_start (fn, /*parms_have_cleanups=*/0);
/* If this function is `main'. */ /* If this function is `main'. */
if (DECL_MAIN_P (fn)) if (DECL_MAIN_P (fn))
...@@ -2667,7 +2666,7 @@ genrtl_finish_function (fn) ...@@ -2667,7 +2666,7 @@ genrtl_finish_function (fn)
immediate_size_expand = 1; immediate_size_expand = 1;
/* Generate rtl for function exit. */ /* Generate rtl for function exit. */
expand_function_end (input_filename, lineno, 1); expand_function_end (input_filename, lineno, 0);
/* If this is a nested function (like a template instantiation that /* If this is a nested function (like a template instantiation that
we're compiling in the midst of compiling something else), push a we're compiling in the midst of compiling something else), push a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment