aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2011-09-23 15:22:43 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2011-09-23 15:22:43 +0200
commitc75732496d9ad114b50a9a94b71d028bf4168059 (patch)
tree6135c26161cc96ff691578b1f52f3932115d3f86 /gcc/ipa-cp.c
parent5d94b9886327df3f4b977d4bc0d1d09c1b6d3220 (diff)
downloadgcc-c75732496d9ad114b50a9a94b71d028bf4168059.zip
gcc-c75732496d9ad114b50a9a94b71d028bf4168059.tar.gz
gcc-c75732496d9ad114b50a9a94b71d028bf4168059.tar.bz2
ipa-prop.h (jump_func_type): Updated comments.
2011-09-23 Martin Jambor <mjambor@suse.cz> * ipa-prop.h (jump_func_type): Updated comments. (ipa_known_type_data): New type. (ipa_jump_func): Use it to describe known type jump functions. * ipa-prop.c (ipa_print_node_jump_functions_for_edge): Updated to reflect the new known type jump function contents. (compute_known_type_jump_func): Likewise. (combine_known_type_and_ancestor_jfs): Likewise. (try_make_edge_direct_virtual_call): Likewise. (ipa_write_jump_function): Likewise. (ipa_read_jump_function): Likewise. * ipa-cp.c (ipa_value_from_known_type_jfunc): New function. (ipa_value_from_jfunc): Use ipa_value_from_known_type_jfunc. (propagate_accross_jump_function): Likewise. From-SVN: r179117
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f440b1d..45cb00b 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -674,6 +674,20 @@ ipa_get_jf_ancestor_result (struct ipa_jump_func *jfunc, tree input)
return NULL_TREE;
}
+/* Extract the acual BINFO being described by JFUNC which must be a known type
+ jump function. */
+
+static tree
+ipa_value_from_known_type_jfunc (struct ipa_jump_func *jfunc)
+{
+ tree base_binfo = TYPE_BINFO (jfunc->value.known_type.base_type);
+ if (!base_binfo)
+ return NULL_TREE;
+ return get_binfo_at_offset (base_binfo,
+ jfunc->value.known_type.offset,
+ jfunc->value.known_type.component_type);
+}
+
/* Determine whether JFUNC evaluates to a known value (that is either a
constant or a binfo) and if so, return it. Otherwise return NULL. INFO
describes the caller node so that pass-through jump functions can be
@@ -685,7 +699,7 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
if (jfunc->type == IPA_JF_CONST)
return jfunc->value.constant;
else if (jfunc->type == IPA_JF_KNOWN_TYPE)
- return jfunc->value.base_binfo;
+ return ipa_value_from_known_type_jfunc (jfunc);
else if (jfunc->type == IPA_JF_PASS_THROUGH
|| jfunc->type == IPA_JF_ANCESTOR)
{
@@ -991,7 +1005,11 @@ propagate_accross_jump_function (struct cgraph_edge *cs,
tree val;
if (jfunc->type == IPA_JF_KNOWN_TYPE)
- val = jfunc->value.base_binfo;
+ {
+ val = ipa_value_from_known_type_jfunc (jfunc);
+ if (!val)
+ return set_lattice_contains_variable (dest_lat);
+ }
else
val = jfunc->value.constant;
return add_value_to_lattice (dest_lat, val, cs, NULL, 0);