aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-08-16 14:38:04 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-08-16 12:38:04 +0000
commitc49bdb2ee934ab6efddbf9284cba5c76f6f3dd28 (patch)
tree71b7f3809446131bd9d0c013ed500b7b38f3350e /gcc/tree.c
parent4042dca916ad7f5a99438e37416d4fed2209cc6d (diff)
downloadgcc-c49bdb2ee934ab6efddbf9284cba5c76f6f3dd28.zip
gcc-c49bdb2ee934ab6efddbf9284cba5c76f6f3dd28.tar.gz
gcc-c49bdb2ee934ab6efddbf9284cba5c76f6f3dd28.tar.bz2
gimple-fold.c (gimple_extract_devirt_binfo_from_cst): Add new arugment expected_type.
* gimple-fold.c (gimple_extract_devirt_binfo_from_cst): Add new arugment expected_type. (gimple_fold_call): Use it. * gimple.h (gimple_extract_devirt_binfo_from_cst): Update prototype. * ipa-cp.c (ipa_get_indirect_edge_target_1): Update. * ipa-prop.c (ipa_analyze_virtual_call_uses): Use obj_type_ref_class. (try_make_edge_direct_virtual_call): Likewise. * tree.c (obj_type_ref_class): New. * tree.h (obj_type_ref_class): Use it. From-SVN: r201789
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index a1c0dea..9480c73 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11864,6 +11864,21 @@ types_same_for_odr (tree type1, tree type2)
return true;
}
+/* REF is OBJ_TYPE_REF, return the class the ref corresponds to. */
+
+tree
+obj_type_ref_class (tree ref)
+{
+ gcc_checking_assert (TREE_CODE (ref) == OBJ_TYPE_REF);
+ ref = TREE_TYPE (ref);
+ gcc_checking_assert (TREE_CODE (ref) == POINTER_TYPE);
+ ref = TREE_TYPE (ref);
+ gcc_checking_assert (TREE_CODE (ref) == METHOD_TYPE);
+ ref = TREE_VALUE (TYPE_ARG_TYPES (ref));
+ gcc_checking_assert (TREE_CODE (ref) == POINTER_TYPE);
+ return TREE_TYPE (ref);
+}
+
/* Try to find a base info of BINFO that would have its field decl at offset
OFFSET within the BINFO type and which is of EXPECTED_TYPE. If it can be
found, return, otherwise return NULL_TREE. */