summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-11-30 14:52:10 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-11-30 14:52:10 +0100
commit1fe2bb196582d096e8b822cf469aabc9476aec66 (patch)
treed9b147ea312dfa8a67ae538279d6af2990af5cce
parent93224ca74e929d3163fa1f6d468f2dbdab523e8e (diff)
STL to GCC
-rw-r--r--gcc/ipa-dfe.c36
-rw-r--r--gcc/ipa-dfe.h8
2 files changed, 36 insertions, 8 deletions
diff --git a/gcc/ipa-dfe.c b/gcc/ipa-dfe.c
index 7ab718c3628..bfbcce01940 100644
--- a/gcc/ipa-dfe.c
+++ b/gcc/ipa-dfe.c
@@ -137,6 +137,8 @@ get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
std::set<tree> specific_types;
type_stringifier stringifier;
+ hash_set<tree> specific_types2;
+ hash_map<tree, field_offsets_t> record_field_offset_map2;
// Here we are just placing the types of interest in a set.
for (std::map<tree, field_offsets_t>::const_iterator i
@@ -144,12 +146,21 @@ get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
e = record_field_offset_map.end ();
i != e; ++i)
{
- tree record = i->first;
- std::string name = stringifier.stringify (record);
+ record_field_offset_map2.put (i->first, i->second);
+ }
+
+ // Here we are just placing the types of interest in a set.
+ for (hash_map<tree, field_offsets_t>::iterator i
+ = record_field_offset_map2.begin (),
+ e = record_field_offset_map2.end ();
+ i != e; ++i)
+ {
+ tree record = (*i).first;
specific_types.insert (record);
+ specific_types2.add (record);
}
- specific_type_collector specifier (specific_types);
+ specific_type_collector specifier (specific_types, &specific_types2);
// SpecificTypeCollector will collect all types which point to the types in
// the set.
@@ -162,8 +173,13 @@ get_all_types_pointing_to (record_field_offset_map_t record_field_offset_map,
}
// These are all the types which need modifications.
- std::set<tree> to_modify = specifier.get_set ();
- return to_modify;
+ hash_set<tree> to_modify = specifier.get_set2 ();
+ std::set<tree> to_modify2;
+ for (hash_set<tree>::iterator i = to_modify.begin(), e = to_modify.end(); i != e; ++i)
+ {
+ to_modify2.insert (*i);
+ }
+ return to_modify2;
}
/* record_field_offset_map holds information on which FIELD_DECLs might be
@@ -261,6 +277,12 @@ specific_type_collector::get_set ()
return to_return;
}
+hash_set<tree>
+specific_type_collector::get_set2 ()
+{
+ return to_return2;
+}
+
void
specific_type_collector::_walk_POINTER_TYPE_pre (tree t)
{
@@ -304,7 +326,7 @@ void
specific_type_collector::_walk_RECORD_TYPE_pre (tree t)
{
const bool in_set
- = _collect_these_types.find (t) != _collect_these_types.end ();
+ = _collect_these_types2->contains (t);
const bool must_collect = in_set;
path.insert (t);
if (!must_collect)
@@ -315,7 +337,7 @@ specific_type_collector::_walk_RECORD_TYPE_pre (tree t)
i != e; ++i)
{
tree type = *i;
- to_return.insert (type);
+ to_return2.add (type);
}
}
diff --git a/gcc/ipa-dfe.h b/gcc/ipa-dfe.h
index 45a68f9039a..4fca29254b0 100644
--- a/gcc/ipa-dfe.h
+++ b/gcc/ipa-dfe.h
@@ -29,19 +29,25 @@ class specific_type_collector : public type_walker
{
public:
/* C is the set of types that are to be looked for. */
- specific_type_collector (std::set<tree> &c) : _collect_these_types (c)
+ specific_type_collector (std::set<tree> &c, hash_set<tree> *c2) : _collect_these_types (c), _collect_these_types2 (c2)
{};
/* Get final result of all types which point to types in C. */
std::set<tree> get_set ();
+ hash_set<tree> get_set2 ();
+
private:
/* _collect_these_types holds the input. */
const std::set<tree> &_collect_these_types;
+ hash_set<tree> *_collect_these_types2;
+
/* Working set that holds final result. */
std::set<tree> to_return;
+ hash_set<tree> to_return2;
+
/* Sets which reach current subtype. */
std::set<tree> path;