aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2004-08-07 13:40:10 -0400
committerJason Merrill <jason@gcc.gnu.org>2004-08-07 13:40:10 -0400
commitcc77ae108d3b8cf9aa8bbbeada6c0c1fbcf8920f (patch)
tree252b73c82d55d0b8da42cb892207cf89b9b2d1bc /gcc/tree-inline.c
parent0737fbff594ae45dc2e37dc2eff51601cdb99e1b (diff)
downloadgcc-cc77ae108d3b8cf9aa8bbbeada6c0c1fbcf8920f.zip
gcc-cc77ae108d3b8cf9aa8bbbeada6c0c1fbcf8920f.tar.gz
gcc-cc77ae108d3b8cf9aa8bbbeada6c0c1fbcf8920f.tar.bz2
Make return in memory explicit.
* function.c (aggregate_value_p): Check DECL_BY_REFERENCE. (assign_parm_find_data_types): Remove code for old front end invisible reference handling. (assign_parms): Handle DECL_BY_REFERENCE on the RESULT_DECL. (expand_function_end): Likewise. * gimplify.c (gimplify_return_expr): Handle a dereferenced RESULT_DECL. * tree-inline.c (copy_body_r): Don't bother looking for &* anymore. (declare_return_variable): Handle DECL_BY_REFERENCE. * cp/cp-gimplify.c (is_invisiref_parm): Also handle RESULT_DECL. (cp_genericize_r): Use convert_from_reference. Don't dereference a RESULT_DECL directly inside a RETURN_EXPR. (cp_genericize): Handle the RESULT_DECL. Unset TREE_ADDRESSABLE. From-SVN: r85675
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 5dacddb..b34844d 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -573,33 +573,6 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
}
}
}
- else if (TREE_CODE (*tp) == ADDR_EXPR
- && (lang_hooks.tree_inlining.auto_var_in_fn_p
- (TREE_OPERAND (*tp, 0), fn)))
- {
- /* Get rid of &* from inline substitutions. It can occur when
- someone takes the address of a parm or return slot passed by
- invisible reference. */
- tree decl = TREE_OPERAND (*tp, 0), value;
- splay_tree_node n;
-
- n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
- if (n)
- {
- value = (tree) n->value;
- if (TREE_CODE (value) == INDIRECT_REF)
- {
- if (!lang_hooks.types_compatible_p
- (TREE_TYPE (*tp), TREE_TYPE (TREE_OPERAND (value, 0))))
- *tp = fold_convert (TREE_TYPE (*tp),
- TREE_OPERAND (value, 0));
- else
- *tp = TREE_OPERAND (value, 0);
-
- return copy_body_r (tp, walk_subtrees, data);
- }
- }
- }
else if (TREE_CODE (*tp) == INDIRECT_REF)
{
/* Get rid of *& from inline substitutions that can happen when a
@@ -861,7 +834,7 @@ declare_return_variable (inline_data *id, tree return_slot_addr,
return NULL_TREE;
}
- /* If there was a return slot, then the return value the the
+ /* If there was a return slot, then the return value is the
dereferenced address of that object. */
if (return_slot_addr)
{
@@ -869,7 +842,10 @@ declare_return_variable (inline_data *id, tree return_slot_addr,
a modify expression. */
if (modify_dest)
abort ();
- var = build_fold_indirect_ref (return_slot_addr);
+ if (DECL_BY_REFERENCE (result))
+ var = return_slot_addr;
+ else
+ var = build_fold_indirect_ref (return_slot_addr);
use = NULL;
goto done;
}