summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-02-21 22:21:03 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-04-28 23:35:44 +0200
commitb048be821dba70958f6b97e1e7eb5ed74fcaa536 (patch)
tree9bfa14534ee9f5cdb57bda0d18de2cf81e4ab7fd /gcc
parent7173b28b3d0616a17f27469c23837e3b86ee29ed (diff)
Comments
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ipa-str-reorg-dead-field-eliminate.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/gcc/ipa-str-reorg-dead-field-eliminate.c b/gcc/ipa-str-reorg-dead-field-eliminate.c
index a93b84e9a5f..f881ac9c975 100644
--- a/gcc/ipa-str-reorg-dead-field-eliminate.c
+++ b/gcc/ipa-str-reorg-dead-field-eliminate.c
@@ -1,7 +1,7 @@
/* Interprocedural scalar replacement of aggregates
Copyright (C) 2019-2020 Free Software Foundation, Inc.
- Contributed by Erick Eduardo Ochoa Lopez <erick.ochoa@theobroma-systems.com>
+ Contributed by Erick Ochoa <erick.ochoa@theobroma-systems.com>
This file is part of GCC.
@@ -66,8 +66,7 @@ static const char *
get_type_name (const_tree type);
static const char *
get_record_name (const_tree record);
-// INFO: cannot change
-// tree expr to const_tree expr
+
static void
log_expr_prologue (const int indent, const char *debug_str, tree expr)
{
@@ -1156,10 +1155,6 @@ collect_function_body (cgraph_node *cnode, hash_set<const_tree> &decl_map)
print_function (cnode);
}
-// TODO: It would be nice to have this as an iterator
-// TODO: Maybe after the filter, there should be
-// a function that takes a type and gets you
-// an identifier string.
static void
collect_local_declarations (cgraph_node *cnode,
bool (*filter) (tree, hash_set<const_tree> &),
@@ -1168,7 +1163,6 @@ collect_local_declarations (cgraph_node *cnode,
gcc_assert (cnode);
int i = 0;
function *func = DECL_STRUCT_FUNCTION (cnode->decl);
- // TODO: What condition do I need to check for this one?
cnode->get_untransformed_body ();
tree var_decl = NULL;
FOR_EACH_LOCAL_DECL (func, i, var_decl)
@@ -1254,9 +1248,8 @@ make_new_record_based_on_old (const_tree old,
const_tree *new_record_ptr = mod_type_map->get (old);
gcc_assert (!new_record_ptr);
- // TODO: You will not have this guarantee in the end,
- // we need an API to let this method know which structs will be
- // deleted, or someting similar to that.
+ //TODO: is_interesting_struct will have to change
+ //after escape analysis
bool will_definitely_change = is_interesting_struct (old);
tree new_record = make_node (RECORD_TYPE);
@@ -1393,13 +1386,6 @@ make_new_pointer_based_on_old (const_tree old,
return new_pointer;
}
-// TODO:
-// This needs a new parameter that allows
-// us to say **how** we modify the type.
-// Not all information can be derived
-// only from the old type.
-// This is only possible now because we are
-// basically hard coding examples.
static const_tree
make_new_type_based_on_old (const_tree old,
hash_map<const_tree, const_tree> *mod_type_map)
@@ -1707,9 +1693,10 @@ rewrite_ssa_name_def (tree expr, hash_map<const_tree, const_tree> &type_map,
// If so, then the temporary variables should have SSA_NAMES
// and there is something else that I need to change
if (ssa_name_var)
+ {
substitute_type(ssa_name_var, new_type_ptr);
- if (ssa_name_var)
relayout_decl (ssa_name_var);
+ }
}
return new_type_ptr;
@@ -1997,10 +1984,8 @@ rewrite_pointer_plus_def_rhs (gimple *stmt, gimple_stmt_iterator &gsi, tree lhs,
const char *new_type_name
= new_op0_type ? get_type_name (*new_op0_type) : get_type_name (op0_type);
- // TODO: I'd prefer to have a parameter
- // that tells me what to change
+
test_log ("rewrite_pointer_plus new_type_name %s", 0, new_type_name);
- // several stack frames above.
const_tree *inverse_type_ptr = inverse.get (op0_type);
bool not_in_map_nor_inverse = !new_op0_type && !inverse_type_ptr;
test_log ("continuing? %s", 0, not_in_map_nor_inverse ? "false" : "true");
@@ -2552,8 +2537,21 @@ iphw_execute ()
hash_set<const_tree> orig_type_map;
collect_orig_structs (orig_type_map);
- // TODO: ideally mod_type_map would be a bidirectional map.
- // but we work with what we have.
+ // So what would a client will have to implement?
+ // * Pass a set of types
+ // * A function that translates old_types to new_types
+ // class TypeRewriter {
+ // // A set might not be
+ // // sufficient to say **how** the types should
+ // // be modified
+ // TypeRewriter(set, function type -> new_type);
+ // ~TypeRewriter(); // allows me to free memory used during
+ // // the pass easily
+ // rewrite(stmt); // maybe no since it can corrupt the function?
+ // rewrite(bb); // maybe no since it can corrupt the function?
+ // rewrite(func);
+ // rewrite(set(functions));
+ // }
hash_map<const_tree, const_tree> mod_type_map;
compute_modified_structs (orig_type_map, mod_type_map);
hash_map<const_tree, const_tree> inverse_type_map;