From 8745f023c47f9040665a037b95ae5115f928ecf3 Mon Sep 17 00:00:00 2001 From: hubicka Date: Tue, 4 Feb 2014 06:04:32 +0000 Subject: [PATCH] * gimple-fold.c (gimple_extract_devirt_binfo_from_cst): Remove. * gimple-fold.h (gimple_extract_devirt_binfo_from_cst): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207450 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++++ gcc/gimple-fold.c | 68 ------------------------------------------------------- gcc/gimple-fold.h | 1 - 3 files changed, 5 insertions(+), 69 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4c197a..b3fcc14 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2014-02-03 Jan Hubicka + * gimple-fold.c (gimple_extract_devirt_binfo_from_cst): Remove. + * gimple-fold.h (gimple_extract_devirt_binfo_from_cst): Remove. + +2014-02-03 Jan Hubicka + PR ipa/59831 * ipa-cp.c (ipa_get_indirect_edge_target_1): Use ipa-devirt to figure out targets of polymorphic calls with known decl. diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 848c1f6..43b49f1 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1071,74 +1071,6 @@ gimple_fold_builtin (gimple stmt) } -/* Return a binfo to be used for devirtualization of calls based on an object - represented by a declaration (i.e. a global or automatically allocated one) - or NULL if it cannot be found or is not safe. CST is expected to be an - ADDR_EXPR of such object or the function will return NULL. Currently it is - safe to use such binfo only if it has no base binfo (i.e. no ancestors) - EXPECTED_TYPE is type of the class virtual belongs to. */ - -tree -gimple_extract_devirt_binfo_from_cst (tree cst, tree expected_type) -{ - HOST_WIDE_INT offset, size, max_size; - tree base, type, binfo; - bool last_artificial = false; - - if (!flag_devirtualize - || TREE_CODE (cst) != ADDR_EXPR - || TREE_CODE (TREE_TYPE (TREE_TYPE (cst))) != RECORD_TYPE) - return NULL_TREE; - - cst = TREE_OPERAND (cst, 0); - base = get_ref_base_and_extent (cst, &offset, &size, &max_size); - type = TREE_TYPE (base); - if (!DECL_P (base) - || max_size == -1 - || max_size != size - || TREE_CODE (type) != RECORD_TYPE) - return NULL_TREE; - - /* Find the sub-object the constant actually refers to and mark whether it is - an artificial one (as opposed to a user-defined one). */ - while (true) - { - HOST_WIDE_INT pos, size; - tree fld; - - if (types_same_for_odr (type, expected_type)) - break; - if (offset < 0) - return NULL_TREE; - - for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld)) - { - if (TREE_CODE (fld) != FIELD_DECL) - continue; - - pos = int_bit_position (fld); - size = tree_to_uhwi (DECL_SIZE (fld)); - if (pos <= offset && (pos + size) > offset) - break; - } - if (!fld || TREE_CODE (TREE_TYPE (fld)) != RECORD_TYPE) - return NULL_TREE; - - last_artificial = DECL_ARTIFICIAL (fld); - type = TREE_TYPE (fld); - offset -= pos; - } - /* Artificial sub-objects are ancestors, we do not want to use them for - devirtualization, at least not here. */ - if (last_artificial) - return NULL_TREE; - binfo = TYPE_BINFO (type); - if (!binfo || BINFO_N_BASE_BINFOS (binfo) > 0) - return NULL_TREE; - else - return binfo; -} - /* Attempt to fold a call statement referenced by the statement iterator GSI. The statement may be replaced by another statement, e.g., if the call simplifies to a constant value. Return true if any changes were made. diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h index 3dbce9c..6d8746c 100644 --- a/gcc/gimple-fold.h +++ b/gcc/gimple-fold.h @@ -26,7 +26,6 @@ extern tree canonicalize_constructor_val (tree, tree); extern tree get_symbol_constant_value (tree); extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); extern tree gimple_fold_builtin (gimple); -extern tree gimple_extract_devirt_binfo_from_cst (tree, tree); extern bool fold_stmt (gimple_stmt_iterator *); extern bool fold_stmt_inplace (gimple_stmt_iterator *); extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, -- 2.7.4