summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oblock <gary@amperecomputing.com>2020-11-05 14:46:53 -0800
committerGary Oblock <gary@amperecomputing.com>2020-11-05 14:46:53 -0800
commit5deed0527c5765dee3835430de1dbcfe59ed4678 (patch)
tree9ec930211523a59e7227761fff8ae1ca0b1b35ea
parent2ec2b87557c832cda4041ccb15ebd612a98a6e33 (diff)
This is the const_tree to const transformation.
It also has some debugging changes in the other files.
-rw-r--r--gcc/ipa-dfe.c164
-rw-r--r--gcc/ipa-dfe.h80
-rw-r--r--gcc/ipa-field-reorder.c72
-rw-r--r--gcc/ipa-str-reorg-instance-interleave.c172
-rw-r--r--gcc/ipa-structure-reorg.c44
-rw-r--r--gcc/ipa-structure-reorg.h4
-rw-r--r--gcc/ipa-type-escape-analysis.c610
-rw-r--r--gcc/ipa-type-escape-analysis.h312
8 files changed, 735 insertions, 723 deletions
diff --git a/gcc/ipa-dfe.c b/gcc/ipa-dfe.c
index 08e20f73f45..eb244a76be9 100644
--- a/gcc/ipa-dfe.c
+++ b/gcc/ipa-dfe.c
@@ -126,22 +126,22 @@ along with GCC; see the file COPYING3. If not see
* Find all non_escaping types which point to RECORD_TYPEs in
* record_field_offset_map.
*/
-std::set<const_tree>
+std::set<tree>
get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
tpartitions_t casting)
{
const tset_t &non_escaping = casting.non_escaping;
- std::set<const_tree> specific_types;
+ std::set<tree> specific_types;
TypeStringifier stringifier;
// Here we are just placing the types of interest in a set.
- for (std::map<const_tree, field_offsets_t>::const_iterator i
+ for (std::map<tree, field_offsets_t>::const_iterator i
= record_field_offset_map.begin (),
e = record_field_offset_map.end ();
i != e; ++i)
{
- const_tree record = i->first;
+ tree record = i->first;
std::string name = stringifier.stringify (record);
specific_types.insert (record);
}
@@ -150,16 +150,16 @@ get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
// SpecificTypeCollector will collect all types which point to the types in
// the set.
- for (std::set<const_tree>::const_iterator i = non_escaping.begin (),
+ for (std::set<tree>::const_iterator i = non_escaping.begin (),
e = non_escaping.end ();
i != e; ++i)
{
- const_tree type = *i;
+ tree type = *i;
specifier.walk (type);
}
// These are all the types which need modifications.
- std::set<const_tree> to_modify = specifier.get_set ();
+ std::set<tree> to_modify = specifier.get_set ();
return to_modify;
}
@@ -178,24 +178,24 @@ get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
*/
reorg_maps_t
get_types_replacement (record_field_offset_map_t record_field_offset_map,
- std::set<const_tree> to_modify)
+ std::set<tree> to_modify)
{
TypeStringifier stringifier;
TypeReconstructor reconstructor (record_field_offset_map, "reorg");
- for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+ for (std::set<tree>::const_iterator i = to_modify.begin (),
e = to_modify.end ();
i != e; ++i)
{
- const_tree record = *i;
+ tree record = *i;
reconstructor.walk (TYPE_MAIN_VARIANT (record));
}
- for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+ for (std::set<tree>::const_iterator i = to_modify.begin (),
e = to_modify.end ();
i != e; ++i)
{
- const_tree record = *i;
+ tree record = *i;
reconstructor.walk (record);
}
@@ -205,11 +205,11 @@ get_types_replacement (record_field_offset_map_t record_field_offset_map,
// Here, we are just making sure that we are not doing anything too crazy.
// Also, we found some types for which TYPE_CACHED_VALUES_P is not being
// rewritten. This is probably indicative of a bug in TypeReconstructor.
- for (std::map<const_tree, tree>::const_iterator i = map.begin (),
+ for (std::map<tree, tree>::const_iterator i = map.begin (),
e = map.end ();
i != e; ++i)
{
- const_tree o_record = i->first;
+ tree o_record = i->first;
std::string o_name = stringifier.stringify (o_record);
log ("original: %s\n", o_name.c_str ());
tree r_record = i->second;
@@ -220,7 +220,7 @@ get_types_replacement (record_field_offset_map_t record_field_offset_map,
continue;
tree m_record = TYPE_MAIN_VARIANT (r_record);
// Info: We had a bug where some TYPED_CACHED_VALUES were preserved?
- tree _o_record = const_tree_to_tree (o_record);
+ tree _o_record = tree_to_tree (o_record);
TYPE_CACHED_VALUES_P (_o_record) = false;
TYPE_CACHED_VALUES_P (m_record) = false;
@@ -252,44 +252,44 @@ substitute_types_in_program (reorg_record_map_t map,
/* Return a set of trees which point to the set of trees
* that can be modified.
*/
-std::set<const_tree>
+std::set<tree>
SpecificTypeCollector::get_set ()
{
return to_return;
}
void
-SpecificTypeCollector::_walk_POINTER_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_POINTER_TYPE_pre (tree t)
{
path.insert (t);
}
void
-SpecificTypeCollector::_walk_POINTER_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_POINTER_TYPE_post (tree t)
{
path.erase (t);
}
void
-SpecificTypeCollector::_walk_ARRAY_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_ARRAY_TYPE_pre (tree t)
{
path.insert (t);
}
void
-SpecificTypeCollector::_walk_ARRAY_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_ARRAY_TYPE_post (tree t)
{
path.erase (t);
}
void
-SpecificTypeCollector::_walk_UNION_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_UNION_TYPE_pre (tree t)
{
path.insert (t);
}
void
-SpecificTypeCollector::_walk_UNION_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_UNION_TYPE_post (tree t)
{
path.erase (t);
}
@@ -298,7 +298,7 @@ SpecificTypeCollector::_walk_UNION_TYPE_post (const_tree t)
* all types which we are currently keeping track of in TO_RETURN.
*/
void
-SpecificTypeCollector::_walk_RECORD_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_RECORD_TYPE_pre (tree t)
{
const bool in_set
= _collect_these_types.find (t) != _collect_these_types.end ();
@@ -307,17 +307,17 @@ SpecificTypeCollector::_walk_RECORD_TYPE_pre (const_tree t)
if (!must_collect)
return;
- for (std::set<const_tree>::const_iterator i = path.begin (),
+ for (std::set<tree>::const_iterator i = path.begin (),
e = path.end ();
i != e; ++i)
{
- const_tree type = *i;
+ tree type = *i;
to_return.insert (type);
}
}
void
-SpecificTypeCollector::_walk_RECORD_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_RECORD_TYPE_post (tree t)
{
path.erase (t);
}
@@ -341,7 +341,7 @@ TypeReconstructor::get_field_map ()
}
void
-TypeReconstructor::set_is_not_modified_yet (const_tree t)
+TypeReconstructor::set_is_not_modified_yet (tree t)
{
gcc_assert (t);
const bool is_in_reorg_map = _reorg_map.find (t) != _reorg_map.end ();
@@ -349,7 +349,7 @@ TypeReconstructor::set_is_not_modified_yet (const_tree t)
if (is_in_reorg_map)
mark_all_pointing_here_as_modified ();
- const_tree tt = TREE_TYPE (t);
+ tree tt = TREE_TYPE (t);
if (!tt)
return;
@@ -379,7 +379,7 @@ TypeReconstructor::mark_all_pointing_here_as_modified ()
}
bool
-TypeReconstructor::get_is_modified (const_tree t)
+TypeReconstructor::get_is_modified (tree t)
{
gcc_assert (t);
const bool in_map = modified_map.find (t) != modified_map.end ();
@@ -388,7 +388,7 @@ TypeReconstructor::get_is_modified (const_tree t)
modified_map.erase (t);
bool points_to_record = false;
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree tt = _t;
while (TREE_TYPE (tt))
{
@@ -400,7 +400,7 @@ TypeReconstructor::get_is_modified (const_tree t)
}
bool
-TypeReconstructor::is_memoized (const_tree t)
+TypeReconstructor::is_memoized (tree t)
{
const bool already_changed = _reorg_map.find (t) != _reorg_map.end ();
mark_all_pointing_here_as_modified ();
@@ -414,7 +414,7 @@ TypeReconstructor::get_new_suffix ()
}
tree
-get_new_identifier (const_tree type, const char *suffix)
+get_new_identifier (tree type, const char *suffix)
{
const char *identifier = TypeStringifier::get_type_identifier (type).c_str ();
const bool is_new_type = strstr (identifier, suffix);
@@ -443,12 +443,12 @@ get_new_identifier (const_tree type, const char *suffix)
//
//
void
-TypeReconstructor::_walk_ARRAY_TYPE_pre (const_tree t)
+TypeReconstructor::_walk_ARRAY_TYPE_pre (tree t)
{
for_reference.push (t);
set_is_not_modified_yet (t);
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree copy = build_variant_type_copy (_t);
tree domain = TYPE_DOMAIN (t);
if (domain)
@@ -463,9 +463,9 @@ TypeReconstructor::_walk_ARRAY_TYPE_pre (const_tree t)
}
void
-TypeReconstructor::_walk_ARRAY_TYPE_post (const_tree t)
+TypeReconstructor::_walk_ARRAY_TYPE_post (tree t)
{
- const_tree t2 = for_reference.top ();
+ tree t2 = for_reference.top ();
gcc_assert (t2 == t);
for_reference.pop ();
tree copy = in_progress.top ();
@@ -493,7 +493,7 @@ TypeReconstructor::_walk_ARRAY_TYPE_post (const_tree t)
if (is_modified)
layout_type (copy);
TYPE_CACHED_VALUES_P (copy) = false;
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree tt = _t;
while (TREE_TYPE (tt))
{
@@ -508,20 +508,20 @@ TypeReconstructor::_walk_ARRAY_TYPE_post (const_tree t)
}
void
-TypeReconstructor::_walk_POINTER_TYPE_pre (const_tree t)
+TypeReconstructor::_walk_POINTER_TYPE_pre (tree t)
{
for_reference.push (t);
set_is_not_modified_yet (t);
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree copy = build_variant_type_copy (_t);
in_progress.push (copy);
}
void
-TypeReconstructor::_walk_POINTER_TYPE_post (const_tree t)
+TypeReconstructor::_walk_POINTER_TYPE_post (tree t)
{
- const_tree t2 = for_reference.top ();
+ tree t2 = for_reference.top ();
gcc_assert (t2 == t);
for_reference.pop ();
tree copy = in_progress.top ();
@@ -536,7 +536,7 @@ TypeReconstructor::_walk_POINTER_TYPE_post (const_tree t)
: TYPE_NAME (copy);
TYPE_CACHED_VALUES_P (copy) = false;
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree tt = _t;
while (TREE_TYPE (tt))
{
@@ -550,12 +550,12 @@ TypeReconstructor::_walk_POINTER_TYPE_post (const_tree t)
}
void
-TypeReconstructor::_walk_RECORD_TYPE_pre (const_tree t)
+TypeReconstructor::_walk_RECORD_TYPE_pre (tree t)
{
const bool is_main_variant = TYPE_MAIN_VARIANT (t) == t;
if (!is_main_variant)
{
- const_tree main_variant = TYPE_MAIN_VARIANT (t);
+ tree main_variant = TYPE_MAIN_VARIANT (t);
_walk_RECORD_TYPE_pre (main_variant);
TypeWalker::_walk_RECORD_TYPE (main_variant);
_walk_RECORD_TYPE_post (main_variant);
@@ -565,16 +565,16 @@ TypeReconstructor::_walk_RECORD_TYPE_pre (const_tree t)
for_reference.push (t);
// We don't know if we will modify this type t
// So, let's make a copy. Just in case.
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree copy = build_variant_type_copy (_t);
in_progress.push (copy);
field_list_stack.push (field_tuple_list_t ());
}
void
-TypeReconstructor::_walk_RECORD_TYPE_post (const_tree t)
+TypeReconstructor::_walk_RECORD_TYPE_post (tree t)
{
- const_tree t2 = for_reference.top ();
+ tree t2 = for_reference.top ();
gcc_assert (t2 == t);
for_reference.pop ();
@@ -648,7 +648,7 @@ TypeReconstructor::_walk_RECORD_TYPE_post (const_tree t)
TYPE_MAIN_VARIANT (copy) = is_modified ? copy : TYPE_MAIN_VARIANT (copy);
if (is_modified)
layout_type (copy);
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
_reorg_map[t] = is_modified ? copy : _t;
}
@@ -660,13 +660,13 @@ TypeReconstructor::_walk_RECORD_TYPE_post (const_tree t)
}
void
-TypeReconstructor::_walk_field_pre (const_tree t)
+TypeReconstructor::_walk_field_pre (tree t)
{
for_reference.push (t);
// We don't know if we will rewrite the field
// that we are working on. So proactively, let's make
// a copy.
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
tree copy = copy_node (_t);
tree type_copy = build_variant_type_copy ((TREE_TYPE (_t)));
TREE_TYPE (copy) = type_copy;
@@ -676,9 +676,9 @@ TypeReconstructor::_walk_field_pre (const_tree t)
}
void
-TypeReconstructor::_walk_field_post (const_tree t)
+TypeReconstructor::_walk_field_post (tree t)
{
- const_tree t2 = for_reference.top ();
+ tree t2 = for_reference.top ();
gcc_assert (t2 == t);
for_reference.pop ();
@@ -688,7 +688,7 @@ TypeReconstructor::_walk_field_post (const_tree t)
in_progress.pop ();
// What record does this field belongs to?
- const_tree record = for_reference.top ();
+ tree record = for_reference.top ();
field_offsets_t field_offsets = _records[record];
// What's the field offset?
@@ -700,7 +700,7 @@ TypeReconstructor::_walk_field_post (const_tree t)
= field_offsets.find (f_offset) != field_offsets.end ();
if (can_field_be_deleted)
mark_all_pointing_here_as_modified ();
- const_tree original_type = TREE_TYPE (t);
+ tree original_type = TREE_TYPE (t);
const bool type_memoized = is_memoized (original_type);
TREE_TYPE (copy)
@@ -719,9 +719,9 @@ TypeReconstructor::_walk_field_post (const_tree t)
// Relayout parameters
void
-ExprTypeRewriter::_walk_PARM_DECL_post (const_tree t)
+ExprTypeRewriter::_walk_PARM_DECL_post (tree t)
{
- tree temp = const_tree_to_tree (t);
+ tree temp = tree_to_tree (t);
tree ttemp = TREE_TYPE (temp);
TypeStringifier stringifier;
const char *name = stringifier.stringify (ttemp).c_str ();
@@ -734,7 +734,7 @@ ExprTypeRewriter::_walk_PARM_DECL_post (const_tree t)
// Update return types
void
-ExprTypeRewriter::_walk_FUNCTION_DECL_post (const_tree t)
+ExprTypeRewriter::_walk_FUNCTION_DECL_post (tree t)
{
tree fn_type = TREE_TYPE (t);
// This is saying that we cannot have indirect functions
@@ -760,7 +760,7 @@ ExprTypeRewriter::_walk_FUNCTION_DECL_post (const_tree t)
// Rewrite MEM_REF operand 1
void
-ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
+ExprTypeRewriter::_walk_MEM_REF_post (tree e)
{
tree op0 = TREE_OPERAND (e, 0);
tree t2 = TREE_TYPE (op0);
@@ -774,7 +774,7 @@ ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
{
log ("success\n");
tree r_t = _map[t2];
- tree _e = const_tree_to_tree (op0);
+ tree _e = tree_to_tree (op0);
TREE_TYPE (_e) = r_t;
}
// The second operand is a pointer constant.
@@ -789,9 +789,9 @@ ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
if (!already_rewritten)
return;
- const_tree old_type = _imap[t];
+ tree old_type = _imap[t];
assert_is_type (old_type, POINTER_TYPE);
- const_tree old_base_type = TREE_TYPE (old_type);
+ tree old_base_type = TREE_TYPE (old_type);
tree old_type_size_tree = TYPE_SIZE_UNIT (old_base_type);
int old_type_size_int = tree_to_shwi (old_type_size_tree);
@@ -809,7 +809,7 @@ ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
= old_offset / old_type_size_int * reorg_type_size_int + remainder;
tree new_offset_tree = build_int_cst (TREE_TYPE (op1), new_offset);
- tree _e = const_tree_to_tree (e);
+ tree _e = tree_to_tree (e);
TREE_OPERAND (_e, 1) = new_offset_tree;
}
@@ -823,8 +823,8 @@ ExprTypeRewriter::is_interesting_type (tree t)
if (!interesting)
return false;
- const_tree const_possibly_copy = _imap[t];
- tree possibly_copy = const_tree_to_tree (const_possibly_copy);
+ tree const_possibly_copy = _imap[t];
+ tree possibly_copy = tree_to_tree (const_possibly_copy);
const bool is_copy = possibly_copy == t;
interesting = !is_copy;
if (!interesting)
@@ -865,8 +865,8 @@ ExprTypeRewriter::handle_pointer_arithmetic_diff (gimple *s, tree op_0)
tree reorg_type_size_tree = TYPE_SIZE_UNIT (inner_reorg_type);
int reorg_type_size_int = tree_to_shwi (reorg_type_size_tree);
- const_tree const_old_type = _imap[reorg_type];
- tree old_type = const_tree_to_tree (const_old_type);
+ tree const_old_type = _imap[reorg_type];
+ tree old_type = tree_to_tree (const_old_type);
tree inner_old_type = TREE_TYPE (old_type);
gcc_assert (old_type);
tree old_type_size_tree = TYPE_SIZE_UNIT (inner_old_type);
@@ -980,8 +980,8 @@ ExprTypeRewriter::handle_pointer_arithmetic_nonconstant (gimple *s, tree op_0,
tree reorg_type_size_tree = TYPE_SIZE_UNIT (reorg_inner_type);
int reorg_type_size_int = tree_to_shwi (reorg_type_size_tree);
// That means that the old type is
- const_tree const_old_type_tree = _imap[reorg_type_tree];
- tree old_type_tree = const_tree_to_tree (const_old_type_tree);
+ tree const_old_type_tree = _imap[reorg_type_tree];
+ tree old_type_tree = tree_to_tree (const_old_type_tree);
tree old_inner_type = TREE_TYPE (old_type_tree);
tree old_type_size_tree = TYPE_SIZE_UNIT (old_inner_type);
int old_type_size_int = tree_to_shwi (old_type_size_tree);
@@ -1056,7 +1056,7 @@ ExprTypeRewriter::handle_pointer_arithmetic_constants (gimple *s, tree p,
return;
tree reorg_type = possibly_reorged_type; // this is the type of the variable
- const_tree original_type = _imap[reorg_type];
+ tree original_type = _imap[reorg_type];
// If we are here, that means that our type has the ".reorg" suffix
// Let's add a sanity check
bool has_suffix
@@ -1100,7 +1100,7 @@ ExprTypeRewriter::handle_pointer_arithmetic_constants (gimple *s, tree p,
/* substitute types in post-order visit. */
void
-ExprTypeRewriter::_walk_post (const_tree e)
+ExprTypeRewriter::_walk_post (tree e)
{
gcc_assert (e);
tree t = TREE_TYPE (e);
@@ -1109,17 +1109,17 @@ ExprTypeRewriter::_walk_post (const_tree e)
return;
tree r_t = _map[t];
- tree _e = const_tree_to_tree (e);
+ tree _e = tree_to_tree (e);
TREE_TYPE (_e) = r_t;
}
/* Rewrite Field. */
void
-ExprTypeRewriter::_walk_COMPONENT_REF_post (const_tree e)
+ExprTypeRewriter::_walk_COMPONENT_REF_post (tree e)
{
gcc_assert (e);
- const_tree f = TREE_OPERAND (e, 1);
+ tree f = TREE_OPERAND (e, 1);
// So, what we need is a map between this field and the new field
const bool in_map = _map2.find (f) != _map2.end ();
if (!in_map)
@@ -1128,7 +1128,7 @@ ExprTypeRewriter::_walk_COMPONENT_REF_post (const_tree e)
std::pair<tree, bool> p = _map2[f];
tree n_f = p.first;
bool is_deleted = p.second;
- tree _e = const_tree_to_tree (e);
+ tree _e = tree_to_tree (e);
TREE_OPERAND (_e, 1) = n_f;
if (!is_deleted)
@@ -1139,7 +1139,7 @@ ExprTypeRewriter::_walk_COMPONENT_REF_post (const_tree e)
}
void
-GimpleTypeRewriter::_walk_pre_tree (const_tree e)
+GimpleTypeRewriter::_walk_pre_tree (tree e)
{
// This is for local variables
// and other declarations
@@ -1155,14 +1155,14 @@ GimpleTypeRewriter::_walk_pre_tree (const_tree e)
const bool is_valid = is_interesting && is_var_decl;
if (!is_valid)
return;
- tree _e = const_tree_to_tree (e);
+ tree _e = tree_to_tree (e);
relayout_decl (_e);
}
void
GimpleTypeRewriter::_walk_pre_greturn (greturn *s)
{
- const_tree val = gimple_return_retval (s);
+ tree val = gimple_return_retval (s);
if (!val)
return;
exprTypeRewriter.walk (val);
@@ -1223,7 +1223,7 @@ GimpleTypeRewriter::handle_pointer_arithmetic (gimple *s)
tree integer_constant = is_op_0_icst ? op_0 : op_1;
tree maybe_pointer = is_op_0_icst ? op_1 : op_0;
- const_tree maybe_pointer_t = TREE_TYPE (maybe_pointer);
+ tree maybe_pointer_t = TREE_TYPE (maybe_pointer);
assert_is_type (maybe_pointer_t, POINTER_TYPE);
tree pointer_variable = maybe_pointer;
@@ -1244,22 +1244,22 @@ GimpleTypeRewriter::_walk_pre_gassign (gassign *s)
{
case GIMPLE_TERNARY_RHS:
{
- const_tree rhs3 = gimple_assign_rhs3 (s);
+ tree rhs3 = gimple_assign_rhs3 (s);
exprTypeRewriter.walk (rhs3);
}
/* fall-through */
case GIMPLE_BINARY_RHS:
{
- const_tree rhs2 = gimple_assign_rhs2 (s);
+ tree rhs2 = gimple_assign_rhs2 (s);
exprTypeRewriter.walk (rhs2);
}
/* fall-through */
case GIMPLE_UNARY_RHS:
case GIMPLE_SINGLE_RHS:
{
- const_tree rhs1 = gimple_assign_rhs1 (s);
+ tree rhs1 = gimple_assign_rhs1 (s);
exprTypeRewriter.walk (rhs1);
- const_tree lhs = gimple_assign_lhs (s);
+ tree lhs = gimple_assign_lhs (s);
if (!lhs)
break;
// Here is the only place where we likely can delete a statement.
diff --git a/gcc/ipa-dfe.h b/gcc/ipa-dfe.h
index b00575c5003..d7cb428f0e9 100644
--- a/gcc/ipa-dfe.h
+++ b/gcc/ipa-dfe.h
@@ -32,40 +32,40 @@ class SpecificTypeCollector : public TypeWalker
{
public:
/* C is the set of types that are to be looked for. */
- SpecificTypeCollector (std::set<const_tree> &c) : _collect_these_types (c)
+ SpecificTypeCollector (std::set<tree> &c) : _collect_these_types (c)
{};
/* Get final result of all types which point to types in C. */
- std::set<const_tree> get_set ();
+ std::set<tree> get_set ();
private:
/* _collect_these_types holds the input. */
- const std::set<const_tree> &_collect_these_types;
+ const std::set<tree> &_collect_these_types;
/* Working set that holds final result. */
- std::set<const_tree> to_return;
+ std::set<tree> to_return;
/* Sets which reach current subtype. */
- std::set<const_tree> path;
+ std::set<tree> path;
/* Push or pop from path. */
- virtual void _walk_ARRAY_TYPE_pre (const_tree t);
- virtual void _walk_ARRAY_TYPE_post (const_tree t);
- virtual void _walk_UNION_TYPE_pre (const_tree t);
- virtual void _walk_UNION_TYPE_post (const_tree t);
- virtual void _walk_POINTER_TYPE_pre (const_tree t);
- virtual void _walk_POINTER_TYPE_post (const_tree t);
+ virtual void _walk_ARRAY_TYPE_pre (tree t);
+ virtual void _walk_ARRAY_TYPE_post (tree t);
+ virtual void _walk_UNION_TYPE_pre (tree t);
+ virtual void _walk_UNION_TYPE_post (tree t);
+ virtual void _walk_POINTER_TYPE_pre (tree t);
+ virtual void _walk_POINTER_TYPE_post (tree t);
/* If in input, place all parent types in to_return. */
- virtual void _walk_RECORD_TYPE_pre (const_tree t);
- virtual void _walk_RECORD_TYPE_post (const_tree t);
+ virtual void _walk_RECORD_TYPE_pre (tree t);
+ virtual void _walk_RECORD_TYPE_post (tree t);
};
/* Map old RECORD_TYPE -> new RECORD_TYPE. */
-typedef std::map<const_tree, tree> reorg_record_map_t;
+typedef std::map<tree, tree> reorg_record_map_t;
/* Map RECORD_TYPE -> (FIELD_DECL -> delete). */
-typedef std::map<const_tree, std::pair<tree, bool> > reorg_field_map_t;
+typedef std::map<tree, std::pair<tree, bool> > reorg_field_map_t;
/* Class used to create new types derived from types that have fields
* that can be deleted. */
@@ -77,7 +77,7 @@ public:
{};
/* Whether a type has already been modified. */
- virtual bool is_memoized (const_tree t);
+ virtual bool is_memoized (tree t);
// Final result for record map.
reorg_record_map_t get_map ();
@@ -86,7 +86,7 @@ public:
reorg_field_map_t get_field_map ();
/* Map RECORD_TYPE -> is_modified. */
- typedef std::map<const_tree, bool> is_modified_map_t;
+ typedef std::map<tree, bool> is_modified_map_t;
protected:
const char *get_new_suffix ();
@@ -95,10 +95,10 @@ protected:
std::stack<tree> in_progress;
// Path to current subtype
- std::stack<const_tree> for_reference;
+ std::stack<tree> for_reference;
// OLD FIELD -> new FIELD
- typedef std::pair<const_tree, tree> field_tuple_t;
+ typedef std::pair<tree, tree> field_tuple_t;
// list of fields for new type
typedef std::vector<field_tuple_t> field_tuple_list_t;
@@ -127,28 +127,28 @@ protected:
// Keep track of which types may need to be modified
// defaults to not modified.
- void set_is_not_modified_yet (const_tree);
+ void set_is_not_modified_yet (tree);
// Mark all types reaching here will need to be modified.
void mark_all_pointing_here_as_modified ();
// If the type has been modified.
- bool get_is_modified (const_tree);
+ bool get_is_modified (tree);
private:
// Compute new FIELD_DECL list.
- virtual void _walk_field_pre (const_tree);
- virtual void _walk_field_post (const_tree);
+ virtual void _walk_field_pre (tree);
+ virtual void _walk_field_post (tree);
// Compute new RECORD_TYPE.
- virtual void _walk_RECORD_TYPE_pre (const_tree);
- virtual void _walk_RECORD_TYPE_post (const_tree);
+ virtual void _walk_RECORD_TYPE_pre (tree);
+ virtual void _walk_RECORD_TYPE_post (tree);
// Compute new type which points to new record type.
- virtual void _walk_ARRAY_TYPE_pre (const_tree);
- virtual void _walk_ARRAY_TYPE_post (const_tree);
- virtual void _walk_POINTER_TYPE_pre (const_tree);
- virtual void _walk_POINTER_TYPE_post (const_tree);
+ virtual void _walk_ARRAY_TYPE_pre (tree);
+ virtual void _walk_ARRAY_TYPE_post (tree);
+ virtual void _walk_POINTER_TYPE_pre (tree);
+ virtual void _walk_POINTER_TYPE_post (tree);
};
/* Modify expressions to match the new types.
@@ -166,7 +166,7 @@ public:
/* Create an inverse map new RECORD_TYPE -> old RECORD_TYPE. */
for (reorg_record_map_t::iterator i = map.begin (), e = map.end (); i != e; ++i)
{
- const_tree original = i->first;
+ tree original = i->first;
tree modified = i->second;
_imap[modified] = original;
}
@@ -197,20 +197,20 @@ private:
reorg_field_map_t _map2;
// New RECORD_TYPE -> old RECORD_TYPE.
- std::map<tree, const_tree> _imap;
- void _walk_post (const_tree e);
+ std::map<tree, tree> _imap;
+ void _walk_post (tree e);
// Substitute types and create new offset.
- void _walk_MEM_REF_post (const_tree e);
+ void _walk_MEM_REF_post (tree e);
// Substitute fields referred.
- void _walk_COMPONENT_REF_post (const_tree e);
+ void _walk_COMPONENT_REF_post (tree e);
// Relayout parameters which are rewritten.
- void _walk_PARM_DECL_post (const_tree e);
+ void _walk_PARM_DECL_post (tree e);
// Substitute return type.
- void _walk_FUNCTION_DECL_post (const_tree e);
+ void _walk_FUNCTION_DECL_post (tree e);
};
// Walk all gimple and substitute types.
@@ -233,13 +233,13 @@ private:
// rewrite types in these statements
virtual void _walk_pre_gphi (gphi *);
- virtual void _walk_pre_tree (const_tree);
+ virtual void _walk_pre_tree (tree);
virtual void _walk_pre_greturn (greturn *s);
virtual void _walk_pre_gassign (gassign *s);
};
// Get a set of all types pointing to types in RECORD_FIELD_OFFSET_MAP.
-std::set<const_tree>
+std::set<tree>
get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
tpartitions_t casting);
@@ -248,7 +248,7 @@ typedef std::pair<reorg_record_map_t, reorg_field_map_t> reorg_maps_t;
// Compute the replacement types.
reorg_maps_t
get_types_replacement (record_field_offset_map_t record_field_offset_map,
- std::set<const_tree> to_modify);
+ std::set<tree> to_modify);
// Substitute types.
void
@@ -256,6 +256,6 @@ substitute_types_in_program (reorg_record_map_t map,
reorg_field_map_t field_map, bool _delete);
tree
-get_new_identifier (const_tree type, const char *suffix);
+get_new_identifier (tree type, const char *suffix);
#endif /* GCC_IPA_DFE */
diff --git a/gcc/ipa-field-reorder.c b/gcc/ipa-field-reorder.c
index 21f13f376b0..f3912ff3210 100644
--- a/gcc/ipa-field-reorder.c
+++ b/gcc/ipa-field-reorder.c
@@ -175,17 +175,17 @@ public:
private:
// Compute new RECORD_TYPE.
- virtual void _walk_RECORD_TYPE_post (const_tree);
+ virtual void _walk_RECORD_TYPE_post (tree);
};
/* Compare FIELD_DECL tree based on TYPE_SIZE unit */
static bool
-compare_FIELD_DECLs_TYPE_SIZE (const_tree _l, const_tree _r)
+compare_FIELD_DECLs_TYPE_SIZE (tree _l, tree _r)
{
gcc_assert (_l && _r);
- tree l = const_tree_to_tree (_l);
- tree r = const_tree_to_tree (_r);
+ tree l = tree_to_tree (_l);
+ tree r = tree_to_tree (_r);
const enum tree_code code_l = TREE_CODE (l);
const enum tree_code code_r = TREE_CODE (r);
@@ -217,9 +217,9 @@ compare_FIELD_DECLs_TYPE_SIZE (const_tree _l, const_tree _r)
}
void
-TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
+TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (tree t)
{
- const_tree t2 = for_reference.top ();
+ tree t2 = for_reference.top ();
gcc_assert (t2 == t);
for_reference.pop ();
@@ -235,7 +235,7 @@ TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
// So, now we want to do a couple of things.
// First, collect all fields in a struct and make a copy of them
bool is_modified = get_is_modified (t);
- std::vector<const_tree> to_reorder;
+ std::vector<tree> to_reorder;
is_modified = true;
for (field_tuple_list_t::iterator i = field_tuple_list.begin (), e = field_tuple_list.end ();
i != e; ++i)
@@ -253,7 +253,7 @@ TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
TypeStringifier::get_field_identifier (field_tuple.first).c_str (),
!modified_field ? "true" : "false");
to_reorder.push_back (
- (const_tree) copy_node (const_tree_to_tree (field_tuple.first)));
+ (tree) copy_node (tree_to_tree (field_tuple.first)));
}
if (is_modified)
@@ -286,21 +286,21 @@ TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
gcc_assert (!modified_field && is_modified);
// Create new TYPE_FIELDS with the order we want
- for (std::vector<const_tree>::iterator j = to_reorder.begin (), f = to_reorder.end (); j != f; ++j)
+ for (std::vector<tree>::iterator j = to_reorder.begin (), f = to_reorder.end (); j != f; ++j)
{
entered_loop = true;
- const_tree current_field_inner = *j;
+ tree current_field_inner = *j;
if (!prev_field)
{
- TYPE_FIELDS (copy) = const_tree_to_tree (current_field_inner);
+ TYPE_FIELDS (copy) = tree_to_tree (current_field_inner);
}
else
{
DECL_CHAIN (prev_field)
- = const_tree_to_tree (current_field_inner);
+ = tree_to_tree (current_field_inner);
}
- prev_field = const_tree_to_tree (current_field_inner);
+ prev_field = tree_to_tree (current_field_inner);
}
if (entered_loop)
@@ -308,10 +308,10 @@ TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
}
// Modify _reorg_fields map
- for (std::vector<const_tree>::iterator i = to_reorder.begin (), e = to_reorder.end (); i != e; ++i)
+ for (std::vector<tree>::iterator i = to_reorder.begin (), e = to_reorder.end (); i != e; ++i)
{
- const_tree to_find = *i;
- unsigned to_find_i = bitpos_of_field (const_tree_to_tree (to_find));
+ tree to_find = *i;
+ unsigned to_find_i = bitpos_of_field (tree_to_tree (to_find));
const char *to_find_str
= TypeStringifier::get_field_identifier (to_find).c_str ();
// O^2 for now but an improvement can be to change this
@@ -324,7 +324,7 @@ TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
if (haystack_i == to_find_i)
{
_reorg_fields[field]
- = std::make_pair (const_tree_to_tree (to_find), false);
+ = std::make_pair (tree_to_tree (to_find), false);
log ("substituting %s for %s\n", to_find_str, haystack);
}
}
@@ -367,7 +367,7 @@ TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
TYPE_MAIN_VARIANT (copy) = is_modified ? copy : TYPE_MAIN_VARIANT (copy);
if (is_modified)
layout_type (copy);
- tree _t = const_tree_to_tree (t);
+ tree _t = tree_to_tree (t);
_reorg_map[t] = is_modified ? copy : _t;
}
@@ -391,14 +391,14 @@ GimpleAccesserFieldReordering::_walk_pre_gassign (gassign *s)
{
case GIMPLE_TERNARY_RHS:
{
- const_tree rhs3 = gimple_assign_rhs3 (s);
+ tree rhs3 = gimple_assign_rhs3 (s);
gcc_assert (rhs3);
exprAccessor.update (rhs3, Empty);
}
/* fall-through */
case GIMPLE_BINARY_RHS:
{
- const_tree rhs2 = gimple_assign_rhs2 (s);
+ tree rhs2 = gimple_assign_rhs2 (s);
gcc_assert (rhs2);
exprAccessor.update (rhs2, Empty);
}
@@ -406,9 +406,9 @@ GimpleAccesserFieldReordering::_walk_pre_gassign (gassign *s)
case GIMPLE_UNARY_RHS:
case GIMPLE_SINGLE_RHS:
{
- const_tree rhs1 = gimple_assign_rhs1 (s);
+ tree rhs1 = gimple_assign_rhs1 (s);
exprAccessor.update (rhs1, Empty);
- const_tree lhs = gimple_assign_lhs (s);
+ tree lhs = gimple_assign_lhs (s);
if (!lhs)
break;
exprAccessor.update (lhs, Empty);
@@ -427,12 +427,12 @@ GimpleAccesserFieldReordering::_walk_pre_gcall (gcall *s)
unsigned n = gimple_call_num_args (s);
for (unsigned i = 0; i < n; i++)
{
- const_tree a = gimple_call_arg (s, i);
+ tree a = gimple_call_arg (s, i);
gcc_assert (a);
exprAccessor.update (a, Empty);
}
- const_tree lhs = gimple_call_lhs (s);
+ tree lhs = gimple_call_lhs (s);
if (!lhs)
return;
exprAccessor.update (lhs, Empty);
@@ -442,7 +442,7 @@ GimpleAccesserFieldReordering::_walk_pre_gcall (gcall *s)
void
GimpleAccesserFieldReordering::_walk_pre_greturn (greturn *s)
{
- const_tree val = gimple_return_retval (s);
+ tree val = gimple_return_retval (s);
if (!val)
return;
exprAccessor.update (val, Empty);
@@ -452,8 +452,8 @@ GimpleAccesserFieldReordering::_walk_pre_greturn (greturn *s)
void
GimpleAccesserFieldReordering::_walk_pre_gcond (gcond *s)
{
- const_tree lhs = gimple_cond_lhs (s);
- const_tree rhs = gimple_cond_rhs (s);
+ tree lhs = gimple_cond_lhs (s);
+ tree rhs = gimple_cond_rhs (s);
gcc_assert (lhs && rhs);
exprAccessor.update (lhs, Empty);
exprAccessor.update (rhs, Empty);
@@ -521,25 +521,25 @@ record_field_map_t static find_fields_accessed ()
*/
reorg_maps_t
get_reordered_field_maps (record_field_offset_map_t record_field_offset_map,
- std::set<const_tree> to_modify)
+ std::set<tree> to_modify)
{
TypeStringifier stringifier;
TypeReconstructorFieldReordering reconstructor (record_field_offset_map,
"reorder");
- for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+ for (std::set<tree>::const_iterator i = to_modify.begin (),
e = to_modify.end ();
i != e; ++i)
{
- const_tree record = *i;
+ tree record = *i;
reconstructor.walk (TYPE_MAIN_VARIANT (record));
}
- for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+ for (std::set<tree>::const_iterator i = to_modify.begin (),
e = to_modify.end ();
i != e; ++i)
{
- const_tree record = *i;
+ tree record = *i;
reconstructor.walk (record);
}
@@ -550,11 +550,11 @@ get_reordered_field_maps (record_field_offset_map_t record_field_offset_map,
// Also, we found some types for which TYPE_CACHED_VALUES_P is not being
// rewritten. This is probably indicative of a bug in
// TypeReconstructorFieldReordering.
- for (std::map<const_tree, tree>::const_iterator i = map.begin (),
+ for (std::map<tree, tree>::const_iterator i = map.begin (),
e = map.end ();
i != e; ++i)
{
- const_tree o_record = i->first;
+ tree o_record = i->first;
std::string o_name = stringifier.stringify (o_record);
log ("original: %s\n", o_name.c_str ());
tree r_record = i->second;
@@ -565,7 +565,7 @@ get_reordered_field_maps (record_field_offset_map_t record_field_offset_map,
continue;
tree m_record = TYPE_MAIN_VARIANT (r_record);
// Info: We had a bug where some TYPED_CACHED_VALUES were preserved?
- tree _o_record = const_tree_to_tree (o_record);
+ tree _o_record = tree_to_tree (o_record);
TYPE_CACHED_VALUES_P (_o_record) = false;
TYPE_CACHED_VALUES_P (m_record) = false;
@@ -600,7 +600,7 @@ lto_fr_execute ()
return 0;
// Prepare for transformation.
- std::set<const_tree> to_modify
+ std::set<tree> to_modify
= get_all_types_pointing_to (record_field_offset_map,
escaping_nonescaping_sets);
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c
index ba6a5d1b02f..0b72d1e0f50 100644
--- a/gcc/ipa-str-reorg-instance-interleave.c
+++ b/gcc/ipa-str-reorg-instance-interleave.c
@@ -2960,7 +2960,7 @@ reorg_perf_qual ( Info *info)
{
fprintf ( info->reorg_dump_file, "Doing Performance Qualification\n");
}
- //DEBUG_L("reorg_perf_qual:\n");
+ DEBUG_L("reorg_perf_qual:\n");
#if 1
// TBD use design in doc but mark ReorgTypes
// (do_instance_interleave) that qualify instead of deleting them
@@ -3049,14 +3049,14 @@ reorg_perf_qual ( Info *info)
for ( unsigned i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs [i];
- //DEBUG_A("BB %i:\n", bb->index);
- //INDENT(4);
+ DEBUG_A("BB %i:\n", bb->index);
+ INDENT(4);
for ( auto gsi = gsi_start_bb ( bb); !gsi_end_p ( gsi); gsi_next ( &gsi) )
{
gimple *stmt = gsi_stmt ( gsi);
- //DEBUG_A("examine: ");
- //DEBUG_F ( print_gimple_stmt, stderr, stmt, TDF_DETAILS);
- //INDENT(4);
+ DEBUG_A("examine: ");
+ DEBUG_F ( print_gimple_stmt, stderr, stmt, TDF_DETAILS);
+ INDENT(4);
if ( gimple_code ( stmt) == GIMPLE_LABEL ||
gimple_code ( stmt) == GIMPLE_SWITCH ) continue;
@@ -3069,8 +3069,8 @@ reorg_perf_qual ( Info *info)
op = gimple_op ( stmt, ith_op);
// It's lieing about the number of operands... so...
if ( op == NULL ) continue;
- //DEBUG_A("op[%d]: %p, ", ith_op, op);
- //DEBUG_F(flexible_print, stderr, op, 1, (dump_flags_t)0);
+ DEBUG_A("op[%d]: %p, ", ith_op, op);
+ DEBUG_F(flexible_print, stderr, op, 1, (dump_flags_t)0);
ReorgType_t *tri = tree_contains_a_reorgtype ( op, info);
enum ReorgOpTrans optran = recognize_op ( op, false, info);
// TBD This is where we need to remember
@@ -3078,11 +3078,11 @@ reorg_perf_qual ( Info *info)
const char *s = optrans_to_str( optran);
// Commenting out these 3 debug commands causes a
// regression
- //DEBUG_A(", %s\n", s);
+ DEBUG_A(", %s\n", s);
if ( tri != NULL )
{
- //DEBUG(", ");
- //DEBUG_F(print_reorg, stderr, 0, tri);
+ DEBUG(", ");
+ DEBUG_F(print_reorg, stderr, 0, tri);
;
}
else
@@ -3128,37 +3128,37 @@ reorg_perf_qual ( Info *info)
missing_cases = true;
}
}
- //INDENT(-4);
+ INDENT(-4);
}
- //INDENT(-4);
+ INDENT(-4);
}
- //DEBUG_L("Dumping acc_info:\n");
+ DEBUG_L("Dumping acc_info:\n");
for ( auto aci = acc_info.begin (); aci != acc_info.end (); aci++ )
{
- //DEBUG_A("variable:\n");
- //DEBUG_F( tell_me_about_ssa_name, (*aci).access, debug_indenting + 4);
- //DEBUG_A("field: ");
- //DEBUG_F( flexible_print, stderr, (*aci).field, 1, (dump_flags_t)0);
+ DEBUG_A("variable:\n");
+ DEBUG_F( tell_me_about_ssa_name, (*aci).access, debug_indenting + 4);
+ DEBUG_A("field: ");
+ DEBUG_F( flexible_print, stderr, (*aci).field, 1, (dump_flags_t)0);
;
}
- //DEBUG_A("before sort: \n");
- //DEBUG_F(print_acc_infos, stderr, acc_info );
+ DEBUG_A("before sort: \n");
+ DEBUG_F(print_acc_infos, stderr, acc_info );
// Sort and compact the access infos.
stable_sort ( acc_info.begin (), acc_info.end (), acc_lt);
- //DEBUG_A("before compress: \n");
- //DEBUG_F(print_acc_infos, stderr, acc_info );
+ DEBUG_A("before compress: \n");
+ DEBUG_F(print_acc_infos, stderr, acc_info );
// Sort and compact the access infos.
std::stable_sort ( acc_info.begin (), acc_info.end (), acc_lt);
compress_acc_infos ( acc_info );
- //DEBUG_A("after compress: \n");
- //DEBUG_F(print_acc_infos, stderr, acc_info );
+ DEBUG_A("after compress: \n");
+ DEBUG_F(print_acc_infos, stderr, acc_info );
// Obtain loop count by looking at all the block counts.
unsigned loop_count = 0;
@@ -3167,8 +3167,8 @@ reorg_perf_qual ( Info *info)
basic_block bb = bbs [i];
loop_count = MAX( loop_count, bb->count.value ());
}
- //DEBUG_L("loop_count = %d, nb_iterations_estimate = %ld\n",
- // loop_count, loop->nb_iterations_estimate);
+ DEBUG_L("loop_count = %d, nb_iterations_estimate = %ld\n",
+ loop_count, loop->nb_iterations_estimate);
// Create the variable infos
varInfo_t var_entry;
@@ -3205,12 +3205,12 @@ reorg_perf_qual ( Info *info)
{
fprintf ( stderr, "%d VarInfos\n", var_info.size ());
}
- //DEBUG_F(print_var_infos, stderr, var_info);
+ DEBUG_F(print_var_infos, stderr, var_info);
//
// Model the performance
//
- //DEBUG_A("Model The Performance\n");
+ DEBUG_A("Model The Performance\n");
// Originally this was done per bb but now it has to be per
// loop. TBD But perf_bb is per loop so we need something similar
@@ -3222,16 +3222,16 @@ reorg_perf_qual ( Info *info)
ReorgType_t *ri = pvi->rep_access->reorg;
// Reorg accounting
- //DEBUG_L("\n");
- //DEBUG_A("Reorg Accounting\n");
+ DEBUG_L("\n");
+ DEBUG_A("Reorg Accounting\n");
if( ri != NULL )
{
double reorg_nca = 0.0;
- //DEBUG_A(" for: ");
- //DEBUG_F( flexible_print, stderr, ri->gcc_type, 1, (dump_flags_t)0);
- //INDENT(4);
+ DEBUG_A(" for: ");
+ DEBUG_F( flexible_print, stderr, ri->gcc_type, 1, (dump_flags_t)0);
+ INDENT(4);
for ( auto fldi = pvi->fields.begin (); fldi != pvi->fields.end (); fldi++ )
{
unsigned HOST_WIDE_INT fld_width =
@@ -3239,18 +3239,18 @@ reorg_perf_qual ( Info *info)
double effect = alignment_effect ( fld_width);
double product = loop_count * effect;
reorg_nca += product;
- //DEBUG_A("Add loop_count * effect (%d * %f = %f) to reorg_nca (now %f)\n",
- // loop_count, effect, product, reorg_nca);
+ DEBUG_A("Add loop_count * effect (%d * %f = %f) to reorg_nca (now %f)\n",
+ loop_count, effect, product, reorg_nca);
}
- //INDENT(-4);
+ INDENT(-4);
ri->instance_interleave.reorg_perf += reorg_nca;
DEBUG_A("Add reorg_nca (%f) to reorg_perf (now %e)\n",
reorg_nca, ri->instance_interleave.reorg_perf);
} // 699
// regular accounting
- //DEBUG_L("\n");
- //DEBUG_A("Regular Accounting\n");
+ DEBUG_L("\n");
+ DEBUG_A("Regular Accounting\n");
double regular_nca = 0.0;
sbitmap cache_model = sbitmap_alloc(1);
@@ -3261,12 +3261,12 @@ reorg_perf_qual ( Info *info)
tree base_type; // = base_type_of ( access);
if ( pv2i->rep_access->reorg != NULL )
{
- //DEBUG_A("Base type from reorg: ");
+ DEBUG_A("Base type from reorg: ");
base_type = pv2i->rep_access->reorg->gcc_type;
}
else
{
- //DEBUG_A("Base type from access: ");
+ DEBUG_A("Base type from access: ");
if ( TREE_TYPE ( access ) != NULL )
{
base_type = base_type_of ( access);
@@ -3276,7 +3276,7 @@ reorg_perf_qual ( Info *info)
gcc_assert (0);
}
}
- //DEBUG_F( flexible_print, stderr, base_type, 1, (dump_flags_t)0);
+ DEBUG_F( flexible_print, stderr, base_type, 1, (dump_flags_t)0);
bool base_type_isa_decl = DECL_P ( base_type );
@@ -3286,31 +3286,31 @@ reorg_perf_qual ( Info *info)
tree base_type_size;
if ( base_type_isa_decl )
{
- //DEBUG_A("decl\n");
+ DEBUG_A("decl\n");
switch ( TREE_CODE (base_type) )
{
case VAR_DECL:
{
- //DEBUG_A("VAR_DECL\n");
+ DEBUG_A("VAR_DECL\n");
base_type_size = TYPE_SIZE_UNIT ( base_type);
break;
}
case FIELD_DECL:
{
- //DEBUG_A("VAR_DECL\n");
+ DEBUG_A("VAR_DECL\n");
base_type_size = TYPE_SIZE_UNIT ( TREE_TYPE ( base_type));
break;
}
default:
{
- //DEBUG_A("other decl %s\n", code_str(TREE_CODE (base_type)));
+ DEBUG_A("other decl %s\n", code_str(TREE_CODE (base_type)));
gcc_assert(0);
}
}
}
else
{
- //DEBUG_A("nondecl %s\n", code_str(TREE_CODE (base_type)));
+ DEBUG_A("nondecl %s\n", code_str(TREE_CODE (base_type)));
if ( TREE_CODE ( base_type) == SSA_NAME )
{
base_type_size = TYPE_SIZE_UNIT ( TREE_TYPE( base_type));
@@ -3320,7 +3320,9 @@ reorg_perf_qual ( Info *info)
base_type_size = TYPE_SIZE_UNIT ( base_type);
}
}
-
+
+ DEBUG_A("base_type_size %p = ", base_type_size);
+ DEBUG_F( flexible_print, stderr, base_type_size, 1, (dump_flags_t)0);
unsigned HOST_WIDE_INT len =
(( tree_to_uhwi ( base_type_size)
+
@@ -3329,10 +3331,10 @@ reorg_perf_qual ( Info *info)
param_l1_cache_line_size)
+
1;
- //DEBUG_L("\n");
- //DEBUG_A("cache len = %d (lines), for: ", len);
- //DEBUG_F( flexible_print, stderr, base_type, 0, (dump_flags_t)0);
- //DEBUG("%sstruct\n")
+ DEBUG_L("\n");
+ DEBUG_A("cache len = %d (lines), for: ", len);
+ DEBUG_F( flexible_print, stderr, base_type, 0, (dump_flags_t)0);
+ DEBUG("%sstruct\n")
// TBD Does this clear the bits??? It needs to.
// Each bit represents a cache line.
@@ -3354,14 +3356,14 @@ reorg_perf_qual ( Info *info)
// why this is here and what it does. Sigh...
unsigned HOST_WIDE_INT base_offset =
tree_to_uhwi ( DECL_FIELD_OFFSET( field_ex));
- //DEBUG_L("\n");
- //DEBUG_A("For field_ex: ");
- //DEBUG_F( flexible_print, stderr, field_ex, 0, (dump_flags_t)0);
- //DEBUG(", nrbo %d, base_offset %d\n", nrbo, base_offset);
+ DEBUG_L("\n");
+ DEBUG_A("For field_ex: ");
+ DEBUG_F( flexible_print, stderr, field_ex, 0, (dump_flags_t)0);
+ DEBUG(", nrbo %d, base_offset %d\n", nrbo, base_offset);
// Access accounting
- //INDENT(4);
+ INDENT(4);
for ( auto fldi = pv2i->fields.begin ();
fldi != pv2i->fields.end (); fldi++ )
{
@@ -3369,27 +3371,27 @@ reorg_perf_qual ( Info *info)
unsigned HOST_WIDE_INT fld_width, fld_offset;
fld_width = tree_to_uhwi ( DECL_SIZE ( field));
fld_offset = tree_to_uhwi ( DECL_FIELD_OFFSET ( field));
- //DEBUG_A("Field: ");
- //DEBUG_F( flexible_print, stderr, field, 0, (dump_flags_t)0);
- //DEBUG(", width = %d, offset = %d\n", fld_width, fld_offset);
- //INDENT(4);
+ DEBUG_A("Field: ");
+ DEBUG_F( flexible_print, stderr, field, 0, (dump_flags_t)0);
+ DEBUG(", width = %d, offset = %d\n", fld_width, fld_offset);
+ INDENT(4);
int chari;
for ( chari = 0; chari < fld_width; chari++ )
{
int loc = (chari + fld_offset + base_offset)
/
param_l1_cache_line_size;
- //DEBUG_A("loc: %d\n", loc);
+ DEBUG_A("loc: %d\n", loc);
bitmap_set_bit ( cache_model, loc);
}
- //INDENT(-4);
+ INDENT(-4);
}
- //INDENT(-4);
+ INDENT(-4);
unsigned bcount = bitmap_count_bits ( cache_model);
accum += bcount;
- //DEBUG_L("\n");
- //DEBUG_A("Add popcount of cache (%d) to accum (now %f)\n",
- // bcount, accum);
+ DEBUG_L("\n");
+ DEBUG_A("Add popcount of cache (%d) to accum (now %f)\n",
+ bcount, accum);
bitmap_clear ( cache_model);
}
}
@@ -3397,22 +3399,22 @@ reorg_perf_qual ( Info *info)
{
nrbo = 1;
accum++;
- //DEBUG_L("\n");
- //DEBUG_A("nrbo = 1, increment accum to %f\n", accum);
+ DEBUG_L("\n");
+ DEBUG_A("nrbo = 1, increment accum to %f\n", accum);
}
#if 1
double amount = accum / nrbo;
double product = amount * loop_count;
regular_nca += product;
- //DEBUG_L("\n");
- //DEBUG_A("Add loop_count*accum/nrbo (%f*%f/%d = %f) to regular_nca (now %e)\n",
- // loop_count, accum, nrbo, product, regular_nca);
+ DEBUG_L("\n");
+ DEBUG_A("Add loop_count*accum/nrbo (%f*%f/%d = %f) to regular_nca (now %e)\n",
+ loop_count, accum, nrbo, product, regular_nca);
#else
double amount = accum / nrbo;
regular_nca += amount;
- //DEBUG_L("\n");
- //DEBUG_A("Add accum/nrbo (%f/%d = %f) to regular_nca (now %e)\n",
- // accum, nrbo, amount, regular_nca);
+ DEBUG_L("\n");
+ DEBUG_A("Add accum/nrbo (%f/%d = %f) to regular_nca (now %e)\n",
+ accum, nrbo, amount, regular_nca);
#endif
} // 739
sbitmap_free ( cache_model);
@@ -3420,11 +3422,11 @@ reorg_perf_qual ( Info *info)
if( ri != NULL ) {
ri->instance_interleave.regular_perf += regular_nca;
cache_accesses_noreorg += regular_nca;
- //DEBUG_L("\n");
- //DEBUG_A("Add regular_nca (%f) to regular_perf (now %e)",
- // regular_nca, ri->instance_interleave.regular_perf);
- //DEBUG_A(" and to cache_accesses_noreorg (now %e)\n",
- // cache_accesses_noreorg);
+ DEBUG_L("\n");
+ DEBUG_A("Add regular_nca (%f) to regular_perf (now %e)",
+ regular_nca, ri->instance_interleave.regular_perf);
+ DEBUG_A(" and to cache_accesses_noreorg (now %e)\n",
+ cache_accesses_noreorg);
} else {
cache_accesses += regular_nca;
}
@@ -3492,12 +3494,12 @@ reorg_perf_qual ( Info *info)
double raw_effect = with_opt/without_opt;
double absolute_effect =
(without_opt - with_opt) / total_cache_accesses;
- //DEBUG_A("For ");
- //DEBUG_F(flexible_print, stderr, reorgi->gcc_type, 0, (dump_flags_t)0);
- //DEBUG(" with_opt: %e, without_opt %e, total_cache_accesses %e\n",
- // with_opt, without_opt, total_cache_accesses);
- //DEBUG_A(" Raw Effect: %5.4f, Absolute Effect %5.4f\n",
- // raw_effect, absolute_effect);
+ DEBUG_A("For ");
+ DEBUG_F(flexible_print, stderr, reorgi->gcc_type, 0, (dump_flags_t)0);
+ DEBUG(" with_opt: %e, without_opt %e, total_cache_accesses %e\n",
+ with_opt, without_opt, total_cache_accesses);
+ DEBUG_A(" Raw Effect: %5.4f, Absolute Effect %5.4f\n",
+ raw_effect, absolute_effect);
// Note, there would need to be a multi-pool case here if
// that is every done.
diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c
index f9d29492cbc..d40455e2fff 100644
--- a/gcc/ipa-structure-reorg.c
+++ b/gcc/ipa-structure-reorg.c
@@ -48,6 +48,9 @@ along with GCC; see the file COPYING3. If not see
#include "ssa-iterators.h"
#include <stack>
#include "ipa-type-escape-analysis.h"
+#include "value-range.h"
+#include "stringpool.h"
+#include "tree-ssanames.h"
static void setup_debug_flags ( Info *);
static void initial_debug_info ( Info *);
@@ -125,6 +128,7 @@ ipa_structure_reorg ( void)
std::vector <ProgDecl_t> Prog_Decl;
std::map <tree,BoolPair_t> StructTypes; // TBD horrible type name
+ DEBUG("SAMPLE DEGUG\n");
//DEBUG_L( "Running ipa_structure_reorg\n");
//INDENT(2);
@@ -526,7 +530,7 @@ reorg_analysis_debug ( Info *info, ReorgType *reorg )
}
}
-#if 1
+#if USE_ESCAPE_ANALYSIS
static bool
find_decls_and_types ( Info *info)
{
@@ -1000,17 +1004,21 @@ add_reorg_type (
{
tree tmv_type = TYPE_MAIN_VARIANT ( base);
//tree type2add = tmv_type ? tmv_type : base;
+ //ReorgType_t rt =
+ // { 0, del, base, NULL, NULL, false, false, false,
+ // { 0}, { 0}, { 0, 0, 0, NULL, 0.0, 0.0, false}};
ReorgType_t rt =
- { 0, del, base, NULL, NULL, false, false, false,
+ { 0, del, tmv_type, NULL, NULL, false, false, false,
{ 0}, { 0}, { 0, 0, 0, NULL, 0.0, 0.0, false}};
- //DEBUG_L("add_reorg_type: ");
- //DEBUG_F(print_generic_expr, base, (dump_flags_t)0);
- //DEBUG("\n");
+ DEBUG_L("add_reorg_type: ");
+ DEBUG_F(flexible_print, stderr, base, 1, (dump_flags_t)0);
info->reorg_type->push_back ( rt);
+ #if !USE_ESCAPE_ANALYSIS
// Remember the intial assumption is the type added will be deleted
// and is marked to be deleted.
info->num_deleted++;
+ #endif
}
#endif
@@ -2695,12 +2703,12 @@ bool same_type_p(
tree a, tree b
)
{
- //DEBUG( "same_type_p:\n");
- //DEBUG( " a: TREE_CODE = %s, name = %p\n ",code_str(TREE_CODE(a)),TYPE_NAME(a));
- //DEBUG_F( print_generic_expr, stderr, a, (dump_flags_t)-1);
- //DEBUG( "\n b TREE_CODE = %s, name = %p\n ",code_str(TREE_CODE(b)),TYPE_NAME(b));
- //DEBUG_F( print_generic_expr, stderr, b, (dump_flags_t)-1);
- //DEBUG( "\n");
+ DEBUG( "same_type_p:\n");
+ DEBUG( " a: TREE_CODE = %s, name = %p\n ",code_str(TREE_CODE(a)),TYPE_NAME(a));
+ DEBUG_F( print_generic_expr, stderr, a, (dump_flags_t)-1);
+ DEBUG( "\n b TREE_CODE = %s, name = %p\n ",code_str(TREE_CODE(b)),TYPE_NAME(b));
+ DEBUG_F( print_generic_expr, stderr, b, (dump_flags_t)-1);
+ DEBUG( "\n");
// This replaces part of the below
bool a_rec = TREE_CODE ( a ) == RECORD_TYPE;
@@ -2721,7 +2729,7 @@ bool same_type_p(
bool ret = TYPE_NAME ( a) == TYPE_NAME ( b);
- //DEBUG( "returns %s\n", ret ? "true" : "false");
+ DEBUG( "returns %s\n", ret ? "true" : "false");
return ret;
}
@@ -2732,8 +2740,8 @@ bool same_type_p(
ReorgType_t *
get_reorgtype_info ( tree type, Info* info)
{
- //DEBUG_L( "get_reorgtype_info: type = ");
- //DEBUG_F( flexible_print, stderr, type, 1, (dump_flags_t)0);
+ DEBUG_L( "get_reorgtype_info: type = ");
+ DEBUG_F( flexible_print, stderr, type, 1, (dump_flags_t)0);
// Note, I'm going to use the most stupid and slowest possible way
// to do this. The advanage is it will be super easy and almost
@@ -2751,9 +2759,9 @@ get_reorgtype_info ( tree type, Info* info)
// so this is just a place holder until I can get an answer
// from the gcc community. Note, this is a big issue.
// Remember, the same_type_p here is my own temporary hack.
- //DEBUG_L("");
- //DEBUG_F( print_generic_expr, stderr, type, TDF_DETAILS);
- //DEBUG("\n");
+ DEBUG_L("");
+ DEBUG_F( print_generic_expr, stderr, type, TDF_DETAILS);
+ DEBUG("\n");
if ( same_type_p ( ri->gcc_type, type2check ) )
{
//DEBUG_A( " returns %p\n", &(*ri));
@@ -2761,7 +2769,7 @@ get_reorgtype_info ( tree type, Info* info)
return &(*ri);
}
}
- //DEBUG_A( " returns NULL\n");
+ DEBUG_A( " returns NULL\n");
return NULL;
}
diff --git a/gcc/ipa-structure-reorg.h b/gcc/ipa-structure-reorg.h
index 3d8a72a8f6b..93f82b76692 100644
--- a/gcc/ipa-structure-reorg.h
+++ b/gcc/ipa-structure-reorg.h
@@ -30,8 +30,8 @@ along with GCC; see the file COPYING3. If not see
#define PRINT_FORMAT false
// Trun off actual transformations for testing
#define BYPASS_TRANSFORM false
-
-#define CONSTIPATION 0
+// Use Erick's escape analysis
+#define USE_ESCAPE_ANALYSIS 0
typedef struct RT_Elim RT_Elim;
typedef struct RT_Reorder RT_Reorder;
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index b65ef9b4e4f..f05ffc1a5ef 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -343,7 +343,7 @@ lto_dead_field_elimination ()
return;
// Prepare for transformation.
- std::set<const_tree> to_modify
+ std::set<tree> to_modify
= get_all_types_pointing_to (record_field_offset_map,
escaping_nonescaping_sets);
reorg_maps_t replacements
@@ -411,7 +411,7 @@ record_field_map_t static find_fields_accessed ()
return record_field_map;
}
-/* Find equivalent RECORD_TYPE trees to const_tree r_i.
+/* Find equivalent RECORD_TYPE trees to tree r_i.
* This equivalence will be used for merging the results of field accesses
* across all equivalent RECORD_TYPE trees.
@@ -419,22 +419,22 @@ record_field_map_t static find_fields_accessed ()
* and it is a tree for which this method is going to find the rest of
* equivalent trees found in record_field_map.
*/
-static std::vector<const_tree>
-find_equivalent_trees (const_tree r_i, record_field_map_t record_field_map,
+static std::vector<tree>
+find_equivalent_trees (tree r_i, record_field_map_t record_field_map,
tpartitions_t casting)
{
TypeIncompleteEquality equality;
- std::vector<const_tree> equivalence;
+ std::vector<tree> equivalence;
bool is_rin_record = casting.in_points_to_record (r_i);
if (!is_rin_record)
return equivalence;
- for (std::map<const_tree, field_access_map_t>::const_iterator j
+ for (std::map<tree, field_access_map_t>::const_iterator j
= record_field_map.begin (),
f = record_field_map.end ();
j != f; j++)
{
- const_tree r_j = j->first;
+ tree r_j = j->first;
const bool pointer_equal = r_i == r_j;
if (pointer_equal)
continue;
@@ -459,7 +459,7 @@ find_equivalent_trees (const_tree r_i, record_field_map_t record_field_map,
* tree (RECORD_TYPE) -> unsigned (bitpos_of_field for read fields).
*/
static void
-add_offset_only_if_read (const_tree field, unsigned access,
+add_offset_only_if_read (tree field, unsigned access,
field_offsets_t &field_offset)
{
assert_is_type (field, FIELD_DECL);
@@ -467,7 +467,7 @@ add_offset_only_if_read (const_tree field, unsigned access,
if (!is_read)
return;
- tree _field = const_tree_to_tree (field);
+ tree _field = tree_to_tree (field);
unsigned f_offset = bitpos_of_field (_field);
field_offset.insert (f_offset);
}
@@ -483,7 +483,7 @@ static void
keep_only_read_fields_from_field_map (field_access_map_t &field_map,
field_offsets_t &field_offset)
{
- for (std::map<const_tree, unsigned>::iterator j = field_map.begin (),
+ for (std::map<tree, unsigned>::iterator j = field_map.begin (),
f = field_map.end ();
j != f; ++j)
{
@@ -497,14 +497,14 @@ keep_only_read_fields_from_field_map (field_access_map_t &field_map,
*/
static void
keep_only_read_fields_from_equivalent_field_maps (
- std::vector<const_tree> equivalent, record_field_map_t &record_field_map,
+ std::vector<tree> equivalent, record_field_map_t &record_field_map,
field_offsets_t &field_offset)
{
- for (std::vector<const_tree>::iterator j = equivalent.begin (),
+ for (std::vector<tree>::iterator j = equivalent.begin (),
f = equivalent.end ();
j != f; j++)
{
- const_tree r_j = *j;
+ tree r_j = *j;
field_access_map_t equivalent_field_map = record_field_map[r_j];
keep_only_read_fields_from_field_map (equivalent_field_map, field_offset);
}
@@ -517,14 +517,14 @@ keep_only_read_fields_from_equivalent_field_maps (
static void
erase_if_no_fields_can_be_deleted (
record_field_offset_map_t &record_field_offset_map,
- std::set<const_tree> &to_keep, std::set<const_tree> &to_erase)
+ std::set<tree> &to_keep, std::set<tree> &to_erase)
{
- for (std::map<const_tree, field_offsets_t>::iterator i
+ for (std::map<tree, field_offsets_t>::iterator i
= record_field_offset_map.begin (),
e = record_field_offset_map.end ();
i != e; ++i)
{
- const_tree record = i->first;
+ tree record = i->first;
const bool keep = to_keep.find (record) != to_keep.end ();
if (keep)
continue;
@@ -532,11 +532,11 @@ erase_if_no_fields_can_be_deleted (
to_erase.insert (record);
}
- for (std::set<const_tree>::iterator i = to_erase.begin (),
+ for (std::set<tree>::iterator i = to_erase.begin (),
e = to_erase.end ();
i != e; ++i)
{
- const_tree record = *i;
+ tree record = *i;
record_field_offset_map.erase (record);
}
}
@@ -548,15 +548,15 @@ erase_if_no_fields_can_be_deleted (
static void
mark_escaping_types_to_be_deleted (
record_field_offset_map_t &record_field_offset_map,
- std::set<const_tree> &to_erase, tpartitions_t casting)
+ std::set<tree> &to_erase, tpartitions_t casting)
{
const tset_t &non_escaping = casting.non_escaping;
- for (std::map<const_tree, field_offsets_t>::iterator i
+ for (std::map<tree, field_offsets_t>::iterator i
= record_field_offset_map.begin (),
e = record_field_offset_map.end ();
i != e; ++i)
{
- const_tree record = i->first;
+ tree record = i->first;
const bool in_set = non_escaping.find (record) != non_escaping.end ();
if (in_set)
continue;
@@ -573,13 +573,13 @@ obtain_nonescaping_unaccessed_fields (tpartitions_t casting,
{
bool has_fields_that_can_be_deleted = false;
record_field_offset_map_t record_field_offset_map;
- for (std::map<const_tree, field_access_map_t>::iterator i
+ for (std::map<tree, field_access_map_t>::iterator i
= record_field_map.begin (),
e = record_field_map.end ();
i != e; ++i)
{
- const_tree r_i = i->first;
- std::vector<const_tree> equivalence
+ tree r_i = i->first;
+ std::vector<tree> equivalence
= find_equivalent_trees (r_i, record_field_map, casting);
field_offsets_t field_offset;
field_access_map_t original_field_map = record_field_map[r_i];
@@ -596,16 +596,16 @@ obtain_nonescaping_unaccessed_fields (tpartitions_t casting,
// we need to compute the complement...
// Improve: This is tightly coupled, I need to decouple it...
- std::set<const_tree> to_erase;
- std::set<const_tree> to_keep;
+ std::set<tree> to_erase;
+ std::set<tree> to_keep;
mark_escaping_types_to_be_deleted (record_field_offset_map, to_erase,
casting);
- for (std::map<const_tree, field_offsets_t>::iterator i
+ for (std::map<tree, field_offsets_t>::iterator i
= record_field_offset_map.begin (),
e = record_field_offset_map.end ();
i != e; ++i)
{
- const_tree record = i->first;
+ tree record = i->first;
const bool will_be_erased = to_erase.find (record) != to_erase.end ();
// No need to compute which fields can be deleted if type is escaping
if (will_be_erased)
@@ -654,7 +654,7 @@ obtain_nonescaping_unaccessed_fields (tpartitions_t casting,
// Main interface to TypeWalker
// Start recursive walk
void
-TypeWalker::walk (const_tree t)
+TypeWalker::walk (tree t)
{
gcc_assert (t);
this->tset.clear ();
@@ -662,7 +662,7 @@ TypeWalker::walk (const_tree t)
}
void
-TypeWalker::_walk (const_tree type)
+TypeWalker::_walk (tree type)
{
// Improve, verify that having a type is an invariant.
// I think there was a specific example which didn't
@@ -763,7 +763,7 @@ TypeWalker::_walk (const_tree type)
// and after we need to
// call the post-order callback.
#define TypeWalkerFuncDef(code) \
- void TypeWalker::walk_##code (const_tree t) \
+ void TypeWalker::walk_##code (tree t) \
{ \
assert_is_type (t, code); \
_walk_##code##_pre (t); \
@@ -772,7 +772,7 @@ TypeWalker::_walk (const_tree type)
}
#define TypeWalkerFuncDefInternal(code) \
- void TypeWalker::_walk_##code (__attribute__ ((unused)) const_tree t) \
+ void TypeWalker::_walk_##code (__attribute__ ((unused)) tree t) \
{}
TypeWalkerFuncDef (VOID_TYPE)
@@ -795,9 +795,9 @@ TypeWalkerFuncDefInternal (ENUMERAL_TYPE)
/* walk wrapper is used for unwrapping
* REFERENCE_TYPE, POINTER_TYPE, ARRAY_TYPE.
*/
-void TypeWalker::_walk_wrapper (const_tree t)
+void TypeWalker::_walk_wrapper (tree t)
{
- const_tree inner_type = TREE_TYPE (t);
+ tree inner_type = TREE_TYPE (t);
// I think I encountered this code:
// FIXME: Do we really need this?
if (!inner_type)
@@ -808,7 +808,7 @@ void TypeWalker::_walk_wrapper (const_tree t)
}
#define TypeWalkerFuncDefWrapper(code) \
- void TypeWalker::_walk_##code (const_tree t) \
+ void TypeWalker::_walk_##code (tree t) \
{ _walk_wrapper (t); }
TypeWalkerFuncDef (POINTER_TYPE)
@@ -820,7 +820,7 @@ TypeWalkerFuncDefWrapper (ARRAY_TYPE)
TypeWalkerFuncDef (RECORD_TYPE)
void
-TypeWalker::_walk_RECORD_TYPE (const_tree t)
+TypeWalker::_walk_RECORD_TYPE (tree t)
{
_walk_record_or_union (t);
}
@@ -828,13 +828,13 @@ TypeWalker::_walk_RECORD_TYPE (const_tree t)
TypeWalkerFuncDef (UNION_TYPE)
void
-TypeWalker::_walk_UNION_TYPE (const_tree t)
+TypeWalker::_walk_UNION_TYPE (tree t)
{
_walk_record_or_union (t);
}
void
-TypeWalker::_walk_record_or_union (const_tree t)
+TypeWalker::_walk_record_or_union (tree t)
{
for (tree field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
{
@@ -844,7 +844,7 @@ TypeWalker::_walk_record_or_union (const_tree t)
}
void
-TypeWalker::walk_field (const_tree t)
+TypeWalker::walk_field (tree t)
{
_walk_field_pre (t);
_walk_field (t);
@@ -852,37 +852,37 @@ TypeWalker::walk_field (const_tree t)
}
void
-TypeWalker::_walk_field (const_tree t)
+TypeWalker::_walk_field (tree t)
{
- const_tree inner_type = TREE_TYPE (t);
+ tree inner_type = TREE_TYPE (t);
gcc_assert (inner_type);
_walk (inner_type);
}
TypeWalkerFuncDef (FUNCTION_TYPE)
- void TypeWalker::_walk_FUNCTION_TYPE (const_tree t)
+ void TypeWalker::_walk_FUNCTION_TYPE (tree t)
{
_walk_function_or_method (t);
}
TypeWalkerFuncDef (METHOD_TYPE)
- void TypeWalker::_walk_METHOD_TYPE (const_tree t)
+ void TypeWalker::_walk_METHOD_TYPE (tree t)
{
_walk_function_or_method (t);
}
void
-TypeWalker::_walk_function_or_method (const_tree t)
+TypeWalker::_walk_function_or_method (tree t)
{
- const_tree ret_type = TREE_TYPE (t);
+ tree ret_type = TREE_TYPE (t);
walk_return (ret_type);
walk_args (t);
}
void
-TypeWalker::walk_return (const_tree t)
+TypeWalker::walk_return (tree t)
{
_walk_return_pre (t);
_walk_return (t);
@@ -890,13 +890,13 @@ TypeWalker::walk_return (const_tree t)
}
void
-TypeWalker::_walk_return (const_tree t)
+TypeWalker::_walk_return (tree t)
{
_walk (t);
}
void
-TypeWalker::walk_args (const_tree t)
+TypeWalker::walk_args (tree t)
{
_walk_args_pre (t);
_walk_args (t);
@@ -904,19 +904,19 @@ TypeWalker::walk_args (const_tree t)
}
void
-TypeWalker::_walk_args (const_tree t)
+TypeWalker::_walk_args (tree t)
{
for (tree arg_node = TYPE_ARG_TYPES (t); NULL_TREE != arg_node;
arg_node = TREE_CHAIN (arg_node))
{
- const_tree arg_node_type = TREE_VALUE (arg_node);
+ tree arg_node_type = TREE_VALUE (arg_node);
gcc_assert (arg_node_type);
walk_arg (arg_node_type);
}
}
void
-TypeWalker::walk_arg (const_tree t)
+TypeWalker::walk_arg (tree t)
{
_walk_arg_pre (t);
_walk_arg (t);
@@ -924,14 +924,14 @@ TypeWalker::walk_arg (const_tree t)
}
void
-TypeWalker::_walk_arg (const_tree t)
+TypeWalker::_walk_arg (tree t)
{
_walk (t);
}
/* Main interface for the ExprWalker... */
void
-ExprWalker::walk (const_tree e)
+ExprWalker::walk (tree e)
{
if (detected_incompatible_syntax) return;
_walk_pre (e);
@@ -940,7 +940,7 @@ ExprWalker::walk (const_tree e)
}
void
-ExprWalker::_walk (const_tree e)
+ExprWalker::_walk (tree e)
{
gcc_assert (e);
const enum tree_code code = TREE_CODE (e);
@@ -1035,7 +1035,7 @@ ExprWalker::_walk (const_tree e)
* call post-order callback for everything.
*/
#define ExprWalkerFuncDef(code) \
- void ExprWalker::walk_##code (const_tree e) \
+ void ExprWalker::walk_##code (tree e) \
{ \
assert_is_type (e, code); \
_walk_pre (e); \
@@ -1069,29 +1069,29 @@ ExprWalkerFuncDef (GT_EXPR)
ExprWalkerFuncDef (GE_EXPR)
ExprWalkerFuncDef (NE_EXPR)
-void ExprWalker::_walk_leaf (const_tree e, const enum tree_code c)
+void ExprWalker::_walk_leaf (tree e, const enum tree_code c)
{
assert_is_type (e, c);
}
void
-ExprWalker::_walk_op_n (const_tree e, unsigned n)
+ExprWalker::_walk_op_n (tree e, unsigned n)
{
gcc_assert (e);
- const_tree op_n = TREE_OPERAND (e, n);
+ tree op_n = TREE_OPERAND (e, n);
gcc_assert (op_n);
walk (op_n);
}
void
-ExprWalker::_walk_op_0 (const_tree e, const enum tree_code c)
+ExprWalker::_walk_op_0 (tree e, const enum tree_code c)
{
assert_is_type (e, c);
_walk_op_n (e, 0);
}
void
-ExprWalker::_walk_op_1 (const_tree e, const enum tree_code c)
+ExprWalker::_walk_op_1 (tree e, const enum tree_code c)
{
assert_is_type (e, c);
_walk_op_n (e, 0);
@@ -1099,68 +1099,68 @@ ExprWalker::_walk_op_1 (const_tree e, const enum tree_code c)
}
void
-ExprWalker::_walk_CONSTRUCTOR (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_CONSTRUCTOR (__attribute__ ((unused)) tree e)
{
// Future-work: If we want to support rewriting CONSTRUCTORs
// we will have to walk them
}
void
-ExprWalker::_walk_LE_EXPR (const_tree e)
+ExprWalker::_walk_LE_EXPR (tree e)
{
_walk_op_1 (e, LE_EXPR);
}
void
-ExprWalker::_walk_LT_EXPR (const_tree e)
+ExprWalker::_walk_LT_EXPR (tree e)
{
_walk_op_1 (e, LT_EXPR);
}
void
-ExprWalker::_walk_EQ_EXPR (const_tree e)
+ExprWalker::_walk_EQ_EXPR (tree e)
{
_walk_op_1 (e, EQ_EXPR);
}
void
-ExprWalker::_walk_GT_EXPR (const_tree e)
+ExprWalker::_walk_GT_EXPR (tree e)
{
_walk_op_1 (e, GT_EXPR);
}
void
-ExprWalker::_walk_GE_EXPR (const_tree e)
+ExprWalker::_walk_GE_EXPR (tree e)
{
_walk_op_1 (e, GE_EXPR);
}
void
-ExprWalker::_walk_NE_EXPR (const_tree e)
+ExprWalker::_walk_NE_EXPR (tree e)
{
_walk_op_1 (e, NE_EXPR);
}
void
-ExprWalker::_walk_INTEGER_CST (const_tree e)
+ExprWalker::_walk_INTEGER_CST (tree e)
{
_walk_leaf (e, INTEGER_CST);
}
void
-ExprWalker::_walk_REAL_CST (const_tree e)
+ExprWalker::_walk_REAL_CST (tree e)
{
_walk_leaf (e, REAL_CST);
}
void
-ExprWalker::_walk_STRING_CST (const_tree e)
+ExprWalker::_walk_STRING_CST (tree e)
{
_walk_leaf (e, STRING_CST);
}
void
-ExprWalker::_walk_BIT_FIELD_REF (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_BIT_FIELD_REF (__attribute__ ((unused)) tree e)
{
// TODO:
// We currently don't support bit_field_ref
@@ -1168,73 +1168,73 @@ ExprWalker::_walk_BIT_FIELD_REF (__attribute__ ((unused)) const_tree e)
}
void
-ExprWalker::_walk_ARRAY_REF (const_tree e)
+ExprWalker::_walk_ARRAY_REF (tree e)
{
_walk_op_1 (e, ARRAY_REF);
}
void
-ExprWalker::_walk_MEM_REF (const_tree e)
+ExprWalker::_walk_MEM_REF (tree e)
{
_walk_op_1 (e, MEM_REF);
}
void
-ExprWalker::_walk_COMPONENT_REF (const_tree e)
+ExprWalker::_walk_COMPONENT_REF (tree e)
{
_walk_op_1 (e, COMPONENT_REF);
}
void
-ExprWalker::_walk_SSA_NAME (const_tree e)
+ExprWalker::_walk_SSA_NAME (tree e)
{
_walk_leaf (e, SSA_NAME);
}
void
-ExprWalker::_walk_ADDR_EXPR (const_tree e)
+ExprWalker::_walk_ADDR_EXPR (tree e)
{
_walk_op_0 (e, ADDR_EXPR);
}
void
-ExprWalker::_walk_VIEW_CONVERT_EXPR (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_VIEW_CONVERT_EXPR (__attribute__ ((unused)) tree e)
{
// TODO: I don't think we need to do anything here
}
void
-ExprWalker::_walk_IMAGPART_EXPR (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_IMAGPART_EXPR (__attribute__ ((unused)) tree e)
{
// TODO: I don't think we need to do anything here
}
void
-ExprWalker::_walk_FIELD_DECL (const_tree e)
+ExprWalker::_walk_FIELD_DECL (tree e)
{
_walk_leaf (e, FIELD_DECL);
}
void
-ExprWalker::_walk_VAR_DECL (const_tree e)
+ExprWalker::_walk_VAR_DECL (tree e)
{
_walk_leaf (e, VAR_DECL);
}
void
-ExprWalker::_walk_RESULT_DECL (const_tree e)
+ExprWalker::_walk_RESULT_DECL (tree e)
{
_walk_leaf (e, RESULT_DECL);
}
void
-ExprWalker::_walk_PARM_DECL (const_tree e)
+ExprWalker::_walk_PARM_DECL (tree e)
{
_walk_leaf (e, PARM_DECL);
}
void
-ExprWalker::_walk_FUNCTION_DECL (const_tree e)
+ExprWalker::_walk_FUNCTION_DECL (tree e)
{
_walk_leaf (e, FUNCTION_DECL);
for (tree parm = DECL_ARGUMENTS (e); parm; parm = DECL_CHAIN (parm))
@@ -1301,7 +1301,7 @@ GimpleWalker::_walk_global (varpool_node *vnode)
void
GimpleWalker::_walk_ssa_names (cgraph_node *cnode)
{
- const_tree decl = cnode->decl;
+ tree decl = cnode->decl;
gcc_assert (decl);
function *func = DECL_STRUCT_FUNCTION (decl);
gcc_assert (func);
@@ -1337,7 +1337,7 @@ GimpleWalker::_walk_cnode (cgraph_node *cnode)
void
GimpleWalker::_walk_locals (cgraph_node *cnode)
{
- const_tree decl = cnode->decl;
+ tree decl = cnode->decl;
gcc_assert (decl);
function *func = DECL_STRUCT_FUNCTION (decl);
gcc_assert (func);
@@ -1356,7 +1356,7 @@ GimpleWalker::_walk_bb (cgraph_node *cnode)
{
gcc_assert (cnode);
cnode->get_untransformed_body ();
- const_tree decl = cnode->decl;
+ tree decl = cnode->decl;
gcc_assert (decl);
function *func = DECL_STRUCT_FUNCTION (decl);
gcc_assert (func);
@@ -1373,7 +1373,7 @@ GimpleWalker::_walk_bb (cgraph_node *cnode)
void
GimpleWalker::_walk_decl (cgraph_node *cnode)
{
- const_tree decl = cnode->decl;
+ tree decl = cnode->decl;
gcc_assert (decl);
walk_tree2 (decl);
}
@@ -1512,7 +1512,7 @@ GimpleWalker::_walk_gimple (gimple *stmt)
}
void
-GimpleWalker::walk_tree2 (const_tree t)
+GimpleWalker::walk_tree2 (tree t)
{
_walk_pre_tree (t);
_walk_tree (t);
@@ -1520,7 +1520,7 @@ GimpleWalker::walk_tree2 (const_tree t)
}
void
-GimpleWalker::_walk_tree (const_tree t)
+GimpleWalker::_walk_tree (__attribute__((unused)) tree t)
{}
void
@@ -1532,7 +1532,7 @@ GimpleWalker::walk_gassign (gassign *g)
}
void
-GimpleWalker::_walk_gassign (gassign *g)
+GimpleWalker::_walk_gassign (__attribute__((unused)) gassign *g)
{}
void
@@ -1544,7 +1544,7 @@ GimpleWalker::walk_greturn (greturn *g)
}
void
-GimpleWalker::_walk_greturn (greturn *g)
+GimpleWalker::_walk_greturn (__attribute__((unused)) greturn *g)
{}
void
@@ -1556,7 +1556,7 @@ GimpleWalker::walk_gcond (gcond *g)
}
void
-GimpleWalker::_walk_gcond (gcond *g)
+GimpleWalker::_walk_gcond (__attribute__((unused)) gcond *g)
{}
void
@@ -1568,7 +1568,7 @@ GimpleWalker::walk_gcall (gcall *g)
}
void
-GimpleWalker::_walk_gcall (gcall *g)
+GimpleWalker::_walk_gcall (__attribute__((unused)) gcall *g)
{}
void
@@ -1580,7 +1580,7 @@ GimpleWalker::walk_glabel (glabel *g)
}
void
-GimpleWalker::_walk_glabel (glabel *g)
+GimpleWalker::_walk_glabel (__attribute__((unused))glabel *g)
{}
void
@@ -1592,7 +1592,7 @@ GimpleWalker::walk_gswitch (gswitch *g)
}
void
-GimpleWalker::_walk_gswitch (gswitch *g)
+GimpleWalker::_walk_gswitch (__attribute__((unused)) gswitch *g)
{
}
@@ -1605,12 +1605,12 @@ GimpleWalker::walk_gphi (gphi *g)
}
void
-GimpleWalker::_walk_gphi (gphi *g)
+GimpleWalker::_walk_gphi (__attribute__((unused)) gphi *g)
{
}
void
-TypeCollector::collect (const_tree t)
+TypeCollector::collect (tree t)
{
const bool in_set = ptrset.in_universe (t);
// Early memoization...
@@ -1644,9 +1644,9 @@ TypeCollector::_sanity_check ()
for (tset_t::iterator j = ptrset.complement.begin (), f = ptrset.complement.end ();
j != f; ++j)
{
- const_tree type_ptr = *i;
+ tree type_ptr = *i;
gcc_assert (type_ptr);
- const_tree type_com = *j;
+ tree type_com = *j;
gcc_assert (type_com);
const bool valid_sets = type_ptr != type_com;
if (valid_sets)
@@ -1664,7 +1664,7 @@ TypeCollector::_sanity_check ()
/* Determine if T is already memoized in the TypeCollector. */
bool
-TypeCollector::is_memoized (const_tree t)
+TypeCollector::is_memoized (tree t)
{
/* If we haven't seen it then no. */
const bool in_set = ptrset.in_universe (t);
@@ -1675,7 +1675,7 @@ TypeCollector::is_memoized (const_tree t)
// we must update all types that can refer
// to memoized type.
const bool points_to_record = ptrset.in_points_to_record (t);
- for (std::map<const_tree, bool>::iterator i = ptr.begin (), e = ptr.end (); i != e; ++i)
+ for (std::map<tree, bool>::iterator i = ptr.begin (), e = ptr.end (); i != e; ++i)
{
i->second |= points_to_record;
}
@@ -1683,91 +1683,91 @@ TypeCollector::is_memoized (const_tree t)
}
void
-TypeCollector::_walk_VOID_TYPE_pre (const_tree t)
+TypeCollector::_walk_VOID_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_VOID_TYPE_post (const_tree t)
+TypeCollector::_walk_VOID_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_INTEGER_TYPE_pre (const_tree t)
+TypeCollector::_walk_INTEGER_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_INTEGER_TYPE_post (const_tree t)
+TypeCollector::_walk_INTEGER_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_REAL_TYPE_pre (const_tree t)
+TypeCollector::_walk_REAL_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_REAL_TYPE_post (const_tree t)
+TypeCollector::_walk_REAL_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_FIXED_POINT_TYPE_pre (const_tree t)
+TypeCollector::_walk_FIXED_POINT_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_FIXED_POINT_TYPE_post (const_tree t)
+TypeCollector::_walk_FIXED_POINT_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_COMPLEX_TYPE_pre (const_tree t)
+TypeCollector::_walk_COMPLEX_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_COMPLEX_TYPE_post (const_tree t)
+TypeCollector::_walk_COMPLEX_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_ENUMERAL_TYPE_pre (const_tree t)
+TypeCollector::_walk_ENUMERAL_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_ENUMERAL_TYPE_post (const_tree t)
+TypeCollector::_walk_ENUMERAL_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_BOOLEAN_TYPE_pre (const_tree t)
+TypeCollector::_walk_BOOLEAN_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_BOOLEAN_TYPE_post (const_tree t)
+TypeCollector::_walk_BOOLEAN_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_collect_simple (const_tree t)
+TypeCollector::_collect_simple (tree t)
{
// Insert into persistent set.
ptrset.insert (t, ptr[t]);
@@ -1776,46 +1776,46 @@ TypeCollector::_collect_simple (const_tree t)
}
void
-TypeCollector::_walk_ARRAY_TYPE_pre (const_tree t)
+TypeCollector::_walk_ARRAY_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_ARRAY_TYPE_post (const_tree t)
+TypeCollector::_walk_ARRAY_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_POINTER_TYPE_pre (const_tree t)
+TypeCollector::_walk_POINTER_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_POINTER_TYPE_post (const_tree t)
+TypeCollector::_walk_POINTER_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_REFERENCE_TYPE_pre (const_tree t)
+TypeCollector::_walk_REFERENCE_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_REFERENCE_TYPE_post (const_tree t)
+TypeCollector::_walk_REFERENCE_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_RECORD_TYPE_post (const_tree t)
+TypeCollector::_walk_RECORD_TYPE_post (tree t)
{
// All in ptr point to record
- for (std::map<const_tree, bool>::iterator i = ptr.begin (), e = ptr.end (); i != e; ++i)
+ for (std::map<tree, bool>::iterator i = ptr.begin (), e = ptr.end (); i != e; ++i)
{
i->second = true;
}
@@ -1824,52 +1824,52 @@ TypeCollector::_walk_RECORD_TYPE_post (const_tree t)
}
void
-TypeCollector::_walk_RECORD_TYPE_pre (const_tree t)
+TypeCollector::_walk_RECORD_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_UNION_TYPE_pre (const_tree t)
+TypeCollector::_walk_UNION_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_UNION_TYPE_post (const_tree t)
+TypeCollector::_walk_UNION_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_FUNCTION_TYPE_post (const_tree t)
+TypeCollector::_walk_FUNCTION_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_FUNCTION_TYPE_pre (const_tree t)
+TypeCollector::_walk_FUNCTION_TYPE_pre (tree t)
{
ptr[t] = false;
}
void
-TypeCollector::_walk_METHOD_TYPE_post (const_tree t)
+TypeCollector::_walk_METHOD_TYPE_post (tree t)
{
_collect_simple (t);
}
void
-TypeCollector::_walk_METHOD_TYPE_pre (const_tree t)
+TypeCollector::_walk_METHOD_TYPE_pre (tree t)
{
ptr[t] = false;
}
inline void
-ExprCollector::_walk_pre (const_tree e)
+ExprCollector::_walk_pre (tree e)
{
if (!e) return;
- const_tree t = TREE_TYPE (e);
+ tree t = TREE_TYPE (e);
gcc_assert (t);
typeCollector.collect (t);
@@ -1880,9 +1880,9 @@ ExprCollector::_walk_pre (const_tree e)
return;
}
- for (std::set<const_tree>::iterator i = typeCollector.ptrset.records.begin(), e = typeCollector.ptrset.records.end(); i != e; ++i)
+ for (std::set<tree>::iterator i = typeCollector.ptrset.records.begin(), e = typeCollector.ptrset.records.end(); i != e; ++i)
{
- const_tree r = *i;
+ tree r = *i;
TypeIncompleteEquality structuralEquality;
bool is_same = structuralEquality.equal (TYPE_MAIN_VARIANT(r), TYPE_MAIN_VARIANT(t));
if (is_same) continue;
@@ -1901,7 +1901,7 @@ ExprCollector::_walk_pre (const_tree e)
* * does not reach a RECORD_TYPE.
*/
void
-GimpleTypeCollector::_walk_pre_tree (const_tree t)
+GimpleTypeCollector::_walk_pre_tree (tree t)
{
if (!t) return;
exprCollector.walk (t);
@@ -1920,7 +1920,7 @@ GimpleTypeCollector::_walk_pre_tree (const_tree t)
void
GimpleTypeCollector::_walk_pre_gassign (gassign *s)
{
- const_tree lhs = gimple_assign_lhs (s);
+ tree lhs = gimple_assign_lhs (s);
exprCollector.walk (lhs);
const enum gimple_rhs_class gclass = gimple_assign_rhs_class (s);
@@ -1928,20 +1928,20 @@ GimpleTypeCollector::_walk_pre_gassign (gassign *s)
{
case GIMPLE_TERNARY_RHS:
{
- const_tree rhs = gimple_assign_rhs3 (s);
+ tree rhs = gimple_assign_rhs3 (s);
exprCollector.walk (rhs);
}
/* fall-through */
case GIMPLE_BINARY_RHS:
{
- const_tree rhs = gimple_assign_rhs2 (s);
+ tree rhs = gimple_assign_rhs2 (s);
exprCollector.walk (rhs);
}
/* fall-through */
case GIMPLE_UNARY_RHS:
case GIMPLE_SINGLE_RHS:
{
- const_tree rhs = gimple_assign_rhs1 (s);
+ tree rhs = gimple_assign_rhs1 (s);
exprCollector.walk (rhs);
}
break;
@@ -1954,7 +1954,7 @@ GimpleTypeCollector::_walk_pre_gassign (gassign *s)
void
GimpleTypeCollector::_walk_pre_greturn (greturn *s)
{
- const_tree retval = gimple_return_retval (s);
+ tree retval = gimple_return_retval (s);
if (!retval)
return;
@@ -1968,12 +1968,12 @@ GimpleTypeCollector::_walk_pre_gcall (gcall *s)
unsigned n = gimple_call_num_args (s);
for (unsigned i = 0; i < n; i++)
{
- const_tree a = gimple_call_arg (s, i);
+ tree a = gimple_call_arg (s, i);
exprCollector.walk (a);
}
// Walk over the return type if it exists.
- const_tree lhs = gimple_call_lhs (s);
+ tree lhs = gimple_call_lhs (s);
if (!lhs)
return;
@@ -2002,14 +2002,14 @@ GimpleTypeCollector::print_collected ()
void
GimpleTypeCollector::_walk_pre_gcond (gcond *s)
{
- const_tree lhs = gimple_cond_lhs (s);
+ tree lhs = gimple_cond_lhs (s);
exprCollector.walk (lhs);
- const_tree rhs = gimple_cond_rhs (s);
+ tree rhs = gimple_cond_rhs (s);
exprCollector.walk (rhs);
}
bool
-TypeEscaper::is_memoized (__attribute__ ((unused)) const_tree t)
+TypeEscaper::is_memoized (__attribute__ ((unused)) tree t)
{
// Can't memoize here because
// information is propagated up and down
@@ -2034,7 +2034,7 @@ TypeEscaper::place_escaping_types_in_set ()
TypeStringifier stringifier;
for (typemap::iterator i = calc.begin (), e = calc.end (); i != e; ++i)
{
- const_tree type = i->first;
+ tree type = i->first;
// We should only track interesting types
// Types which are not in points_to_record are the ones
@@ -2051,7 +2051,7 @@ TypeEscaper::place_escaping_types_in_set ()
}
void
-TypeEscaper::update (const_tree t, Reason r)
+TypeEscaper::update (tree t, Reason r)
{
gcc_assert (t);
_reason = r;
@@ -2059,7 +2059,7 @@ TypeEscaper::update (const_tree t, Reason r)
}
void
-TypeEscaper::_update (const_tree t)
+TypeEscaper::_update (tree t)
{
gcc_assert (t);
const bool already_in_typemap = calc.find (t) != calc.end ();
@@ -2076,37 +2076,37 @@ TypeEscaper::_update (const_tree t)
}
void
-TypeEscaper::_walk_ARRAY_TYPE_pre (const_tree t)
+TypeEscaper::_walk_ARRAY_TYPE_pre (tree t)
{
_update (t);
}
void
-TypeEscaper::_walk_ARRAY_TYPE_post (const_tree t)
+TypeEscaper::_walk_ARRAY_TYPE_post (tree t)
{
_update (t);
}
void
-TypeEscaper::_walk_POINTER_TYPE_pre (const_tree t)
+TypeEscaper::_walk_POINTER_TYPE_pre (tree t)
{
_update (t);
}
void
-TypeEscaper::_walk_POINTER_TYPE_post (const_tree t)
+TypeEscaper::_walk_POINTER_TYPE_post (tree t)
{
_update (t);
}
void
-TypeEscaper::_walk_REFERENCE_TYPE_pre (const_tree t)
+TypeEscaper::_walk_REFERENCE_TYPE_pre (tree t)
{
_update (t);
}
void
-TypeEscaper::_walk_RECORD_TYPE_pre (const_tree t)
+TypeEscaper::_walk_RECORD_TYPE_pre (tree t)
{
// we are entering a record
_inside_record++;
@@ -2114,7 +2114,7 @@ TypeEscaper::_walk_RECORD_TYPE_pre (const_tree t)
}
void
-TypeEscaper::_walk_RECORD_TYPE_post (const_tree t)
+TypeEscaper::_walk_RECORD_TYPE_post (tree t)
{
_update (t); // This is in case there was a union
// we are exiting a record
@@ -2125,7 +2125,7 @@ TypeEscaper::_walk_RECORD_TYPE_post (const_tree t)
* and propagate up and down.
*/
void
-TypeEscaper::_walk_UNION_TYPE_pre (const_tree t)
+TypeEscaper::_walk_UNION_TYPE_pre (tree t)
{
_inside_union++;
bool is_escaping = _inside_union > 0;
@@ -2137,13 +2137,13 @@ TypeEscaper::_walk_UNION_TYPE_pre (const_tree t)
* and down.
*/
void
-TypeEscaper::_walk_field_pre (const_tree t)
+TypeEscaper::_walk_field_pre (tree t)
{
_reason.type_is_in_union |= DECL_BIT_FIELD (t);
}
void
-TypeEscaper::_walk_UNION_TYPE_post (const_tree t)
+TypeEscaper::_walk_UNION_TYPE_post (tree t)
{
_inside_union--;
_update (t);
@@ -2153,7 +2153,7 @@ TypeEscaper::_walk_UNION_TYPE_post (const_tree t)
* propagate up and down.
*/
void
-TypeEscaper::_walk_FUNCTION_TYPE_pre (__attribute__ ((unused)) const_tree t)
+TypeEscaper::_walk_FUNCTION_TYPE_pre (__attribute__ ((unused)) tree t)
{
_reason.type_is_in_union |= _inside_record > 0;
}
@@ -2162,7 +2162,7 @@ TypeEscaper::_walk_FUNCTION_TYPE_pre (__attribute__ ((unused)) const_tree t)
* propagate up and down.
*/
void
-TypeEscaper::_walk_METHOD_TYPE_pre (__attribute__ ((unused)) const_tree t)
+TypeEscaper::_walk_METHOD_TYPE_pre (__attribute__ ((unused)) tree t)
{
_reason.type_is_in_union |= _inside_record > 0;
}
@@ -2174,7 +2174,7 @@ TypeEscaper::print_reasons ()
TypeStringifier stringifier;
for (typemap::iterator i = calc.begin (), e = calc.end (); i != e; ++i)
{
- const_tree t = i->first;
+ tree t = i->first;
std::string name = stringifier.stringify (t);
Reason r = i->second;
log ("%s reason: ", name.c_str ());
@@ -2196,7 +2196,7 @@ ExprEscaper::print_reasons ()
/* Propagate reason to subexpressions. */
void
-ExprEscaper::update (const_tree t, Reason r)
+ExprEscaper::update (tree t, Reason r)
{
gcc_assert (t);
_r = r;
@@ -2205,26 +2205,26 @@ ExprEscaper::update (const_tree t, Reason r)
/* Propagate reason to type of subexpressions. */
void
-ExprEscaper::_walk_pre (const_tree e)
+ExprEscaper::_walk_pre (tree e)
{
_stack.push (e);
- const_tree t = TREE_TYPE (e);
+ tree t = TREE_TYPE (e);
gcc_assert (t);
typeEscaper.update (t, _r);
}
void
-ExprEscaper::_walk_post (__attribute__ ((unused)) const_tree e)
+ExprEscaper::_walk_post (__attribute__ ((unused)) tree e)
{
_stack.pop ();
}
/* Capture casting on LHS. */
void
-ExprEscaper::_walk_SSA_NAME_pre (const_tree e)
+ExprEscaper::_walk_SSA_NAME_pre (tree e)
{
- const_tree ssa_type = TREE_TYPE (e);
+ tree ssa_type = TREE_TYPE (e);
if (_stack.size () < 4)
return;
@@ -2232,11 +2232,11 @@ ExprEscaper::_walk_SSA_NAME_pre (const_tree e)
// TODO:
// It appears that we have a bug, where we are
// storing expressions twice on the stack
- const_tree this_expr = _stack.top ();
+ tree this_expr = _stack.top ();
_stack.pop ();
- const_tree twice = _stack.top ();
+ tree twice = _stack.top ();
_stack.pop ();
- const_tree prev_expr = _stack.top ();
+ tree prev_expr = _stack.top ();
_stack.push (twice);
_stack.push (this_expr);
if (TREE_CODE (prev_expr) != MEM_REF)
@@ -2244,7 +2244,7 @@ ExprEscaper::_walk_SSA_NAME_pre (const_tree e)
tree op1 = TREE_OPERAND (prev_expr, 1);
gcc_assert (TREE_CODE (op1) == INTEGER_CST);
- const_tree mref_type = TREE_TYPE (op1);
+ tree mref_type = TREE_TYPE (op1);
Reason old_reason = _r;
TypeIncompleteEquality structuralEquality;
@@ -2260,7 +2260,7 @@ ExprEscaper::_walk_SSA_NAME_pre (const_tree e)
/* Mark constructors as escaping. */
void
-ExprEscaper::_walk_CONSTRUCTOR_pre (const_tree e)
+ExprEscaper::_walk_CONSTRUCTOR_pre (tree e)
{
if (TREE_CLOBBER_P (e))
return;
@@ -2270,7 +2270,7 @@ ExprEscaper::_walk_CONSTRUCTOR_pre (const_tree e)
// a this has a constructor.
// Or better yet... modify the constructors!
_r.global_is_visible = true;
- const_tree t = TREE_TYPE (e);
+ tree t = TREE_TYPE (e);
typeEscaper.update (t, _r);
}
@@ -2298,7 +2298,7 @@ GimpleEscaper::_init ()
if (filter)
continue;
- const_tree decl = cnode->decl;
+ tree decl = cnode->decl;
gcc_assert (decl);
undefined.insert (decl);
}
@@ -2307,7 +2307,7 @@ GimpleEscaper::_init ()
{
gcc_assert (cnode);
cnode->get_untransformed_body ();
- const_tree decl = cnode->decl;
+ tree decl = cnode->decl;
gcc_assert (decl);
undefined.erase (decl);
}
@@ -2327,7 +2327,7 @@ GimpleEscaper::is_function_escaping (cgraph_node *cnode)
/* Mark fndecl as escaping is they are externally visible or
* there is no fndecl. */
bool
-GimpleEscaper::is_function_escaping (const_tree fndecl)
+GimpleEscaper::is_function_escaping (tree fndecl)
{
if (!fndecl)
return true;
@@ -2354,7 +2354,7 @@ void
GimpleEscaper::_walk_global (varpool_node *vnode)
{
gcc_assert (vnode);
- const_tree var_decl = vnode->decl;
+ tree var_decl = vnode->decl;
Reason reason;
const bool is_escaping = is_variable_escaping (vnode);
reason.global_is_visible = is_escaping;
@@ -2376,7 +2376,7 @@ GimpleEscaper::_walk_global (varpool_node *vnode)
/* Return true if FNDECL is a known function. */
bool
-GimpleEscaper::filter_known_function (const_tree fndecl)
+GimpleEscaper::filter_known_function (tree fndecl)
{
assert_is_type (fndecl, FUNCTION_DECL);
if (fndecl_built_in_p (fndecl))
@@ -2409,7 +2409,7 @@ GimpleEscaper::filter_known_function (cgraph_node *node)
/* Mark Variable declaration of unknown location as escaping. */
void
-GimpleEscaper::_walk_pre_tree (const_tree t)
+GimpleEscaper::_walk_pre_tree (tree t)
{
// Is any global variable escaping?
Reason reason;
@@ -2434,22 +2434,22 @@ GimpleEscaper::_walk_pre_gassign (gassign *s)
{
case GIMPLE_TERNARY_RHS:
{
- const_tree rhs3 = gimple_assign_rhs3 (s);
+ tree rhs3 = gimple_assign_rhs3 (s);
exprEscaper.update (rhs3, reason);
}
/* fall-through */
case GIMPLE_BINARY_RHS:
{
- const_tree rhs2 = gimple_assign_rhs2 (s);
+ tree rhs2 = gimple_assign_rhs2 (s);
exprEscaper.update (rhs2, reason);
}
/* fall-through */
case GIMPLE_UNARY_RHS:
case GIMPLE_SINGLE_RHS:
{
- const_tree rhs1 = gimple_assign_rhs1 (s);
+ tree rhs1 = gimple_assign_rhs1 (s);
exprEscaper.update (rhs1, reason);
- const_tree lhs = gimple_assign_lhs (s);
+ tree lhs = gimple_assign_lhs (s);
if (!lhs)
break;
exprEscaper.update (lhs, reason);
@@ -2465,7 +2465,7 @@ void
GimpleEscaper::_walk_pre_greturn (greturn *s)
{
Reason reason;
- const_tree val = gimple_return_retval (s);
+ tree val = gimple_return_retval (s);
if (!val)
return;
exprEscaper.update (val, reason);
@@ -2475,8 +2475,8 @@ void
GimpleEscaper::_walk_pre_gcond (gcond *s)
{
Reason reason;
- const_tree lhs = gimple_cond_lhs (s);
- const_tree rhs = gimple_cond_rhs (s);
+ tree lhs = gimple_cond_lhs (s);
+ tree rhs = gimple_cond_rhs (s);
gcc_assert (lhs && rhs);
exprEscaper.update (lhs, reason);
exprEscaper.update (rhs, reason);
@@ -2485,7 +2485,7 @@ GimpleEscaper::_walk_pre_gcond (gcond *s)
void
GimpleEscaper::_walk_pre_gcall (gcall *s)
{
- const_tree fn = gimple_call_fndecl (s);
+ tree fn = gimple_call_fndecl (s);
// gcc_assert (fn);
// The above will not always be true
// It will be false when we have an indirect function
@@ -2503,7 +2503,7 @@ GimpleEscaper::_walk_pre_gcall (gcall *s)
unsigned n = gimple_call_num_args (s);
for (unsigned i = 0; i < n; i++)
{
- const_tree a = gimple_call_arg (s, i);
+ tree a = gimple_call_arg (s, i);
gcc_assert (a);
if (arg_reason.is_escaping ())
{
@@ -2513,7 +2513,7 @@ GimpleEscaper::_walk_pre_gcall (gcall *s)
exprEscaper.typeEscaper.update (TREE_TYPE (a), arg_reason);
}
- const_tree lhs = gimple_call_lhs (s);
+ tree lhs = gimple_call_lhs (s);
if (!lhs)
return;
Reason return_reason;
@@ -2525,14 +2525,14 @@ GimpleEscaper::_walk_pre_gcall (gcall *s)
/* Determine if cast comes from a known function.
* Do this by following the use-def chain. */
bool
-GimpleCaster::follow_def_to_find_if_really_cast (const_tree rhs)
+GimpleCaster::follow_def_to_find_if_really_cast (tree rhs)
{
gimple *def_for_rhs = SSA_NAME_DEF_STMT (rhs);
gcall *is_call = dyn_cast<gcall *> (def_for_rhs);
if (!is_call)
return true;
- const_tree fn = gimple_call_fndecl (is_call);
+ tree fn = gimple_call_fndecl (is_call);
if (!fn)
return true;
@@ -2552,12 +2552,12 @@ GimpleCaster::_walk_pre_gassign (gassign *s)
// but that proved to be insufficient...
// So we have to use our equality comparison...
TypeIncompleteEquality equality;
- const_tree lhs = gimple_assign_lhs (s);
- const_tree rhs = gimple_assign_rhs1 (s);
+ tree lhs = gimple_assign_lhs (s);
+ tree rhs = gimple_assign_rhs1 (s);
gcc_assert (lhs && rhs);
Reason reason;
- const_tree t_lhs = TREE_TYPE (lhs);
- const_tree t_rhs = TREE_TYPE (rhs);
+ tree t_lhs = TREE_TYPE (lhs);
+ tree t_rhs = TREE_TYPE (rhs);
gcc_assert (t_lhs && t_rhs);
bool is_cast = !equality.equal (TYPE_MAIN_VARIANT(t_lhs), TYPE_MAIN_VARIANT(t_rhs));
// If it is cast, we might need to look at the definition of rhs
@@ -2613,14 +2613,14 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
if (!node && currently_walking->inlined_to) return;
- const_tree f_t = TREE_TYPE (fn);
+ tree f_t = TREE_TYPE (fn);
TypeIncompleteEquality equality;
unsigned i = 0;
TypeStringifier stringifier;
for (tree a = TYPE_ARG_TYPES (f_t); NULL_TREE != a; a = TREE_CHAIN (a))
{
- const_tree formal_t = TREE_VALUE (a);
+ tree formal_t = TREE_VALUE (a);
//if (formal_t == ptr_type_node) continue;
//if (formal_t == void_type_node) continue;
// There seems to be a final VOID_TYPE at the end of some functions?
@@ -2629,8 +2629,8 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
if (is_void)
continue;
- const_tree real = gimple_call_arg (s, i);
- const_tree real_t = TREE_TYPE (real);
+ tree real = gimple_call_arg (s, i);
+ tree real_t = TREE_TYPE (real);
const bool is_casted = !equality.equal (formal_t, real_t);
log("arg %s is casted: %s\n", stringifier.stringify(real_t).c_str(), is_casted ? "T" : "F");
Reason arg_reason;
@@ -2639,12 +2639,12 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
i++;
}
- const_tree lhs = gimple_call_lhs (s);
+ tree lhs = gimple_call_lhs (s);
if (!lhs)
return;
- const_tree r_t = TREE_TYPE (f_t);
- const_tree l_t TREE_TYPE (lhs);
+ tree r_t = TREE_TYPE (f_t);
+ tree l_t TREE_TYPE (lhs);
const bool is_casted = !equality.equal (r_t, l_t);
Reason ret_reason;
ret_reason.type_is_casted = is_casted;
@@ -2652,14 +2652,14 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
}
bool
-TypeAccessor::is_memoized (const_tree t)
+TypeAccessor::is_memoized (tree t)
{
return memoized_map.find (t) != memoized_map.end ();
}
/* Add all fields in struct to memoized map. */
void
-TypeAccessor::_walk_RECORD_TYPE_pre (const_tree t)
+TypeAccessor::_walk_RECORD_TYPE_pre (tree t)
{
add_all_fields_in_struct (t);
memoized_map.insert (t);
@@ -2667,7 +2667,7 @@ TypeAccessor::_walk_RECORD_TYPE_pre (const_tree t)
/* Initialize all fields as neither read nor written. */
void
-TypeAccessor::add_all_fields_in_struct (const_tree t)
+TypeAccessor::add_all_fields_in_struct (tree t)
{
const enum tree_code c = TREE_CODE (t);
const bool is_record = RECORD_TYPE == c;
@@ -2698,27 +2698,27 @@ ExprAccessor::get_map ()
}
void
-ExprAccessor::add_all_fields_in_struct (const_tree t)
+ExprAccessor::add_all_fields_in_struct (tree t)
{
_typeAccessor.walk (t);
}
void
-ExprAccessor::_walk_pre (const_tree e)
+ExprAccessor::_walk_pre (tree e)
{
_stack.push (e);
- const_tree t = TREE_TYPE (e);
+ tree t = TREE_TYPE (e);
add_all_fields_in_struct (t);
}
void
-ExprAccessor::_walk_post (__attribute__ ((unused)) const_tree e)
+ExprAccessor::_walk_post (__attribute__ ((unused)) tree e)
{
_stack.pop ();
}
void
-ExprAccessor::update (const_tree e, unsigned access)
+ExprAccessor::update (tree e, unsigned access)
{
_access = access;
walk (e);
@@ -2737,7 +2737,7 @@ ExprAccessor::update (const_tree e, unsigned access)
* read.
*/
void
-ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) const_tree e)
+ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) tree e)
{
log ("expr accessor mem ref\n");
log ("stack size = %d\n", _stack.size ());
@@ -2746,11 +2746,11 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) const_tree e)
return;
// TODO: Fix error with double pushing
- const_tree addr_expr = _stack.top ();
+ tree addr_expr = _stack.top ();
_stack.pop ();
- const_tree twice = _stack.top ();
+ tree twice = _stack.top ();
_stack.pop ();
- const_tree prev_expr = _stack.top ();
+ tree prev_expr = _stack.top ();
_stack.push (addr_expr);
_stack.push (twice);
log ("prev_expr code = %s\n", get_tree_code_name (TREE_CODE (prev_expr)));
@@ -2758,7 +2758,7 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) const_tree e)
return;
tree op_0 = TREE_OPERAND (addr_expr, 0);
- const_tree addr_expr_t = TREE_TYPE (op_0);
+ tree addr_expr_t = TREE_TYPE (op_0);
TypeStringifier stringifier;
std::string name = stringifier.stringify (addr_expr_t);
@@ -2768,7 +2768,7 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) const_tree e)
// We are accessing a field of a record through pointer arithmetic...
// So what field offset are we computing...
- const_tree mref_expr = prev_expr;
+ tree mref_expr = prev_expr;
tree offset = TREE_OPERAND (mref_expr, 1);
gcc_assert (TREE_CODE (offset) == INTEGER_CST);
tree type_size_tree = TYPE_SIZE_UNIT (addr_expr_t);
@@ -2816,13 +2816,13 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) const_tree e)
* RECORD_TYPE should be marked as READ for safety.
*/
void
-ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
+ExprAccessor::_walk_COMPONENT_REF_pre (tree e)
{
log ("in component_ref pre\n");
assert_is_type (e, COMPONENT_REF);
- const_tree op0 = TREE_OPERAND (e, 0);
+ tree op0 = TREE_OPERAND (e, 0);
gcc_assert (op0);
- const_tree op0_t = TREE_TYPE (op0);
+ tree op0_t = TREE_TYPE (op0);
gcc_assert (op0_t);
// op0_t can either be a RECORD_TYPE or a UNION_TYPE.
const enum tree_code code = TREE_CODE (op0_t);
@@ -2831,7 +2831,7 @@ ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
const bool valid = is_record != is_union;
gcc_assert (valid);
- const_tree op1 = TREE_OPERAND (e, 1);
+ tree op1 = TREE_OPERAND (e, 1);
assert_is_type (op1, FIELD_DECL);
log ("%s.%s\n", TypeStringifier::get_type_identifier (op0_t),
TypeStringifier::get_field_identifier (op1));
@@ -2850,18 +2850,18 @@ ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
if (_stack.size () < 4)
return;
- const_tree this_expr = _stack.top ();
+ tree this_expr = _stack.top ();
_stack.pop ();
- const_tree twice = _stack.top ();
+ tree twice = _stack.top ();
_stack.pop ();
- const_tree prev_expr = _stack.top ();
+ tree prev_expr = _stack.top ();
_stack.push (twice);
_stack.push (this_expr);
if (TREE_CODE (prev_expr) != ADDR_EXPR)
return;
log ("we are taking address of a component?\n");
- const_tree t = op0_t;
+ tree t = op0_t;
if (TREE_CODE (t) != RECORD_TYPE)
return;
@@ -2888,19 +2888,19 @@ ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
void
ExprAccessor::print_accesses ()
{
- for (std::map<const_tree, field_access_map_t>::const_iterator i
+ for (std::map<tree, field_access_map_t>::const_iterator i
= record_field_map.begin (),
e = record_field_map.end ();
i != e; ++i)
{
- const_tree record = i->first;
+ tree record = i->first;
field_access_map_t field_map = i->second;
- for (std::map<const_tree, unsigned>::const_iterator j
+ for (std::map<tree, unsigned>::const_iterator j
= field_map.begin (),
f = field_map.end ();
j != f; ++j)
{
- const_tree field = j->first;
+ tree field = j->first;
const std::string name_r
= TypeStringifier::get_type_identifier (record);
const std::string name_f
@@ -2936,14 +2936,14 @@ GimpleAccesser::_walk_pre_gassign (gassign *s)
{
case GIMPLE_TERNARY_RHS:
{
- const_tree rhs3 = gimple_assign_rhs3 (s);
+ tree rhs3 = gimple_assign_rhs3 (s);
gcc_assert (rhs3);
exprAccessor.update (rhs3, Read);
}
/* fall-through */
case GIMPLE_BINARY_RHS:
{
- const_tree rhs2 = gimple_assign_rhs2 (s);
+ tree rhs2 = gimple_assign_rhs2 (s);
gcc_assert (rhs2);
exprAccessor.update (rhs2, Read);
}
@@ -2951,9 +2951,9 @@ GimpleAccesser::_walk_pre_gassign (gassign *s)
case GIMPLE_UNARY_RHS:
case GIMPLE_SINGLE_RHS:
{
- const_tree rhs1 = gimple_assign_rhs1 (s);
+ tree rhs1 = gimple_assign_rhs1 (s);
exprAccessor.update (rhs1, Read);
- const_tree lhs = gimple_assign_lhs (s);
+ tree lhs = gimple_assign_lhs (s);
if (!lhs)
break;
exprAccessor.update (lhs, Write);
@@ -2972,12 +2972,12 @@ GimpleAccesser::_walk_pre_gcall (gcall *s)
unsigned n = gimple_call_num_args (s);
for (unsigned i = 0; i < n; i++)
{
- const_tree a = gimple_call_arg (s, i);
+ tree a = gimple_call_arg (s, i);
gcc_assert (a);
exprAccessor.update (a, Read);
}
- const_tree lhs = gimple_call_lhs (s);
+ tree lhs = gimple_call_lhs (s);
if (!lhs)
return;
exprAccessor.update (lhs, Write);
@@ -2987,7 +2987,7 @@ GimpleAccesser::_walk_pre_gcall (gcall *s)
void
GimpleAccesser::_walk_pre_greturn (greturn *s)
{
- const_tree val = gimple_return_retval (s);
+ tree val = gimple_return_retval (s);
if (!val)
return;
exprAccessor.update (val, Read);
@@ -2997,8 +2997,8 @@ GimpleAccesser::_walk_pre_greturn (greturn *s)
void
GimpleAccesser::_walk_pre_gcond (gcond *s)
{
- const_tree lhs = gimple_cond_lhs (s);
- const_tree rhs = gimple_cond_rhs (s);
+ tree lhs = gimple_cond_lhs (s);
+ tree rhs = gimple_cond_rhs (s);
gcc_assert (lhs && rhs);
exprAccessor.update (lhs, Read);
exprAccessor.update (rhs, Read);
@@ -3046,7 +3046,7 @@ Reason::operator|= (const Reason &other)
/* Insert TYPE into a partition depending on IN_POINTS_TO_RECORD. */
void
-type_partitions_s::insert (const_tree type, bool in_points_to_record)
+type_partitions_s::insert (tree type, bool in_points_to_record)
{
gcc_assert (type);
this->universe.insert (type);
@@ -3061,7 +3061,7 @@ type_partitions_s::insert (const_tree type, bool in_points_to_record)
/* Find out whether TYPE is already in universe. */
bool
-type_partitions_s::in_universe (const_tree type) const
+type_partitions_s::in_universe (tree type) const
{
gcc_assert (type);
const bool seen_before = this->universe.find (type) != this->universe.end ();
@@ -3070,7 +3070,7 @@ type_partitions_s::in_universe (const_tree type) const
/* Find out whether TYPE is in points_to_record partition. */
bool
-type_partitions_s::in_points_to_record (const_tree type) const
+type_partitions_s::in_points_to_record (tree type) const
{
gcc_assert (type);
const bool seen_before
@@ -3080,7 +3080,7 @@ type_partitions_s::in_points_to_record (const_tree type) const
/* Find out whether TYPE is not in points to record partition. */
bool
-type_partitions_s::in_complement (const_tree type) const
+type_partitions_s::in_complement (tree type) const
{
gcc_assert (type);
const bool seen_before
@@ -3090,7 +3090,7 @@ type_partitions_s::in_complement (const_tree type) const
/* Stringify a type. */
std::string
-TypeStringifier::stringify (const_tree t)
+TypeStringifier::stringify (tree t)
{
if (!dump_file)
return std::string ("");
@@ -3103,49 +3103,49 @@ TypeStringifier::stringify (const_tree t)
}
void
-TypeStringifier::_walk_VOID_TYPE_pre (const_tree t)
+TypeStringifier::_walk_VOID_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_walk_INTEGER_TYPE_pre (const_tree t)
+TypeStringifier::_walk_INTEGER_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_walk_REAL_TYPE_pre (const_tree t)
+TypeStringifier::_walk_REAL_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_walk_FIXED_POINT_TYPE_pre (const_tree t)
+TypeStringifier::_walk_FIXED_POINT_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_walk_COMPLEX_TYPE_pre (const_tree t)
+TypeStringifier::_walk_COMPLEX_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_walk_OFFSET_TYPE_pre (const_tree t)
+TypeStringifier::_walk_OFFSET_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_walk_BOOLEAN_TYPE_pre (const_tree t)
+TypeStringifier::_walk_BOOLEAN_TYPE_pre (tree t)
{
_stringify_simple (t);
}
void
-TypeStringifier::_stringify_simple (const_tree t)
+TypeStringifier::_stringify_simple (tree t)
{
gcc_assert (t);
const enum tree_code code = TREE_CODE (t);
@@ -3153,52 +3153,52 @@ TypeStringifier::_stringify_simple (const_tree t)
}
void
-TypeStringifier::_walk_POINTER_TYPE_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_POINTER_TYPE_post (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string ("*");
}
void
-TypeStringifier::_walk_ARRAY_TYPE_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_ARRAY_TYPE_post (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string ("[]");
}
void
TypeStringifier::_walk_REFERENCE_TYPE_post (__attribute__ ((unused))
- const_tree t)
+ tree t)
{
this->_stringification += std::string ("&");
}
void
-TypeStringifier::_walk_UNION_TYPE_pre (const_tree t)
+TypeStringifier::_walk_UNION_TYPE_pre (tree t)
{
this->_stringification += std::string (" union ");
_stringify_aggregate_pre (t);
}
void
-TypeStringifier::_walk_UNION_TYPE_post (const_tree t)
+TypeStringifier::_walk_UNION_TYPE_post (tree t)
{
_stringify_aggregate_post (t);
}
void
-TypeStringifier::_walk_RECORD_TYPE_pre (const_tree t)
+TypeStringifier::_walk_RECORD_TYPE_pre (tree t)
{
this->_stringification += std::string (" record ");
_stringify_aggregate_pre (t);
}
void
-TypeStringifier::_walk_RECORD_TYPE_post (const_tree t)
+TypeStringifier::_walk_RECORD_TYPE_post (tree t)
{
_stringify_aggregate_post (t);
}
void
-TypeStringifier::_stringify_aggregate_pre (const_tree t)
+TypeStringifier::_stringify_aggregate_pre (tree t)
{
this->_stringification
+= TypeStringifier::get_type_identifier (t) + std::string (" {");
@@ -3206,13 +3206,13 @@ TypeStringifier::_stringify_aggregate_pre (const_tree t)
void
TypeStringifier::_stringify_aggregate_post (__attribute__ ((unused))
- const_tree t)
+ tree t)
{
this->_stringification += std::string ("}");
}
void
-TypeStringifier::_walk_field_post (const_tree t)
+TypeStringifier::_walk_field_post (tree t)
{
this->_stringification += std::string (" ")
+ TypeStringifier::get_field_identifier (t)
@@ -3220,73 +3220,73 @@ TypeStringifier::_walk_field_post (const_tree t)
}
void
-TypeStringifier::_walk_METHOD_TYPE_pre (const_tree t)
+TypeStringifier::_walk_METHOD_TYPE_pre (tree t)
{
_stringify_fm_pre (t);
}
void
-TypeStringifier::_walk_METHOD_TYPE_post (const_tree t)
+TypeStringifier::_walk_METHOD_TYPE_post (tree t)
{
_stringify_fm_post (t);
}
void
-TypeStringifier::_walk_FUNCTION_TYPE_pre (const_tree t)
+TypeStringifier::_walk_FUNCTION_TYPE_pre (tree t)
{
_stringify_fm_pre (t);
}
void
-TypeStringifier::_walk_FUNCTION_TYPE_post (const_tree t)
+TypeStringifier::_walk_FUNCTION_TYPE_post (tree t)
{
_stringify_fm_post (t);
}
void
-TypeStringifier::_stringify_fm_pre (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_stringify_fm_pre (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string ("function { ");
}
void
-TypeStringifier::_stringify_fm_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_stringify_fm_post (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string ("}");
}
void
-TypeStringifier::_walk_return_pre (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_return_pre (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string ("(");
}
void
-TypeStringifier::_walk_return_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_return_post (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string (")");
}
void
-TypeStringifier::_walk_args_pre (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_args_pre (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string ("(");
}
void
-TypeStringifier::_walk_args_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_args_post (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string (")");
}
void
-TypeStringifier::_walk_arg_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_arg_post (__attribute__ ((unused)) tree t)
{
this->_stringification += std::string (", ");
}
std::string
-TypeStringifier::get_type_identifier (const_tree t)
+TypeStringifier::get_type_identifier (tree t)
{
if (detected_incompatible_syntax)
return std::string("");
@@ -3308,10 +3308,10 @@ TypeStringifier::get_type_identifier (const_tree t)
}
std::string
-TypeStringifier::get_field_identifier (const_tree t)
+TypeStringifier::get_field_identifier (tree t)
{
assert_is_type (t, FIELD_DECL);
- const_tree decl_name = DECL_NAME (t);
+ tree decl_name = DECL_NAME (t);
if (!decl_name)
return std::string ("");
@@ -3321,13 +3321,13 @@ TypeStringifier::get_field_identifier (const_tree t)
/* Return true if L and R have equal structural equalities. */
bool
-TypeStructuralEquality::equal (const_tree l, const_tree r)
+TypeStructuralEquality::equal (tree l, tree r)
{
return _equal (l, r);
}
bool
-TypeStructuralEquality::_equal (const_tree l, const_tree r)
+TypeStructuralEquality::_equal (tree l, tree r)
{
bool valid_inputs = l && r;
if (!valid_inputs)
@@ -3386,7 +3386,7 @@ TypeStructuralEquality::_equal (const_tree l, const_tree r)
}
bool
-TypeStructuralEquality::_equal_code (const_tree l, const_tree r)
+TypeStructuralEquality::_equal_code (tree l, tree r)
{
const enum tree_code code_l = TREE_CODE (l);
const enum tree_code code_r = TREE_CODE (r);
@@ -3398,7 +3398,7 @@ TypeStructuralEquality::_equal_code (const_tree l, const_tree r)
}
#define TSE_FUNC_DEF_SIMPLE(code) \
- bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+ bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
{ \
return _equal_code (l, r); \
}
@@ -3413,17 +3413,17 @@ TSE_FUNC_DEF_SIMPLE (OFFSET_TYPE)
TSE_FUNC_DEF_SIMPLE (COMPLEX_TYPE)
bool
-TypeStructuralEquality::_equal_wrapper (const_tree l, const_tree r)
+TypeStructuralEquality::_equal_wrapper (tree l, tree r)
{
- const_tree inner_l = TREE_TYPE (l);
+ tree inner_l = TREE_TYPE (l);
if (TREE_CODE(inner_l) == ARRAY_TYPE && TREE_CODE(TREE_TYPE(inner_l)) == POINTER_TYPE ) inner_l = TREE_TYPE(inner_l);
- const_tree inner_r = TREE_TYPE (r);
+ tree inner_r = TREE_TYPE (r);
if (TREE_CODE(inner_r) == ARRAY_TYPE && TREE_CODE(TREE_TYPE(inner_r)) == POINTER_TYPE ) inner_r = TREE_TYPE(inner_r);
return _equal (inner_l, inner_r);
}
#define TSE_FUNC_DEF_WRAPPER(code) \
- bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+ bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
{ \
return _equal_wrapper (l, r); \
}
@@ -3433,10 +3433,10 @@ TSE_FUNC_DEF_WRAPPER (ARRAY_TYPE)
TSE_FUNC_DEF_WRAPPER (POINTER_TYPE)
#define TSE_FUNC_DEF_CONTAINER(code) \
- bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+ bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
{ \
- const_tree field_l = TYPE_FIELDS (l); \
- const_tree field_r = TYPE_FIELDS (r); \
+ tree field_l = TYPE_FIELDS (l); \
+ tree field_r = TYPE_FIELDS (r); \
bool efield_l = field_l; \
bool efield_r = field_r; \
bool still_equal = efield_l == efield_r; \
@@ -3445,8 +3445,8 @@ TSE_FUNC_DEF_WRAPPER (POINTER_TYPE)
\
while (field_l && field_r && still_equal) \
{ \
- const_tree tfield_l = TREE_TYPE (field_l); \
- const_tree tfield_r = TREE_TYPE (field_r); \
+ tree tfield_l = TREE_TYPE (field_l); \
+ tree tfield_r = TREE_TYPE (field_r); \
still_equal &= _equal (tfield_l, tfield_r); \
field_l = DECL_CHAIN (field_l); \
field_r = DECL_CHAIN (field_r); \
@@ -3461,23 +3461,23 @@ TSE_FUNC_DEF_CONTAINER (RECORD_TYPE)
TSE_FUNC_DEF_CONTAINER (UNION_TYPE)
#define TSE_FUNC_DEF_FUNC(code) \
- bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+ bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
{ \
- const_tree tret_l = TREE_TYPE (l); \
- const_tree tret_r = TREE_TYPE (r); \
+ tree tret_l = TREE_TYPE (l); \
+ tree tret_r = TREE_TYPE (r); \
bool still_equal = _equal (tret_l, tret_r); \
if (!still_equal) \
return still_equal; \
\
- const_tree arg_l = TYPE_ARG_TYPES (l); \
- const_tree arg_r = TYPE_ARG_TYPES (r); \
+ tree arg_l = TYPE_ARG_TYPES (l); \
+ tree arg_r = TYPE_ARG_TYPES (r); \
bool earg_l = arg_l; \
bool earg_r = arg_r; \
still_equal &= earg_l == earg_r; \
while (arg_l && arg_r && still_equal) \
{ \
- const_tree targ_l = TREE_VALUE (arg_l); \
- const_tree targ_r = TREE_VALUE (arg_r); \
+ tree targ_l = TREE_VALUE (arg_l); \
+ tree targ_r = TREE_VALUE (arg_r); \
still_equal &= _equal (targ_l, targ_r); \
arg_l = TREE_CHAIN (arg_l); \
arg_r = TREE_CHAIN (arg_r); \
@@ -3493,7 +3493,7 @@ TSE_FUNC_DEF_FUNC (METHOD_TYPE)
/* Used for comparing incomplete types. */
bool
-TypeIncompleteEquality::_equal (const_tree l, const_tree r)
+TypeIncompleteEquality::_equal (tree l, tree r)
{
bool valid_inputs = l && r;
if (!valid_inputs)
@@ -3509,8 +3509,8 @@ TypeIncompleteEquality::_equal (const_tree l, const_tree r)
// Before comparing with identifiers
// make last attempt to compare using main variants.
- const_tree m_l = TYPE_MAIN_VARIANT (l);
- const_tree m_r = TYPE_MAIN_VARIANT (r);
+ tree m_l = TYPE_MAIN_VARIANT (l);
+ tree m_r = TYPE_MAIN_VARIANT (r);
gcc_assert (m_l && m_r);
can_compare_structurally = m_l == m_r;
if (can_compare_structurally)
@@ -3533,20 +3533,20 @@ fix_escaping_types_in_set (tpartitions_t &types)
TypeIncompleteEquality structuralEquality;
do
{
- std::vector<const_tree> fixes;
+ std::vector<tree> fixes;
fixed_point_reached = true;
- for (std::set<const_tree>::const_iterator i = types.escaping.begin (),
+ for (std::set<tree>::const_iterator i = types.escaping.begin (),
e = types.escaping.end ();
i != e; ++i)
{
- for (std::set<const_tree>::const_iterator j
+ for (std::set<tree>::const_iterator j
= types.non_escaping.begin (),
f = types.non_escaping.end ();
j != f; ++j)
{
- const_tree type_esc = *i;
+ tree type_esc = *i;
gcc_assert (type_esc);
- const_tree type_non = *j;
+ tree type_non = *j;
gcc_assert (type_non);
// There can be cases where incomplete types are marked as
// non-escaping and complete types counter parts are marked as
@@ -3563,11 +3563,11 @@ fix_escaping_types_in_set (tpartitions_t &types)
}
}
- for (std::vector<const_tree>::const_iterator i = fixes.begin (),
+ for (std::vector<tree>::const_iterator i = fixes.begin (),
e = fixes.end ();
i != e; ++i)
{
- const_tree escaping_type = *i;
+ tree escaping_type = *i;
types.escaping.insert (escaping_type);
types.non_escaping.erase (escaping_type);
}
diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h
index cbd07701199..7f271cbc9f6 100644
--- a/gcc/ipa-type-escape-analysis.h
+++ b/gcc/ipa-type-escape-analysis.h
@@ -27,8 +27,10 @@ along with GCC; see the file COPYING3. If not see
#include <set>
/* Logging function, useful for debugging. */
+void log (const char *const fmt, ...) __attribute__((format(printf, 1, 0)));
+
inline void
-log (const char *const fmt, ...)
+log (const char *const fmt, ...)
{
if (!dump_file)
return;
@@ -52,17 +54,17 @@ is_gimple_code (const gimple *stmt, const enum gimple_code ex_code)
/* Determine if type A is complete. */
inline bool
-is_complete (const_tree a)
+is_complete (tree a)
{
gcc_assert (a);
- const_tree type_size = TYPE_SIZE (a);
+ tree type_size = TYPE_SIZE (a);
const bool _is_complete = NULL_TREE != type_size;
return _is_complete;
}
/* Asserts type A is complete. */
inline void
-assert_is_complete (const_tree a)
+assert_is_complete (tree a)
{
const bool _is_complete = is_complete (a);
gcc_assert (_is_complete);
@@ -70,14 +72,14 @@ assert_is_complete (const_tree a)
/* Determine if type A is incomplete. */
inline bool
-is_incomplete (const_tree a)
+is_incomplete (tree a)
{
return !is_complete (a);
}
/* Assert type A has is EXPECTED_CODE. */
inline void
-assert_is_type (const_tree a, const enum tree_code expected_code)
+assert_is_type (tree a, const enum tree_code expected_code)
{
gcc_assert (a);
const enum tree_code observed_code = TREE_CODE (a);
@@ -97,19 +99,19 @@ assert_is_gimple_rhs_class (const gimple *stmt,
gcc_assert (succeeds);
}
-/* There are some cases where I need to change a const_tree to a tree.
+/* There are some cases where I need to change a tree to a tree.
* Some of these are part of the way the API is written. To avoid
* warnings, always use this function for casting away const-ness.
*/
inline static tree
-const_tree_to_tree (const_tree t)
+tree_to_tree (tree t)
{
return (tree) t;
}
// TODO: Rename?
// TSET_T stands for type set.
-typedef std::set<const_tree> tset_t;
+typedef std::set<tree> tset_t;
/* Base class used for visiting tree nodes starting with root T.
* It can handle recursive cases in the tree graph by holding
@@ -128,7 +130,7 @@ public:
/* Main interface to type walker.
* Walk type T.
*/
- void walk (const_tree t);
+ void walk (tree t);
protected:
@@ -136,19 +138,19 @@ protected:
tset_t tset;
/* Inner walking method, used to recurse. */
- void _walk (const_tree t);
+ void _walk (tree t);
/* Common walking method for REFERENCE_TYPE, ARRAY_TYPE, and POINTER_TYPE. */
- void _walk_wrapper (const_tree t);
+ void _walk_wrapper (tree t);
/* Common walking method for RECORD_TYPE and UNION_TYPE. */
- void _walk_record_or_union (const_tree t);
+ void _walk_record_or_union (tree t);
/* Common walking method for FUNCTION_TYPE and METHOD_TYPE. */
- virtual void _walk_function_or_method (const_tree t);
+ virtual void _walk_function_or_method (tree t);
/* If the type is memoized and we don't need to walk further down. */
- virtual bool is_memoized (__attribute__ ((unused)) const_tree t)
+ virtual bool is_memoized (__attribute__ ((unused)) tree t)
{
return false;
}
@@ -159,7 +161,7 @@ protected:
If you want to find a specific type in a specific order,
(e.g. RECORD_TYPE and preorder)
you can create a derived class and implement the function
- void _walk_RECORD_TYPE_pre (const_tree).
+ void _walk_RECORD_TYPE_pre (tree).
walk_##code is the function that calls
the preorder callback
@@ -171,12 +173,12 @@ protected:
specific tree code.
*/
#define TypeWalkerFuncDecl(code) \
- virtual void _walk_##code##_pre (__attribute__((unused)) const_tree t) \
+ virtual void _walk_##code##_pre (__attribute__((unused)) tree t) \
{}; \
- virtual void _walk_##code (const_tree t); \
- virtual void _walk_##code##_post (__attribute__((unused)) const_tree t) \
+ virtual void _walk_##code (tree t); \
+ virtual void _walk_##code##_post (__attribute__((unused)) tree t) \
{}; \
- virtual void walk_##code (const_tree t)
+ virtual void walk_##code (tree t)
// NOTE the lack of semicolon here.
// This is so that when using the macro we can use a semi-colon
@@ -226,19 +228,19 @@ public:
{};
/* Walk tree E. */
- void walk (const_tree e);
+ void walk (tree e);
private:
/* Virtual function to be implemented. Callback for all E in preorder. */
- virtual void _walk_pre (__attribute__ ((unused)) const_tree e)
+ virtual void _walk_pre (__attribute__ ((unused)) tree e)
{};
/* Inner method that will recurse for walking subtrees in E. */
- void _walk (const_tree e);
+ void _walk (tree e);
/* Virtual function to be implemented. Callback for all E in postorder. */
- virtual void _walk_post (__attribute__ ((unused)) const_tree e)
+ virtual void _walk_post (__attribute__ ((unused)) tree e)
{};
/* Walking subtrees generically. Either it is a leaf node,
@@ -249,10 +251,10 @@ private:
tree_code C is used to assert that we are visiting an operand
of a specific tree code.
*/
- inline void _walk_leaf (const_tree e, const enum tree_code c);
- inline void _walk_op_n (const_tree e, unsigned n);
- inline void _walk_op_0 (const_tree e, const enum tree_code c);
- inline void _walk_op_1 (const_tree e, const enum tree_code c);
+ inline void _walk_leaf (tree e, const enum tree_code c);
+ inline void _walk_op_n (tree e, unsigned n);
+ inline void _walk_op_0 (tree e, const enum tree_code c);
+ inline void _walk_op_1 (tree e, const enum tree_code c);
/* Virtual function declarations for the pre-order and post-order callbacks.
* _walk_##code##_pre is the preorder callback
@@ -261,11 +263,11 @@ private:
* _walk_##code##_post is the post-order callback.
*/
#define ExprWalkerFuncDecl(code) \
- virtual void _walk_##code##_pre (__attribute__ ((unused)) const_tree e) \
+ virtual void _walk_##code##_pre (__attribute__ ((unused)) tree e) \
{}; \
- void walk_##code (const_tree e); \
- void _walk_##code (const_tree e); \
- virtual void _walk_##code##_post (__attribute__ ((unused)) const_tree e) \
+ void walk_##code (tree e); \
+ void _walk_##code (tree e); \
+ virtual void _walk_##code##_post (__attribute__ ((unused)) tree e) \
{}
// Some of these are not "EXPR" codes, but they are reachable
@@ -346,11 +348,11 @@ protected:
* These include the pre-order callbacks, walk subtrees,
* and post-order callbacks.
*/
- virtual void _walk_pre_tree(__attribute__((unused)) const_tree t)
+ virtual void _walk_pre_tree(__attribute__((unused)) tree t)
{};
- void walk_tree2(const_tree t);
- void _walk_tree(const_tree t);
- virtual void _walk_post_tree(__attribute__((unused)) const_tree t)
+ void walk_tree2(tree t);
+ void _walk_tree(tree t);
+ virtual void _walk_post_tree(__attribute__((unused)) tree t)
{};
virtual void _walk_pre_gimple(__attribute__((unused)) gimple* g)
@@ -445,16 +447,16 @@ struct type_partitions_s
tset_t records;
/* Determine if we have seen this type before. */
- bool in_universe (const_tree) const;
+ bool in_universe (tree) const;
/* Determine if tree points to a record. */
- bool in_points_to_record (const_tree) const;
+ bool in_points_to_record (tree) const;
/* Determine if tree does not point to a record. */
- bool in_complement (const_tree) const;
+ bool in_complement (tree) const;
/* Insert either in points to record or complement. */
- void insert (const_tree, bool);
+ void insert (tree, bool);
};
typedef struct type_partitions_s tpartitions_t;
@@ -470,7 +472,7 @@ public:
{};
/* Main interface. */
- void collect (const_tree t);
+ void collect (tree t);
/* Collect the result after walking all trees. */
tpartitions_t get_record_reaching_trees ()
@@ -491,7 +493,7 @@ private:
* In other words, the contents are reset after every
* call to collect.
*/
- std::map<const_tree, bool> ptr;
+ std::map<tree, bool> ptr;
/* The type partition set that will hold partitions for
* points to record or does not point to record.
@@ -510,10 +512,10 @@ private:
void _sanity_check ();
/* Store T into partition depending on PTR. */
- void _collect_simple (const_tree t);
+ void _collect_simple (tree t);
/* If the value is in PTRSET, no need to visit the lower nodes. */
- virtual bool is_memoized (const_tree t);
+ virtual bool is_memoized (tree t);
/* These functions insert and erase elements in PTR.
@@ -523,36 +525,36 @@ private:
* for all different type T. However, we want to avoid
* collecting FIELD_DECL, ARGS, and some other none-types.
*/
- virtual void _walk_VOID_TYPE_pre (const_tree t);
- virtual void _walk_VOID_TYPE_post (const_tree t);
- virtual void _walk_INTEGER_TYPE_pre (const_tree t);
- virtual void _walk_INTEGER_TYPE_post (const_tree t);
- virtual void _walk_REAL_TYPE_pre (const_tree t);
- virtual void _walk_REAL_TYPE_post (const_tree t);
- virtual void _walk_FIXED_POINT_TYPE_pre (const_tree t);
- virtual void _walk_FIXED_POINT_TYPE_post (const_tree t);
- virtual void _walk_COMPLEX_TYPE_pre (const_tree t);
- virtual void _walk_COMPLEX_TYPE_post (const_tree t);
- virtual void _walk_ENUMERAL_TYPE_pre (const_tree t);
- virtual void _walk_ENUMERAL_TYPE_post (const_tree t);
- virtual void _walk_BOOLEAN_TYPE_pre (const_tree t);
- virtual void _walk_BOOLEAN_TYPE_post (const_tree t);
- virtual void _walk_ARRAY_TYPE_pre (const_tree t);
- virtual void _walk_ARRAY_TYPE_post (const_tree t);
- virtual void _walk_POINTER_TYPE_pre (const_tree t);
- virtual void _walk_POINTER_TYPE_post (const_tree t);
- virtual void _walk_REFERENCE_TYPE_pre (const_tree t);
- virtual void _walk_REFERENCE_TYPE_post (const_tree t);
- virtual void _walk_UNION_TYPE_pre (const_tree t);
- virtual void _walk_UNION_TYPE_post (const_tree t);
- virtual void _walk_FUNCTION_TYPE_pre (const_tree t);
- virtual void _walk_FUNCTION_TYPE_post (const_tree t);
- virtual void _walk_METHOD_TYPE_pre (const_tree t);
- virtual void _walk_METHOD_TYPE_post (const_tree t);
+ virtual void _walk_VOID_TYPE_pre (tree t);
+ virtual void _walk_VOID_TYPE_post (tree t);
+ virtual void _walk_INTEGER_TYPE_pre (tree t);
+ virtual void _walk_INTEGER_TYPE_post (tree t);
+ virtual void _walk_REAL_TYPE_pre (tree t);
+ virtual void _walk_REAL_TYPE_post (tree t);
+ virtual void _walk_FIXED_POINT_TYPE_pre (tree t);
+ virtual void _walk_FIXED_POINT_TYPE_post (tree t);
+ virtual void _walk_COMPLEX_TYPE_pre (tree t);
+ virtual void _walk_COMPLEX_TYPE_post (tree t);
+ virtual void _walk_ENUMERAL_TYPE_pre (tree t);
+ virtual void _walk_ENUMERAL_TYPE_post (tree t);
+ virtual void _walk_BOOLEAN_TYPE_pre (tree t);
+ virtual void _walk_BOOLEAN_TYPE_post (tree t);
+ virtual void _walk_ARRAY_TYPE_pre (tree t);
+ virtual void _walk_ARRAY_TYPE_post (tree t);
+ virtual void _walk_POINTER_TYPE_pre (tree t);
+ virtual void _walk_POINTER_TYPE_post (tree t);
+ virtual void _walk_REFERENCE_TYPE_pre (tree t);
+ virtual void _walk_REFERENCE_TYPE_post (tree t);
+ virtual void _walk_UNION_TYPE_pre (tree t);
+ virtual void _walk_UNION_TYPE_post (tree t);
+ virtual void _walk_FUNCTION_TYPE_pre (tree t);
+ virtual void _walk_FUNCTION_TYPE_post (tree t);
+ virtual void _walk_METHOD_TYPE_pre (tree t);
+ virtual void _walk_METHOD_TYPE_post (tree t);
/* When a RECORD_TYPE is found, update all values in PTR to true. */
- virtual void _walk_RECORD_TYPE_pre (const_tree t);
- virtual void _walk_RECORD_TYPE_post (const_tree t);
+ virtual void _walk_RECORD_TYPE_pre (tree t);
+ virtual void _walk_RECORD_TYPE_post (tree t);
};
/* Derived class from TypeWalker. This class
@@ -568,76 +570,76 @@ public:
{};
/* Main method, returns a stringified version of T. */
- std::string stringify (const_tree t);
+ std::string stringify (tree t);
/* Only get type identifier. */
- static std::string get_type_identifier (const_tree t);
+ static std::string get_type_identifier (tree t);
/* If field is not anonymous, return field identifier. */
- static std::string get_field_identifier (const_tree t);
+ static std::string get_field_identifier (tree t);
private:
/* Working string... will hold result for stringify. */
std::string _stringification;
/* Append get_tree_code_name. */
- void _stringify_simple (const_tree t);
+ void _stringify_simple (tree t);
/* Append identifier and "{". */
- void _stringify_aggregate_pre (const_tree t);
+ void _stringify_aggregate_pre (tree t);
/* Append "}". */
- void _stringify_aggregate_post (const_tree t);
+ void _stringify_aggregate_post (tree t);
/* Append "function {". */
// TODO: For C++ we will need to change this for methods.
- void _stringify_fm_pre (const_tree t);
- virtual void _walk_METHOD_TYPE_pre (const_tree t);
- virtual void _walk_METHOD_TYPE_post (const_tree t);
- virtual void _walk_FUNCTION_TYPE_pre (const_tree t);
- virtual void _walk_FUNCTION_TYPE_post (const_tree t);
+ void _stringify_fm_pre (tree t);
+ virtual void _walk_METHOD_TYPE_pre (tree t);
+ virtual void _walk_METHOD_TYPE_post (tree t);
+ virtual void _walk_FUNCTION_TYPE_pre (tree t);
+ virtual void _walk_FUNCTION_TYPE_post (tree t);
/* Append "}". */
- void _stringify_fm_post (const_tree t);
+ void _stringify_fm_post (tree t);
/* Most of the pre-order walk can probably be replaced by
* a catch all pre-order call back.
* TODO: implement that...
*/
- virtual void _walk_VOID_TYPE_pre (const_tree t);
- virtual void _walk_INTEGER_TYPE_pre (const_tree t);
- virtual void _walk_REAL_TYPE_pre (const_tree t);
- virtual void _walk_FIXED_POINT_TYPE_pre (const_tree t);
- virtual void _walk_COMPLEX_TYPE_pre (const_tree t);
- virtual void _walk_BOOLEAN_TYPE_pre (const_tree t);
- virtual void _walk_OFFSET_TYPE_pre (const_tree t);
- virtual void _walk_return_pre (const_tree t);
- virtual void _walk_args_pre (const_tree t);
+ virtual void _walk_VOID_TYPE_pre (tree t);
+ virtual void _walk_INTEGER_TYPE_pre (tree t);
+ virtual void _walk_REAL_TYPE_pre (tree t);
+ virtual void _walk_FIXED_POINT_TYPE_pre (tree t);
+ virtual void _walk_COMPLEX_TYPE_pre (tree t);
+ virtual void _walk_BOOLEAN_TYPE_pre (tree t);
+ virtual void _walk_OFFSET_TYPE_pre (tree t);
+ virtual void _walk_return_pre (tree t);
+ virtual void _walk_args_pre (tree t);
/* Append "*". */
- virtual void _walk_POINTER_TYPE_post (const_tree t);
+ virtual void _walk_POINTER_TYPE_post (tree t);
/* Append "&". */
- virtual void _walk_REFERENCE_TYPE_post (const_tree t);
+ virtual void _walk_REFERENCE_TYPE_post (tree t);
/* Append "[]". */
- virtual void _walk_ARRAY_TYPE_post (const_tree t);
+ virtual void _walk_ARRAY_TYPE_post (tree t);
/* Append "record" */
- virtual void _walk_RECORD_TYPE_pre (const_tree t);
- virtual void _walk_RECORD_TYPE_post (const_tree t);
+ virtual void _walk_RECORD_TYPE_pre (tree t);
+ virtual void _walk_RECORD_TYPE_post (tree t);
/* Append "union" */
- virtual void _walk_UNION_TYPE_pre (const_tree t);
- virtual void _walk_UNION_TYPE_post (const_tree t);
+ virtual void _walk_UNION_TYPE_pre (tree t);
+ virtual void _walk_UNION_TYPE_post (tree t);
/* Append "," */
- virtual void _walk_field_post (const_tree t);
- virtual void _walk_return_post (const_tree t);
+ virtual void _walk_field_post (tree t);
+ virtual void _walk_return_post (tree t);
/* Append "," */
- virtual void _walk_args_post (const_tree t);
- virtual void _walk_arg_post (const_tree t);
+ virtual void _walk_args_post (tree t);
+ virtual void _walk_arg_post (tree t);
};
/* ExprCollector is an implementation of ExprWalker. It walks
@@ -660,7 +662,7 @@ public:
private:
/* Catch all callback for all nested expressions E. */
- virtual void _walk_pre (const_tree e);
+ virtual void _walk_pre (tree e);
};
/* Derived from GimpleWalker. Its purpose is to walk all gimple
@@ -689,7 +691,7 @@ public:
private:
/* Call back for global variables. */
- virtual void _walk_pre_tree (const_tree);
+ virtual void _walk_pre_tree (tree);
/* Call back for gassign. */
virtual void _walk_pre_gassign (gassign *s);
@@ -745,7 +747,7 @@ public:
}
private:
- virtual void _walk_pre_gcall (gcall *s)
+ virtual void _walk_pre_gcall (__attribute__((unused)) gcall *s)
{
this->_no_external = false;
}
@@ -805,7 +807,7 @@ struct Reason
{};
};
-typedef std::map<const_tree, Reason> typemap;
+typedef std::map<tree, Reason> typemap;
/* Type Escaper propagates information on whether a type escapes
* to all types reachable by a root type. It also propagates
@@ -836,29 +838,29 @@ public:
void print_reasons ();
// Update type T with escaping reason R.
- void update (const_tree t, Reason r);
+ void update (tree t, Reason r);
private:
// TODO: we can probably reduce the amount of functions
// by adding a catch all pre-order callback...
- virtual void _walk_POINTER_TYPE_pre (const_tree t);
- virtual void _walk_POINTER_TYPE_post (const_tree t);
- virtual void _walk_REFERENCE_TYPE_pre (const_tree t);
- virtual void _walk_ARRAY_TYPE_pre (const_tree t);
- virtual void _walk_ARRAY_TYPE_post (const_tree t);
- virtual void _walk_RECORD_TYPE_pre (const_tree t);
- virtual void _walk_RECORD_TYPE_post (const_tree t);
- virtual void _walk_field_pre (const_tree t);
- virtual bool is_memoized (const_tree t);
+ virtual void _walk_POINTER_TYPE_pre (tree t);
+ virtual void _walk_POINTER_TYPE_post (tree t);
+ virtual void _walk_REFERENCE_TYPE_pre (tree t);
+ virtual void _walk_ARRAY_TYPE_pre (tree t);
+ virtual void _walk_ARRAY_TYPE_post (tree t);
+ virtual void _walk_RECORD_TYPE_pre (tree t);
+ virtual void _walk_RECORD_TYPE_post (tree t);
+ virtual void _walk_field_pre (tree t);
+ virtual bool is_memoized (tree t);
/* Mark escaping reason as having a function pointer in a structure,
* propagate up and down. */
- virtual void _walk_METHOD_TYPE_pre (const_tree t);
- virtual void _walk_FUNCTION_TYPE_pre (const_tree t);
+ virtual void _walk_METHOD_TYPE_pre (tree t);
+ virtual void _walk_FUNCTION_TYPE_pre (tree t);
/* Mark escaping reason as having a union and propagate up and down. */
- virtual void _walk_UNION_TYPE_pre (const_tree t);
- virtual void _walk_UNION_TYPE_post (const_tree t);
+ virtual void _walk_UNION_TYPE_pre (tree t);
+ virtual void _walk_UNION_TYPE_post (tree t);
// Record how many nested unions the current context is in.
unsigned _inside_union;
@@ -871,7 +873,7 @@ private:
Reason _reason;
// Recursive inner function.
- void _update (const_tree t);
+ void _update (tree t);
// Final method that places types from calc to partitions.
void place_escaping_types_in_set ();
@@ -885,7 +887,7 @@ public:
{};
/* Main interface: T escapes because R. */
- void update (const_tree t, Reason r);
+ void update (tree t, Reason r);
/* Will be used to propagate escaping reasons to Types. */
TypeEscaper typeEscaper;
@@ -901,26 +903,26 @@ private:
// is the subexpression being examined.
// The bottom of the stack is the expression called on the update
// function.
- std::stack<const_tree> _stack;
+ std::stack<tree> _stack;
// Reason to propagate across all subexpressions.
Reason _r;
// push to stack.
- virtual void _walk_pre (const_tree e);
+ virtual void _walk_pre (tree e);
// pop to stack.
- virtual void _walk_post (const_tree e);
+ virtual void _walk_post (tree e);
// Check if there is a cast between the
// expression (MEM_REF (SSA_NAME))
// SSA_NAME is the subexpression of MEM_REF.
- virtual void _walk_SSA_NAME_pre (const_tree e);
+ virtual void _walk_SSA_NAME_pre (tree e);
// If the expression E is a constructor then we need
// to mark these types as escaping because we cannot
// deal with constructors at the moment.
- virtual void _walk_CONSTRUCTOR_pre (const_tree e);
+ virtual void _walk_CONSTRUCTOR_pre (tree e);
};
// Do a type structural equality for two types.
@@ -931,15 +933,15 @@ public:
{};
// Return TRUE if A and B have equal structures
- bool equal (const_tree a, const_tree b);
+ bool equal (tree a, tree b);
protected:
// Recursive _equal
- virtual bool _equal (const_tree a, const_tree b);
+ virtual bool _equal (tree a, tree b);
private:
// Use to limit recursion if we are revisiting a node
- typedef std::set<const_tree> tset_t;
+ typedef std::set<tree> tset_t;
// Limit recursion for LHS
tset_t set_l;
@@ -948,14 +950,14 @@ private:
tset_t set_r;
// Determine if the code is equal
- bool _equal_code (const_tree a, const_tree b);
+ bool _equal_code (tree a, tree b);
// Wrapper around POINTER_TYPE, ARRAY_TYPE and REFERENCE_TYPE
- bool _equal_wrapper (const_tree a, const_tree b);
+ bool _equal_wrapper (tree a, tree b);
// Different types we are comparing
#define TSE_FUNC_DECL(code) \
- virtual bool _walk_##code (const_tree l, const_tree r)
+ virtual bool _walk_##code (tree l, tree r)
// Current types that can be compared.
TSE_FUNC_DECL (VOID_TYPE);
@@ -986,7 +988,7 @@ public:
{};
protected:
- virtual bool _equal (const_tree l, const_tree r);
+ virtual bool _equal (tree l, tree r);
};
/* Inspect gimple code and find reasons why types might escape given a gimple
@@ -1011,7 +1013,7 @@ public:
protected:
/* Set of undefined functions, this set is filled with
* functions obtained via FOR_EACH_FUNCTION_WITH_GIMPLE_BODY. */
- typedef std::set<const_tree> undefset;
+ typedef std::set<tree> undefset;
undefset undefined;
/* Initializes undefined. */
@@ -1019,11 +1021,11 @@ protected:
/* Return true if it is a known builtin function. */
static bool filter_known_function (cgraph_node *);
- static bool filter_known_function (const_tree);
+ static bool filter_known_function (tree);
/* Return true if function is externally visible. */
static bool is_function_escaping (cgraph_node *);
- static bool is_function_escaping (const_tree);
+ static bool is_function_escaping (tree);
/* Return true if variable is externally visible. */
static bool is_variable_escaping (varpool_node *);
@@ -1049,7 +1051,7 @@ protected:
* types introduced by profiling and mark them as escaping.
* TODO: Improve this.
*/
- virtual void _walk_pre_tree (const_tree t);
+ virtual void _walk_pre_tree (tree t);
};
/*
@@ -1068,7 +1070,7 @@ private:
std::map<tree, bool> &_whitelisted;
/* Determine if cast comes from a known function. */
- static bool follow_def_to_find_if_really_cast (const_tree);
+ static bool follow_def_to_find_if_really_cast (tree);
/* If arguments are casted, mark them as escaping.
* Assignments from malloc and other known functions
@@ -1091,10 +1093,10 @@ const unsigned Read = 0x01u;
const unsigned Write = 0x02u;
// maps FIELD_DECL -> bitflag.
-typedef std::map<const_tree, unsigned> field_access_map_t;
+typedef std::map<tree, unsigned> field_access_map_t;
// maps RECORD_TYPE -> (FIELD_DECL -> bitflag).
-typedef std::map<const_tree, field_access_map_t> record_field_map_t;
+typedef std::map<tree, field_access_map_t> record_field_map_t;
// Class used to determine if a FIELD is read, written or never accessed.
class TypeAccessor : public TypeWalker
@@ -1108,14 +1110,14 @@ private:
record_field_map_t &_map;
// set of trees which are memoized and we don't need to look into them.
- std::set<const_tree> memoized_map;
+ std::set<tree> memoized_map;
// If a RECORD_TYPE is walked into, add all fields in struct to
// record_field_map.
- virtual void _walk_RECORD_TYPE_pre (const_tree t);
- void add_all_fields_in_struct (const_tree t);
+ virtual void _walk_RECORD_TYPE_pre (tree t);
+ void add_all_fields_in_struct (tree t);
- bool is_memoized (const_tree t);
+ bool is_memoized (tree t);
};
// Determine if a FIELD is read, written or never accessed from
@@ -1127,13 +1129,13 @@ public:
{};
// Expr E is accessed in A manner.
- void update (const_tree e, unsigned a);
+ void update (tree e, unsigned a);
// Print results.
void print_accesses ();
// Add all fields to map. Initialize with empty.
- void add_all_fields_in_struct (const_tree t);
+ void add_all_fields_in_struct (tree t);
// Get final results.
record_field_map_t get_map ();
@@ -1143,7 +1145,7 @@ private:
unsigned _access;
// Stack to keep track of how current subexpression was reached.
- std::stack<const_tree> _stack;
+ std::stack<tree> _stack;
// Holds main results.
record_field_map_t record_field_map;
@@ -1155,7 +1157,7 @@ private:
// If ADDR_EXPR is parent expression that means
// The address of a field is taken. Mark
// all fields as possibly read.
- virtual void _walk_COMPONENT_REF_pre (const_tree e);
+ virtual void _walk_COMPONENT_REF_pre (tree e);
// Check if parent expression is MEM_REF.
// This means that an optimization was made
@@ -1165,13 +1167,13 @@ private:
// TODO: We don't necessarily need to mark them as
// possibly read if we update these expressions to
// point to the correct address in the future.
- virtual void _walk_ADDR_EXPR_pre (const_tree e);
+ virtual void _walk_ADDR_EXPR_pre (tree e);
// Push to stack.
- virtual void _walk_pre (const_tree t);
+ virtual void _walk_pre (tree t);
// Pop from stack.
- virtual void _walk_post (const_tree t);
+ virtual void _walk_post (tree t);
};
/* Walk all gimple and determine if fields were accessed. */
@@ -1212,7 +1214,7 @@ private:
typedef std::set<unsigned> field_offsets_t;
-typedef std::map<const_tree, field_offsets_t> record_field_offset_map_t;
+typedef std::map<tree, field_offsets_t> record_field_offset_map_t;
// Partition types into escaping or non escaping sets.
tpartitions_t