summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-01 17:08:18 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-01 17:08:18 +0100
commit6ec52af8dc05de7e60137dedc2cadf1f65dbc541 (patch)
tree4a927e9dfa40c31f6e2be6779a6c1b2def15bde7
parent856fc2c02ed285ac278fee234081d2d23fcfb9ac (diff)
change inner type
-rw-r--r--gcc/ipa-type-escape-analysis.c35
-rw-r--r--gcc/ipa-type-escape-analysis.h10
2 files changed, 28 insertions, 17 deletions
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index 17cdb075da9..847e32c5b6e 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -2797,29 +2797,35 @@ gimple_caster::_walk_pre_gcall (gcall *s)
bool
type_accessor::is_in_record_field_map(tree t)
{
- return _map2.find(t) != _map2.end();
+ return _map3.find(t) != _map3.end();
}
field_access_map_t
type_accessor::get_from_record_field_map(tree t)
{
- gcc_assert(_map2.at(t));
- return *_map2.at(t);
+ gcc_assert(_map3.at(t));
+ field_access_map_t temp;
+ field_access_map2_t *value = _map3.at(t);
+ for (auto i = value->begin(), e = value->end(); i != e; ++i)
+ {
+ temp.insert({(*i).first, (*i).second});
+ }
+ return temp;
}
void
type_accessor::put_in_record_field_map(tree t, field_access_map_t f)
{
- field_access_map_t *f2 = new field_access_map_t;
- if (_map2.find(t) != _map2.end())
+ field_access_map2_t *f2 = new field_access_map2_t;
+ if (_map3.find(t) != _map3.end())
{
- delete _map2[t];
+ delete _map3[t];
}
for (auto i = f.begin(), e = f.end(); i != e; ++i)
{
- f2->insert({i->first, i->second});
+ f2->put(i->first, i->second);
}
- _map2[t] = f2;
+ _map3[t] = f2;
}
bool
@@ -2868,13 +2874,18 @@ type_accessor::get_map ()
// here we need to translate
// record_field_map2_t to record_field_map
record_field_map_t return_value;
- for (auto i = _map2.begin(), e = _map2.end(); i != e; ++i)
+ for (auto i = _map3.begin(), e = _map3.end(); i != e; ++i)
{
- if (!(i->second)) continue;
- return_value.insert({i->first, *(i->second)});
+ if (!i->second) continue;
+ field_access_map2_t *map = i->second;
+ field_access_map_t return_map;
+ for (auto j = map->begin(), f = map->end(); j != f; ++j)
+ {
+ return_map.insert({(*j).first, (*j).second});
+ }
+ return_value.insert({i->first, return_map});
}
return return_value;
- //return _map2;
}
record_field_map_t
diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h
index 4f3a0866660..7c5e865ae44 100644
--- a/gcc/ipa-type-escape-analysis.h
+++ b/gcc/ipa-type-escape-analysis.h
@@ -1130,7 +1130,7 @@ typedef hash_map<tree, unsigned> field_access_map2_t;
// maps RECORD_TYPE -> (FIELD_DECL -> bitflag).
typedef std::map<tree, field_access_map_t> record_field_map_t;
-typedef std::map<tree, field_access_map_t*> record_field_map2_t;
+typedef std::map<tree, field_access_map2_t*> record_field_map3_t;
// Class used to determine if a FIELD is read, written or never accessed.
class type_accessor : public type_walker
@@ -1141,10 +1141,10 @@ public:
~type_accessor()
{
- for (auto i = _map2.begin(), e = _map2.end(); i != e; ++i)
+
+ for (auto i = _map3.begin(), e = _map3.end(); i != e; ++i)
{
- field_access_map_t *temp = i->second;
- delete temp;
+ delete i->second;
}
};
@@ -1156,7 +1156,7 @@ public:
private:
// maps RECORD -> (FIELD_DECL -> bitflag).
- record_field_map2_t _map2;
+ record_field_map3_t _map3;
// set of trees which are memoized and we don't need to look into them.
hash_set<tree> memoized_map2;