summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-06-22 16:50:31 +0200
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-06-26 12:42:32 +0200
commite7c4996adabe26463cff56d66f5fe3ccabdcb64a (patch)
tree6c88c6a1a6327195f85a2e45306280b8a62f7918
parenteedbb7e4235b4ea143402760a508d6f14b17cc8e (diff)
I think I need to reorganize which types are sent to the reconstructor
-rw-r--r--gcc/ipa-type-escape-analysis.c12
-rw-r--r--gcc/type-reconstructor.c14
2 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index 11cc7132ade..fbb85fa746b 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -278,11 +278,20 @@ collect_types()
TypeReconstructor reconstructor(record_field_offset_map);
TypeStringifier stringifier;
+
for (auto i = types.points_to_record.cbegin(), e = types.points_to_record.cend(); i != e; ++i)
{
const_tree record = *i;
std::string name_from = stringifier.stringify(record);
log("%s\n", name_from.c_str());
+ bool points_to_record = false;
+ const_tree tt = record;
+ while (TREE_TYPE(tt)) { tt = TREE_TYPE(tt); };
+ points_to_record = TREE_CODE(tt) == RECORD_TYPE;
+ if (!points_to_record) continue;
+
+ bool in_map = record_field_offset_map.find(tt) != record_field_offset_map.end();
+ if (!in_map) continue;
reconstructor.walk(record);
}
@@ -299,6 +308,9 @@ collect_types()
std::string name_mv = to ? stringifier.stringify(mv) : std::string("NULL");
log("%s -> %s\n", name_from.c_str(), name_to.c_str());
log("TYPE_MAIN_VARIANT(%s) = %s\n", name_to.c_str(), name_mv.c_str());
+ tree type_size_unit_tree = TYPE_SIZE_UNIT(to);
+ int type_size_unit_int = tree_fits_uhwi_p(type_size_unit_tree) ? tree_to_uhwi(type_size_unit_tree) : -1;
+ log("TYPE_SIZE_UNIT(%s) = %d\n", name_to.c_str(), type_size_unit_int);
}
GimpleTypeRewriter rewriter(map, field_map);
diff --git a/gcc/type-reconstructor.c b/gcc/type-reconstructor.c
index bcde1890638..f39dec94484 100644
--- a/gcc/type-reconstructor.c
+++ b/gcc/type-reconstructor.c
@@ -76,7 +76,17 @@ TypeReconstructor::get_is_modified(const_tree t)
gcc_assert(in_map);
bool retval = modified_map[t];
modified_map.erase(t);
- return retval;
+
+ bool points_to_record = false;
+ tree tt = (tree)t;
+ while (TREE_TYPE(tt))
+ {
+ tt = TREE_TYPE(tt);
+ }
+ points_to_record = TREE_CODE(tt) == RECORD_TYPE;
+
+
+ return retval && points_to_record;
}
bool
@@ -162,7 +172,7 @@ TypeReconstructor::_walk_ARRAY_TYPE_post(const_tree t)
}
TypeStringifier stringifier;
//std::string name = stringifier.stringify(copy);
- log("are we going to crash is modified %s %s\n", is_modified ? "t" : "f", TypeStringifier::get_type_identifier(t));
+ log("are we going to crash is modified %s %s\n", is_modified ? "t" : "f", TypeStringifier::get_type_identifier(copy).c_str());
if (is_modified) layout_type(copy);
_reorg_map[t] = is_modified ? copy : (tree)t;