summaryrefslogtreecommitdiff
path: root/gcc/ipa-prop.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-24 09:18:32 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-24 09:18:32 +0000
commite87fbe2b1bc4b8a85c646e420b2b14ac7ea489fc (patch)
treef35b682ae42e13d2e7d1db2156aa0aa3f29e5367 /gcc/ipa-prop.c
parentcc8f9d4a8c19f55e89c2858bbf985f8d15a51c65 (diff)
downloadgcc-e87fbe2b1bc4b8a85c646e420b2b14ac7ea489fc.tar.gz
2011-06-24 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 175370 using svnmerge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@175371 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r--gcc/ipa-prop.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 10c11d41ae6..aec1920c62e 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1,5 +1,5 @@
/* Interprocedural analyses.
- Copyright (C) 2005, 2007, 2008, 2009, 2010
+ Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@@ -2393,6 +2393,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
ipa_parm_adjustment_vec adjustments)
{
VEC(tree, heap) *vargs;
+ VEC(tree, gc) **debug_args = NULL;
gimple new_stmt;
gimple_stmt_iterator gsi;
tree callee_decl;
@@ -2400,6 +2401,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
len = VEC_length (ipa_parm_adjustment_t, adjustments);
vargs = VEC_alloc (tree, heap, len);
+ callee_decl = !cs ? gimple_call_fndecl (stmt) : cs->callee->decl;
gsi = gsi_for_stmt (stmt);
for (i = 0; i < len; i++)
@@ -2490,6 +2492,42 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
NULL, true, GSI_SAME_STMT);
VEC_quick_push (tree, vargs, expr);
}
+ if (!adj->copy_param && MAY_HAVE_DEBUG_STMTS)
+ {
+ unsigned int ix;
+ tree ddecl = NULL_TREE, origin = DECL_ORIGIN (adj->base), arg;
+ gimple def_temp;
+
+ arg = gimple_call_arg (stmt, adj->base_index);
+ if (!useless_type_conversion_p (TREE_TYPE (origin), TREE_TYPE (arg)))
+ {
+ if (!fold_convertible_p (TREE_TYPE (origin), arg))
+ continue;
+ arg = fold_convert_loc (gimple_location (stmt),
+ TREE_TYPE (origin), arg);
+ }
+ if (debug_args == NULL)
+ debug_args = decl_debug_args_insert (callee_decl);
+ for (ix = 0; VEC_iterate (tree, *debug_args, ix, ddecl); ix += 2)
+ if (ddecl == origin)
+ {
+ ddecl = VEC_index (tree, *debug_args, ix + 1);
+ break;
+ }
+ if (ddecl == NULL)
+ {
+ ddecl = make_node (DEBUG_EXPR_DECL);
+ DECL_ARTIFICIAL (ddecl) = 1;
+ TREE_TYPE (ddecl) = TREE_TYPE (origin);
+ DECL_MODE (ddecl) = DECL_MODE (origin);
+
+ VEC_safe_push (tree, gc, *debug_args, origin);
+ VEC_safe_push (tree, gc, *debug_args, ddecl);
+ }
+ def_temp = gimple_build_debug_bind (ddecl, unshare_expr (arg),
+ stmt);
+ gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT);
+ }
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2498,7 +2536,6 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
print_gimple_stmt (dump_file, gsi_stmt (gsi), 0, 0);
}
- callee_decl = !cs ? gimple_call_fndecl (stmt) : cs->callee->decl;
new_stmt = gimple_build_call_vec (callee_decl, vargs);
VEC_free (tree, heap, vargs);
if (gimple_call_lhs (stmt))