summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-22 09:36:35 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-22 09:36:35 +0100
commit30a3f0b7f14924d8af9c3b00c59233c72664a40d (patch)
treee14dc5b8eb02690a25a086a686dec70ab3ed14ef
parentefce0080ded3992438f6e79c7c65e47aedeca1b8 (diff)
fixes issue with gcc_rgcc_master_new7
-rw-r--r--gcc/ipa-dfe.c62
-rw-r--r--gcc/ipa-field-reorder.c4
-rw-r--r--gcc/ipa-type-escape-analysis.c14
-rw-r--r--gcc/ipa-type-escape-analysis.h2
4 files changed, 66 insertions, 16 deletions
diff --git a/gcc/ipa-dfe.c b/gcc/ipa-dfe.c
index aa8d26b8cce..f9242342cb6 100644
--- a/gcc/ipa-dfe.c
+++ b/gcc/ipa-dfe.c
@@ -1091,8 +1091,7 @@ expr_type_rewriter::handle_pointer_arithmetic_constants (gimple *s, tree p,
if (!is_valid_input)
{
- if (dump_file)
- print_gimple_expr (dump_file, s, 0);
+ //if (dump_file) print_gimple_expr (dump_file, s, 0);
log ("\n%d = %d / %d * %d\n", new_integer_cst_int, old_integer_cst_int,
old_size_int, new_size_int);
}
@@ -1106,12 +1105,65 @@ expr_type_rewriter::_walk_post (tree e)
gcc_assert (e);
tree t = TREE_TYPE (e);
const bool in_map = _map2.get(t);
+ if (dump_file && TREE_CODE(e) == ARRAY_REF)
+ {
+ print_generic_expr (dump_file, e, TDF_NONE);
+ fprintf(dump_file, "\n");
+ fprintf(dump_file, "type: %s\n", type_stringifier::get_type_identifier(t).c_str());
+ type_stringifier _ts;
+ fprintf(dump_file, "long type: %s\n", _ts.stringify(TREE_TYPE(t)).c_str());
+ }
+
+ if (TREE_CODE(e) == ARRAY_REF && dump_file)
+ {
+ tree op_0 = TREE_OPERAND (e, 0);
+ fprintf(dump_file, "op_0: \n");
+ print_generic_expr (dump_file, op_0, TDF_NONE);
+ fprintf(dump_file, "\n");
+ fprintf(dump_file, "type: %s\n", type_stringifier::get_type_identifier(TREE_TYPE(op_0)).c_str());
+ type_stringifier _ts;
+ fprintf(dump_file, "long type: %s\n", _ts.stringify(TREE_TYPE(op_0)).c_str());
+ fprintf(dump_file, "code: %s\n", get_tree_code_name( TREE_CODE(op_0)));
+ tree op_1 = TREE_OPERAND (e, 1);
+ fprintf(dump_file, "op_1: \n");
+ print_generic_expr (dump_file, op_1, TDF_NONE);
+ fprintf(dump_file, "\n");
+ fprintf(dump_file, "type: %s\n", type_stringifier::get_type_identifier(TREE_TYPE(op_1)).c_str());
+ fprintf(dump_file, "code: %s\n", get_tree_code_name( TREE_CODE(op_1)));
+
+ }
if (!in_map)
return;
+ if (dump_file) fprintf(dump_file, "in map\n");
tree r_t = *_map2.get(t);
tree _e = tree_to_tree (e);
TREE_TYPE (_e) = r_t;
+
+ if (TREE_CODE(e) == ARRAY_REF)
+ {
+ tree op_0 = TREE_OPERAND (_e, 0);
+ if (op_0) {
+ TREE_TYPE(TREE_TYPE(op_0)) = r_t;
+ }
+ }
+ if (TREE_CODE(e) == ARRAY_REF && dump_file)
+ {
+ tree op_0 = TREE_OPERAND (_e, 0);
+ fprintf(dump_file, "op_0: \n");
+ print_generic_expr (dump_file, op_0, TDF_NONE);
+ fprintf(dump_file, "\n");
+ type_stringifier _ts;
+ fprintf(dump_file, "type: %s\n", type_stringifier::get_type_identifier(TREE_TYPE(op_0)).c_str());
+ fprintf(dump_file, "long type: %s\n", _ts.stringify(TREE_TYPE(op_0)).c_str());
+ fprintf(dump_file, "code: %s\n", get_tree_code_name( TREE_CODE(op_0)));
+ tree op_1 = TREE_OPERAND (e, 1);
+ fprintf(dump_file, "op_1: \n");
+ print_generic_expr (dump_file, op_1, TDF_NONE);
+ fprintf(dump_file, "\n");
+ fprintf(dump_file, "type: %s\n", type_stringifier::get_type_identifier(TREE_TYPE(op_1)).c_str());
+ fprintf(dump_file, "code: %s\n", get_tree_code_name( TREE_CODE(op_1)));
+ }
}
/* Rewrite Field. */
@@ -1284,12 +1336,10 @@ gimple_type_rewriter::_walk_pre_gassign (gassign *s)
case POINTER_PLUS_EXPR:
case POINTER_DIFF_EXPR:
log ("am i handling pointer arithmetic?\n");
- if (dump_file)
- print_gimple_stmt (dump_file, s, 0);
+ //if (dump_file) print_gimple_stmt (dump_file, s, 0);
log ("\n");
handle_pointer_arithmetic (s);
- if (dump_file)
- print_gimple_stmt (dump_file, s, 0);
+ //if (dump_file) print_gimple_stmt (dump_file, s, 0);
log ("\n");
break;
default:
diff --git a/gcc/ipa-field-reorder.c b/gcc/ipa-field-reorder.c
index e4c2ff4a62b..08ec107f8d3 100644
--- a/gcc/ipa-field-reorder.c
+++ b/gcc/ipa-field-reorder.c
@@ -523,6 +523,7 @@ get_reordered_field_maps (record_field_offset_map4_t &record_field_offset_map2,
TypeReconstructorFieldReordering reconstructor (record_field_offset_map2,
"reorder", map2, field_map2);
+
for (hash_set<tree>::iterator i = to_modify.begin (),
e = to_modify.end ();
i != e; ++i)
@@ -584,7 +585,7 @@ lto_fr_execute ()
log ("here in field reordering \n");
// Analysis.
detected_incompatible_syntax = false;
- hash_map<tree, bool> *whitelisted2 = get_whitelisted_nodes2();
+ hash_map<tree, bool> *whitelisted2 = get_whitelisted_nodes2 ();
tpartitions2_t escaping_nonescaping_sets;
partition_types_into_escaping_nonescaping (escaping_nonescaping_sets, whitelisted2);
record_field_map4_t record_field_map;
@@ -598,6 +599,7 @@ lto_fr_execute ()
// Prepare for transformation.
hash_set<tree> to_modify;
+
get_all_types_pointing_to (record_field_offset_map,
escaping_nonescaping_sets, to_modify);
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index 181e5f08adb..13a4aada521 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -293,7 +293,6 @@ get_whitelisted_nodes2 ()
vec<cgraph_node *> worklist = vNULL;
for (hash_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.safe_push (*i);
}
@@ -310,7 +309,6 @@ get_whitelisted_nodes2 ()
if (detected_incompatible_syntax) return map;
cgraph_node *i = worklist[0];
worklist.ordered_remove (0);
- if (dump_file) fprintf (dump_file, "analyzing %s %p\n", i->name (), (void*)i);
tpartitions2_t temp;
gimple_white_lister whitelister(temp);
whitelister._walk_cnode (i);
@@ -2292,9 +2290,9 @@ expr_escaper::_walk_SSA_NAME_pre (tree e)
bool whitelisted = in_map && *_whitelisted2->get (curr_node->decl);
if (whitelisted) return;
- if (dump_file) print_generic_stmt(dump_file, e);
+ //if (dump_file) print_generic_stmt(dump_file, e);
log ("\n");
- if (dump_file) print_generic_stmt(dump_file, prev_expr);
+ //if (dump_file) print_generic_stmt(dump_file, prev_expr);
log ("\n");
_r.type_is_casted = !structuralEquality.equal (mref_type, ssa_type);
@@ -3165,7 +3163,7 @@ type_partitions2_s::in_complement (tree type)
std::string
type_stringifier::stringify (tree t)
{
- if (!dump_file)
+ if (!dump_file || !t)
return std::string ("");
_stringification.clear ();
gcc_assert (t);
@@ -3362,18 +3360,18 @@ std::string
type_stringifier::get_type_identifier (tree t)
{
if (detected_incompatible_syntax)
- return std::string ("");
+ return std::string ("incompatible syntax");
tree name = TYPE_NAME (t);
bool no_name = NULL_TREE == name;
if (no_name)
- return std::string ("");
+ return std::string ("NULL_TREE == name");
const enum tree_code name_code = TREE_CODE (name);
const bool is_name_type_decl = TYPE_DECL == name_code;
name = is_name_type_decl ? DECL_NAME (name) : name;
no_name = NULL_TREE == name;
if (no_name)
- return std::string ("");
+ return std::string ("NULL_TREE == name");
const char *identifier_ptr = IDENTIFIER_POINTER (name);
gcc_assert (identifier_ptr);
return std::string (identifier_ptr);
diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h
index d33d1c4e923..8fe8246969f 100644
--- a/gcc/ipa-type-escape-analysis.h
+++ b/gcc/ipa-type-escape-analysis.h
@@ -27,7 +27,7 @@ void log (const char *const fmt, ...) __attribute__((format(printf, 1, 0)));
inline void
log (const char *const fmt, ...)
{
- if (!dump_file)
+ //if (!dump_file)
return;
va_list args;