aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2011-09-23 13:22:43 +0000
committerMartin Jambor <mjambor@suse.cz>2011-09-23 13:22:43 +0000
commit503b87fed73a886d63df786ae06990a657d129c1 (patch)
tree6135c26161cc96ff691578b1f52f3932115d3f86 /gcc/ipa-cp.c
parentc4c9cdc38986817f44dbc44acf7c941f4342fd17 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@179117 138bc75d-0d04-0410-961f-82ee72b054a4
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 f440b1dc74d..45cb00b2169 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);