Commit 79c7de84 by Eric Botcazou Committed by Eric Botcazou

ipa-devirt.c (get_polymorphic_call_info_from_invariant): Return proper constants…

ipa-devirt.c (get_polymorphic_call_info_from_invariant): Return proper constants and fix formatting.

	* ipa-devirt.c (get_polymorphic_call_info_from_invariant): Return
	proper constants and fix formatting.
	(possible_polymorphic_call_targets): Fix formatting.

From-SVN: r207653
parent 04ea60cb
2014-02-10 Eric Botcazou <ebotcazou@adacore.com>
* ipa-devirt.c (get_polymorphic_call_info_from_invariant): Return
proper constants and fix formatting.
(possible_polymorphic_call_targets): Fix formatting.
2014-02-10 Kirill Yukhin <kirill.yukhin@intel.com> 2014-02-10 Kirill Yukhin <kirill.yukhin@intel.com>
Ilya Tocar <ilya.tocar@intel.com> Ilya Tocar <ilya.tocar@intel.com>
......
...@@ -1102,23 +1102,19 @@ get_polymorphic_call_info_from_invariant (ipa_polymorphic_call_context *context, ...@@ -1102,23 +1102,19 @@ get_polymorphic_call_info_from_invariant (ipa_polymorphic_call_context *context,
tree base; tree base;
if (TREE_CODE (cst) != ADDR_EXPR) if (TREE_CODE (cst) != ADDR_EXPR)
return NULL_TREE; return false;
cst = TREE_OPERAND (cst, 0); cst = TREE_OPERAND (cst, 0);
base = get_ref_base_and_extent (cst, &offset2, &size, &max_size); base = get_ref_base_and_extent (cst, &offset2, &size, &max_size);
if (!DECL_P (base) if (!DECL_P (base) || max_size == -1 || max_size != size)
|| max_size == -1 return false;
|| max_size != size)
return NULL_TREE;
/* Only type inconsistent programs can have otr_type that is /* Only type inconsistent programs can have otr_type that is
not part of outer type. */ not part of outer type. */
if (!contains_type_p (TREE_TYPE (base), if (!contains_type_p (TREE_TYPE (base), offset, otr_type))
offset, otr_type)) return false;
return NULL_TREE;
get_polymorphic_call_info_for_decl (context, get_polymorphic_call_info_for_decl (context, base, offset);
base, offset);
return true; return true;
} }
...@@ -1383,12 +1379,12 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1383,12 +1379,12 @@ possible_polymorphic_call_targets (tree otr_type,
tree binfo, target; tree binfo, target;
bool final; bool final;
if (!odr_hash.is_created ()) if (!odr_hash.is_created ())
{ {
if (completep) if (completep)
*completep = false; *completep = false;
return nodes; return nodes;
} }
type = get_odr_type (otr_type, true); type = get_odr_type (otr_type, true);
...@@ -1396,7 +1392,7 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1396,7 +1392,7 @@ possible_polymorphic_call_targets (tree otr_type,
if (context.outer_type) if (context.outer_type)
get_class_context (&context, otr_type); get_class_context (&context, otr_type);
/* We now canonicalize our query, so we do not need extra hashtable entries. */ /* We canonicalize our query, so we do not need extra hashtable entries. */
/* Without outer type, we have no use for offset. Just do the /* Without outer type, we have no use for offset. Just do the
basic search from innter type */ basic search from innter type */
...@@ -1457,7 +1453,6 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1457,7 +1453,6 @@ possible_polymorphic_call_targets (tree otr_type,
matched_vtables = pointer_set_create (); matched_vtables = pointer_set_create ();
/* First see virtual method of type itself. */ /* First see virtual method of type itself. */
binfo = get_binfo_at_offset (TYPE_BINFO (outer_type->type), binfo = get_binfo_at_offset (TYPE_BINFO (outer_type->type),
context.offset, otr_type); context.offset, otr_type);
target = gimple_get_virt_method_for_binfo (otr_token, binfo); target = gimple_get_virt_method_for_binfo (otr_token, binfo);
...@@ -1474,6 +1469,7 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1474,6 +1469,7 @@ possible_polymorphic_call_targets (tree otr_type,
is that it has been fully optimized out. */ is that it has been fully optimized out. */
else if (flag_ltrans || !type->anonymous_namespace) else if (flag_ltrans || !type->anonymous_namespace)
final = false; final = false;
pointer_set_insert (matched_vtables, BINFO_VTABLE (binfo)); pointer_set_insert (matched_vtables, BINFO_VTABLE (binfo));
/* Next walk bases, if asked to. */ /* Next walk bases, if asked to. */
...@@ -1492,10 +1488,12 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1492,10 +1488,12 @@ possible_polymorphic_call_targets (tree otr_type,
for (i = 0; i < outer_type->derived_types.length(); i++) for (i = 0; i < outer_type->derived_types.length(); i++)
possible_polymorphic_call_targets_1 (nodes, inserted, possible_polymorphic_call_targets_1 (nodes, inserted,
matched_vtables, matched_vtables,
otr_type, outer_type->derived_types[i], otr_type,
outer_type->derived_types[i],
otr_token, outer_type->type, otr_token, outer_type->type,
context.offset); context.offset);
} }
(*slot)->targets = nodes; (*slot)->targets = nodes;
(*slot)->final = final; (*slot)->final = final;
if (completep) if (completep)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment