summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-02 11:01:08 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-02 11:01:08 +0100
commit7b128993471814bab441d6e317451b37209d4a5f (patch)
tree8eb7a5555051f90483c20da06a9b704ec5c239a4
parentec26ee055fedcc1911039a01888bbeca69c31f00 (diff)
whitelisted
-rw-r--r--gcc/ipa-field-reorder.c3
-rw-r--r--gcc/ipa-type-escape-analysis.c102
-rw-r--r--gcc/ipa-type-escape-analysis.h9
3 files changed, 8 insertions, 106 deletions
diff --git a/gcc/ipa-field-reorder.c b/gcc/ipa-field-reorder.c
index 1ebfc136609..e4341ca5340 100644
--- a/gcc/ipa-field-reorder.c
+++ b/gcc/ipa-field-reorder.c
@@ -605,9 +605,8 @@ lto_fr_execute ()
// Analysis.
detected_incompatible_syntax = false;
hash_map<tree, bool> *whitelisted2 = get_whitelisted_nodes2();
- std::map<tree, bool> whitelisted = get_whitelisted_nodes();
tpartitions_t escaping_nonescaping_sets
- = partition_types_into_escaping_nonescaping (whitelisted, whitelisted2);
+ = partition_types_into_escaping_nonescaping (whitelisted2);
record_field_map_t record_field_map = find_fields_accessed ();
record_field_offset_map_t record_field_offset_map
= obtain_nonescaping_unaccessed_fields (escaping_nonescaping_sets,
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index bd8901d9156..4c7c6d980a3 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -337,101 +337,6 @@ get_whitelisted_nodes2 ()
return map;
}
-std::map<tree, bool>
-get_whitelisted_nodes ()
-{
- cgraph_node *node = NULL;
- std::set<cgraph_node *> nodes;
- std::set<cgraph_node *> leaf_nodes;
- std::set<tree> leaf_nodes_decl;
- FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
- {
- node->get_untransformed_body ();
- nodes.insert(node);
- if (node->callees) continue;
-
- leaf_nodes.insert (node);
- leaf_nodes_decl.insert (node->decl);
- }
-
- std::queue<cgraph_node *> worklist;
- for (std::set<cgraph_node*>::iterator i = leaf_nodes.begin (),
- e = leaf_nodes.end (); i != e; ++i)
- {
- if (dump_file) fprintf (dump_file, "is a leaf node %s\n", (*i)->name ());
- worklist.push (*i);
- }
-
- for (std::set<cgraph_node*>::iterator i = nodes.begin (),
- e = nodes.end (); i != e; ++i)
- {
- worklist.push (*i);
- }
-
- std::map<tree, bool> map;
- while (!worklist.empty ())
- {
-
- if (detected_incompatible_syntax) return map;
- cgraph_node *i = worklist.front ();
- worklist.pop ();
- if (dump_file) fprintf (dump_file, "analyzing %s %p\n", i->name (), (void*)i);
- gimple_white_lister whitelister;
- whitelister._walk_cnode (i);
- bool no_external = whitelister.does_not_call_external_functions (i, map);
- bool before_in_map = map.find (i->decl) != map.end ();
- bool place_callers_in_worklist = !before_in_map;
- if (!before_in_map)
- {
- map.insert(std::pair<tree, bool>(i->decl, no_external));
- } else
- {
- map[i->decl] = no_external;
- }
- bool previous_value = map[i->decl];
- place_callers_in_worklist |= previous_value != no_external;
- if (previous_value != no_external)
- {
- // This ensures we are having a total order
- // from no_external -> !no_external
- gcc_assert (!previous_value);
- gcc_assert (no_external);
- }
-
- for (cgraph_edge *e = i->callers; place_callers_in_worklist && e;
- e = e->next_caller)
- {
- worklist.push (e->caller);
- }
- }
-
- return map;
-
-}
-
-bool
-compare_stdmap_vs_hashmap(hash_map<tree, bool> *amap, std::map<tree, bool> &bmap)
-{
- for (auto i = amap->begin(), e = amap->end(); i != e; ++i)
- {
- if(bmap[(*i).first] != (*i).second)
- {
- log ("first is bad\n");
- return false;
- }
- }
-
- for (auto i = bmap.begin(), e = bmap.end(); i != e; ++i)
- {
- if ((*amap->get(i->first)) != i->second)
- {
- log ("second is bad\n");
- return false;
- }
- }
- return true;
-}
-
/*
* Perform dead field elimination at link-time.
* This transformation is composed of two main stages:
@@ -451,9 +356,8 @@ lto_dead_field_elimination ()
}
detected_incompatible_syntax = false;
hash_map<tree, bool> *whitelisted2 = get_whitelisted_nodes2 ();
- std::map<tree, bool> whitelisted;
tpartitions_t escaping_nonescaping_sets
- = partition_types_into_escaping_nonescaping (whitelisted, whitelisted2);
+ = partition_types_into_escaping_nonescaping (whitelisted2);
if (detected_incompatible_syntax) return;
record_field_map_t record_field_map = find_fields_accessed ();
if (detected_incompatible_syntax) return;
@@ -494,12 +398,12 @@ partition_types_into_record_reaching_or_non_record_reaching ()
* which types are escaping AND are being casted.
*/
tpartitions_t
-partition_types_into_escaping_nonescaping (std::map<tree, bool> &whitelisted, hash_map<tree, bool> *whitelisted2)
+partition_types_into_escaping_nonescaping (hash_map<tree, bool> *whitelisted2)
{
tpartitions_t partitions
= partition_types_into_record_reaching_or_non_record_reaching ();
if (detected_incompatible_syntax) return partitions;
- gimple_caster caster (partitions, whitelisted, whitelisted2);
+ gimple_caster caster (partitions, whitelisted2);
caster.walk ();
caster.print_reasons ();
diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h
index 92641092824..b56e4ee7c9d 100644
--- a/gcc/ipa-type-escape-analysis.h
+++ b/gcc/ipa-type-escape-analysis.h
@@ -907,7 +907,7 @@ private:
class expr_escaper : public expr_walker
{
public:
- expr_escaper (tpartitions_t &types, std::map<tree, bool> &whitelisted, hash_map<tree, bool> *whitelisted2) : _type_escaper (types), _whitelisted2(whitelisted2)
+ expr_escaper (tpartitions_t &types, hash_map<tree, bool> *whitelisted2) : _type_escaper (types), _whitelisted2(whitelisted2)
{};
/* Main interface: T escapes because R. */
@@ -1024,7 +1024,7 @@ protected:
class gimple_escaper : public gimple_walker
{
public:
- gimple_escaper (tpartitions_t &types, std::map<tree, bool> &whitelisted, hash_map<tree, bool> *whitelisted2) : _expr_escaper (types, whitelisted, whitelisted2)
+ gimple_escaper (tpartitions_t &types, hash_map<tree, bool> *whitelisted2) : _expr_escaper (types, whitelisted2)
{
_init ();
};
@@ -1090,7 +1090,7 @@ protected:
class gimple_caster : public gimple_escaper
{
public:
- gimple_caster (tpartitions_t &types, std::map<tree, bool> &whitelisted, hash_map<tree, bool> *whitelisted2) : gimple_escaper (types, whitelisted, whitelisted2), _whitelisted2(whitelisted2)
+ gimple_caster (tpartitions_t &types, hash_map<tree, bool> *whitelisted2) : gimple_escaper (types, whitelisted2), _whitelisted2(whitelisted2)
{};
private:
@@ -1261,7 +1261,7 @@ typedef hash_map<tree, field_offsets_t> record_field_offset_map2_t;
// Partition types into escaping or non escaping sets.
tpartitions_t
-partition_types_into_escaping_nonescaping (std::map<tree, bool>&, hash_map<tree, bool>*);
+partition_types_into_escaping_nonescaping (hash_map<tree, bool>*);
// Compute set of not escaping unaccessed fields
record_field_offset_map_t
@@ -1270,7 +1270,6 @@ obtain_nonescaping_unaccessed_fields (tpartitions_t casting,
int warning);
extern bool detected_incompatible_syntax;
-std::map<tree, bool> get_whitelisted_nodes();
hash_map<tree, bool> *get_whitelisted_nodes2();
#endif /* GCC_IPA_TYPE_ESCAPE_ANALYSIS_H */