aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-08-13 19:38:39 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-08-13 19:38:39 +0000
commit7aec7a38d7283e5eb83db7f0dc9556202214c5f0 (patch)
tree923c9ec3f6319b2aca98cf53c729f7eb221b396c /gcc
parent70a1c2f9595135edb6224c2cc1006968f3416cb2 (diff)
downloadgcc-7aec7a38d7283e5eb83db7f0dc9556202214c5f0.zip
gcc-7aec7a38d7283e5eb83db7f0dc9556202214c5f0.tar.gz
gcc-7aec7a38d7283e5eb83db7f0dc9556202214c5f0.tar.bz2
gimple.h (gimple_call_set_chain): Accept SSA variables.
* gimple.h (gimple_call_set_chain): Accept SSA variables. * tree-ssa-pre.c (create_component_ref_by_pieces_1) <CALL_EXPR>: Rematerialize the static chain, if any. * tree-ssa-sccvn.c (copy_reference_ops_from_call): Also copy the static chain. From-SVN: r139072
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple.h2
-rw-r--r--gcc/tree-ssa-pre.c10
-rw-r--r--gcc/tree-ssa-sccvn.c5
4 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ad4b63b..c6cf33c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple.h (gimple_call_set_chain): Accept SSA variables.
+ * tree-ssa-pre.c (create_component_ref_by_pieces_1) <CALL_EXPR>:
+ Rematerialize the static chain, if any.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_call): Also copy the
+ static chain.
+
2008-08-13 H.J. Lu <hongjiu.lu@intel.com>
* dwarf2out.c (dwarf_stack_op_name): Remove prototype.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 3799e06..2f6af03 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2013,7 +2013,7 @@ gimple_call_set_chain (gimple gs, tree chain)
GIMPLE_CHECK (gs, GIMPLE_CALL);
gcc_assert (chain == NULL
|| TREE_CODE (chain) == ADDR_EXPR
- || DECL_P (chain));
+ || SSA_VAR_P (chain));
gimple_set_op (gs, 2, chain);
}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 336c54e..9e8ff56 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2436,7 +2436,7 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
{
case CALL_EXPR:
{
- tree folded;
+ tree folded, sc = currop->op1;
unsigned int nargs = 0;
tree *args = XNEWVEC (tree, VEC_length (vn_reference_op_s,
ref->operands) - 1);
@@ -2453,6 +2453,14 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
: currop->op0,
nargs, args);
free (args);
+ if (sc)
+ {
+ pre_expr scexpr = get_or_alloc_expr_for (sc);
+ sc = find_or_generate_expression (block, scexpr, stmts, domstmt);
+ if (!sc)
+ return NULL_TREE;
+ CALL_EXPR_STATIC_CHAIN (folded) = sc;
+ }
return folded;
}
break;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index f6492bd..f502440 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -686,12 +686,12 @@ copy_reference_ops_from_call (gimple call,
vn_reference_op_s temp;
unsigned i;
- /* Copy the call_expr opcode, type, function being called, and
- arguments. */
+ /* Copy the type, opcode, function being called and static chain. */
memset (&temp, 0, sizeof (temp));
temp.type = gimple_call_return_type (call);
temp.opcode = CALL_EXPR;
temp.op0 = gimple_call_fn (call);
+ temp.op1 = gimple_call_chain (call);
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
/* Copy the call arguments. As they can be references as well,
@@ -701,7 +701,6 @@ copy_reference_ops_from_call (gimple call,
tree callarg = gimple_call_arg (call, i);
copy_reference_ops_from_ref (callarg, result);
}
- return;
}
/* Create a vector of vn_reference_op_s structures from REF, a