Commit 190bbd0b by Jan Hubicka Committed by Jan Hubicka

cgraph.h (symtab_node::has_aliases_p): Simplify.


	* cgraph.h (symtab_node::has_aliases_p): Simplify.
	(symtab_node::call_for_symbol_and_aliases): Use has_aliases_p
	* tree.c (lookup_binfo_at_offset): Make static.
	(get_binfo_at_offset): Do not shadow offset; add explanatory
	comment.

From-SVN: r220718
parent feb675e4
2015-02-15 Jan Hubicka <hubicka@ucw.cz>
* cgraph.h (symtab_node::has_aliases_p): Simplify.
(symtab_node::call_for_symbol_and_aliases): Use has_aliases_p
* tree.c (lookup_binfo_at_offset): Make static.
(get_binfo_at_offset): Do not shadow offset; add explanatory
comment.
2015-02-15 John David Anglin <danglin@gcc.gnu.org> 2015-02-15 John David Anglin <danglin@gcc.gnu.org>
* config/pa/pa.c (pa_secondary_reload): Request a secondary reload * config/pa/pa.c (pa_secondary_reload): Request a secondary reload
......
...@@ -2338,12 +2338,8 @@ inline bool ...@@ -2338,12 +2338,8 @@ inline bool
symtab_node::has_aliases_p (void) symtab_node::has_aliases_p (void)
{ {
ipa_ref *ref = NULL; ipa_ref *ref = NULL;
int i;
for (i = 0; iterate_direct_aliases (i, ref); i++) return (iterate_direct_aliases (0, ref) != NULL);
if (ref->use == IPA_REF_ALIAS)
return true;
return false;
} }
/* Return true when RESOLUTION indicate that linker will use /* Return true when RESOLUTION indicate that linker will use
...@@ -2984,11 +2980,9 @@ symtab_node::call_for_symbol_and_aliases (bool (*callback) (symtab_node *, ...@@ -2984,11 +2980,9 @@ symtab_node::call_for_symbol_and_aliases (bool (*callback) (symtab_node *,
void *data, void *data,
bool include_overwritable) bool include_overwritable)
{ {
ipa_ref *ref;
if (callback (this, data)) if (callback (this, data))
return true; return true;
if (iterate_direct_aliases (0, ref)) if (has_aliases_p ())
return call_for_symbol_and_aliases_1 (callback, data, include_overwritable); return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
return false; return false;
} }
...@@ -3003,13 +2997,10 @@ cgraph_node::call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, ...@@ -3003,13 +2997,10 @@ cgraph_node::call_for_symbol_and_aliases (bool (*callback) (cgraph_node *,
void *data, void *data,
bool include_overwritable) bool include_overwritable)
{ {
ipa_ref *ref;
if (callback (this, data)) if (callback (this, data))
return true; return true;
if (iterate_direct_aliases (0, ref)) if (has_aliases_p ())
return call_for_symbol_and_aliases_1 (callback, data, include_overwritable); return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
return false; return false;
} }
...@@ -3023,13 +3014,10 @@ varpool_node::call_for_symbol_and_aliases (bool (*callback) (varpool_node *, ...@@ -3023,13 +3014,10 @@ varpool_node::call_for_symbol_and_aliases (bool (*callback) (varpool_node *,
void *data, void *data,
bool include_overwritable) bool include_overwritable)
{ {
ipa_ref *ref;
if (callback (this, data)) if (callback (this, data))
return true; return true;
if (iterate_direct_aliases (0, ref)) if (has_aliases_p ())
return call_for_symbol_and_aliases_1 (callback, data, include_overwritable); return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
return false; return false;
} }
......
...@@ -11992,7 +11992,7 @@ type_in_anonymous_namespace_p (const_tree t) ...@@ -11992,7 +11992,7 @@ type_in_anonymous_namespace_p (const_tree t)
/* Lookup sub-BINFO of BINFO of TYPE at offset POS. */ /* Lookup sub-BINFO of BINFO of TYPE at offset POS. */
tree static tree
lookup_binfo_at_offset (tree binfo, tree type, HOST_WIDE_INT pos) lookup_binfo_at_offset (tree binfo, tree type, HOST_WIDE_INT pos)
{ {
unsigned int i; unsigned int i;
...@@ -12045,11 +12045,13 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) ...@@ -12045,11 +12045,13 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
else if (offset != 0) else if (offset != 0)
{ {
tree found_binfo = NULL, base_binfo; tree found_binfo = NULL, base_binfo;
int offset = (tree_to_shwi (BINFO_OFFSET (binfo)) + pos /* Offsets in BINFO are in bytes relative to the whole structure
/ BITS_PER_UNIT); while POS is in bits relative to the containing field. */
int binfo_offset = (tree_to_shwi (BINFO_OFFSET (binfo)) + pos
/ BITS_PER_UNIT);
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++) for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
if (tree_to_shwi (BINFO_OFFSET (base_binfo)) == offset if (tree_to_shwi (BINFO_OFFSET (base_binfo)) == binfo_offset
&& types_same_for_odr (TREE_TYPE (base_binfo), TREE_TYPE (fld))) && types_same_for_odr (TREE_TYPE (base_binfo), TREE_TYPE (fld)))
{ {
found_binfo = base_binfo; found_binfo = base_binfo;
...@@ -12058,7 +12060,8 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) ...@@ -12058,7 +12060,8 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
if (found_binfo) if (found_binfo)
binfo = found_binfo; binfo = found_binfo;
else else
binfo = lookup_binfo_at_offset (binfo, TREE_TYPE (fld), offset); binfo = lookup_binfo_at_offset (binfo, TREE_TYPE (fld),
binfo_offset);
} }
type = TREE_TYPE (fld); type = TREE_TYPE (fld);
......
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