summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oblock <gary@amperecomputing.com>2020-06-22 21:56:55 -0700
committerGary Oblock <gary@amperecomputing.com>2020-06-22 21:56:55 -0700
commit0c77dd1ed33056e290b6628240fb6b630c6d5503 (patch)
tree1c05485a0cae23471d13064504a736dee9a21405
parent134a05537af83c3b04b36a7eebacbce6b05487db (diff)
I feel so close yet so far away... Element access almost works but is tripping an SSA sanity check on an INDIRECT_REF as if it doesn't support it.
-rw-r--r--gcc/ipa-str-reorg-instance-interleave.c149
1 files changed, 132 insertions, 17 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c
index a63597e5cca..68962e5b63d 100644
--- a/gcc/ipa-str-reorg-instance-interleave.c
+++ b/gcc/ipa-str-reorg-instance-interleave.c
@@ -194,6 +194,7 @@ str_reorg_instance_interleave_trans ( Info *info)
break;
case ReorgT_ElemAssign:
{
+ //break;
gimple_stmt_iterator gsi = gsi_for_stmt( stmt);
DEBUG_L("ReorgT_ElemAssign: ");
@@ -205,6 +206,9 @@ str_reorg_instance_interleave_trans ( Info *info)
tree rhs = gimple_assign_rhs1( stmt);
bool ro_on_left = tree_contains_a_reorgtype_p ( lhs, info);
+
+ DEBUG_L( "Reorg on %s\n", ro_on_left ? "left" : "right");
+
tree ro_side = ro_on_left ? lhs : rhs;
tree nonro_side = ro_on_left ? rhs : lhs;
@@ -213,7 +217,7 @@ str_reorg_instance_interleave_trans ( Info *info)
case ReorgOpT_Indirect:
{
DEBUG_L("%s: ", ro_on_left ? "lhs" : "rhs");
- DEBUG_F(print_generic_expr,stderr,ro_side,(dump_flags_t)-1);
+ DEBUG_F(print_generic_expr,stderr,ro_side,(dump_flags_t)0);
DEBUG("\n");
DEBUG_L("ReorgOpT_Indirect\n");
@@ -222,26 +226,43 @@ str_reorg_instance_interleave_trans ( Info *info)
tree base = ri->instance_interleave.base;
DEBUG_L("base: %p\n", base);
- DEBUG_L("base: ");
- DEBUG_F(print_generic_expr, stderr, base, (dump_flags_t)-1);
+ DEBUG_A(" base: ");
+ DEBUG_F(print_generic_expr, stderr, base, (dump_flags_t)0);
DEBUG("\n");
tree base_field =
find_coresponding_field ( base, orig_field);
DEBUG_L("base_field: %p\n", base_field);
- DEBUG_L("base_field: ");
- DEBUG_F(print_generic_expr, stderr, base_field, (dump_flags_t)-1);
+ DEBUG_A(" base_field: ");
+ DEBUG_F(print_generic_expr, stderr, base_field, (dump_flags_t)0);
DEBUG("\n");
tree base_field_type = TREE_TYPE( base_field);
+ DEBUG_L("base_field_type: %p\n", base_field_type);
+ DEBUG_A(" base_field_type: ");
+ DEBUG_F(print_generic_expr, stderr, base_field_type, (dump_flags_t)0);
+ DEBUG("\n");
+
tree field_val_temp =
make_temp_ssa_name( field_type, NULL, "field_val_temp");
+
+ DEBUG_L("field_val_temp: %p\n", field_val_temp);
+ DEBUG_A(" field_val_temp: ");
+ DEBUG_F(print_generic_expr, stderr, field_val_temp, (dump_flags_t)0);
+ DEBUG("\n");
+
+ tree field_val_temp_type = TREE_TYPE(field_val_temp); // debug only
+ DEBUG_L("field_val_temp_type: %p\n", field_val_temp_type);
+ DEBUG_A(" field_val_temp_type: ");
+ DEBUG_F(print_generic_expr, stderr, field_val_temp_type, (dump_flags_t)0);
+ DEBUG("\n");
tree inner_op = TREE_OPERAND( ro_side, 0);
+
DEBUG_L("inner_op: ");
- DEBUG_F( print_generic_expr, stderr, inner_op, (dump_flags_t)-1);
+ DEBUG_F( print_generic_expr, stderr, inner_op, (dump_flags_t)0);
DEBUG("\n");
// For either case generate common code:
@@ -249,14 +270,48 @@ str_reorg_instance_interleave_trans ( Info *info)
// field_array = _base.f
tree field_arry_addr =
make_temp_ssa_name( base_field_type, NULL, "field_arry_addr");
+
+ DEBUG_L("field_arry_addr: %p\n", field_arry_addr);
+ DEBUG_A(" field_arry_addr: ");
+ DEBUG_F(print_generic_expr, stderr, field_arry_addr, (dump_flags_t)0);
+ DEBUG("\n");
+
+ tree field_arry_addr_type = TREE_TYPE(field_arry_addr);
+ DEBUG_L("field_arry_addr_type: %p\n", field_arry_addr_type);
+ DEBUG_A(" field_arry_addr_type: ");
+ DEBUG_F(print_generic_expr, stderr, field_arry_addr_type, (dump_flags_t)0);
+ DEBUG("\n")
+
tree rhs_faa = build3 ( COMPONENT_REF,
- base_field_type,
+ // ???
+ //base_field_type,
+ ptr_type_node, // This seems bogus
base,
- base_field,
+ //base_field,
+ // This almost certainly is bogus
+ // If this "works" the the types
+ // of fields are messed up.
+ orig_field,
NULL_TREE);
+
+ DEBUG_L("rhs_faa: %p\n", rhs_faa);
+ DEBUG_A(" rhs_faa: ");
+ DEBUG_F(print_generic_expr, stderr, rhs_faa, (dump_flags_t)0);
+ DEBUG("\n");
+
+ tree rhs_faa_type = TREE_TYPE( rhs_faa);
+ DEBUG_L("rhs_faa_type: %p\n", rhs_faa_type);
+ DEBUG_A(" rhs_faa_type: ");
+ DEBUG_F(print_generic_expr, stderr, rhs_faa_type, (dump_flags_t)0);
+ DEBUG("\n");
+
gimple *get_field_arry_addr =
gimple_build_assign( field_arry_addr, rhs_faa);
+ DEBUG_L("get_field_arry_addr: ");
+ DEBUG_F( print_gimple_stmt, stderr, get_field_arry_addr, 0);
+ DEBUG("\n");
+
// index = a
tree index =
make_temp_ssa_name( ri->pointer_rep, NULL, "index");
@@ -272,8 +327,21 @@ str_reorg_instance_interleave_trans ( Info *info)
gimple *get_offset = gimple_build_assign ( offset, MULT_EXPR, index, size_of_field);
// field_addr = field_array + offset
+ // bug fix here (TBD) type must be *double not double
tree field_addr =
- make_temp_ssa_name( field_type, NULL, "field_addr");
+ make_temp_ssa_name( base_field_type, NULL, "field_addr");
+
+ DEBUG_L("field_addr: %p\n", field_addr);
+ DEBUG_A(" field_addr: ");
+ DEBUG_F(print_generic_expr, stderr, field_addr, (dump_flags_t)0);
+ DEBUG("\n");
+
+ tree field_addr_type = TREE_TYPE(field_addr); // debug only
+ DEBUG_L("field_addr_type: %p\n", field_addr_type);
+ DEBUG_A(" field_addr_type: ");
+ DEBUG_F(print_generic_expr, stderr, field_addr_type, (dump_flags_t)0);
+ DEBUG("\n");
+
gimple *get_field_addr =
gimple_build_assign ( field_addr, PLUS_EXPR, field_arry_addr, offset);
@@ -312,6 +380,18 @@ str_reorg_instance_interleave_trans ( Info *info)
// temp = *field_addr
tree rhs_ref = build1 ( INDIRECT_REF, field_type, field_addr);
+
+ DEBUG_L("rhs_ref: %p\n", rhs_ref);
+ DEBUG_A(" rhs_ref: ");
+ DEBUG_F(print_generic_expr, stderr, rhs_ref, (dump_flags_t)0);
+ DEBUG("\n");
+
+ tree rhs_ref_type = TREE_TYPE( rhs_ref); // bebug only
+ DEBUG_L("rhs_ref_type: %p\n", rhs_ref_type);
+ DEBUG_A(" rhs_ref_type: ");
+ DEBUG_F(print_generic_expr, stderr, rhs_ref_type, (dump_flags_t)0);
+ DEBUG("\n");
+
temp_set =
gimple_build_assign( field_val_temp, rhs_ref);
@@ -319,25 +399,34 @@ str_reorg_instance_interleave_trans ( Info *info)
final_set = gimple_build_assign( lhs, field_val_temp);
}
- gsi_insert_before( &gsi, get_field_arry_addr, GSI_SAME_STMT);
- gsi_insert_before( &gsi, get_index, GSI_SAME_STMT);
- gsi_insert_before( &gsi, get_offset, GSI_SAME_STMT);
- gsi_insert_before( &gsi, get_field_addr, GSI_SAME_STMT);
- gsi_insert_before( &gsi, temp_set, GSI_SAME_STMT);
- gsi_insert_before( &gsi, final_set, GSI_SAME_STMT);
-
DEBUG_L("get_field_arry_addr: ");
DEBUG_F( print_gimple_stmt, stderr, get_field_arry_addr, 0);
DEBUG("\n");
DEBUG_L("get_index: ");
DEBUG_F( print_gimple_stmt, stderr, get_index, 0);
DEBUG("\n");
+
+ DEBUG_L("get_offset: ");
+ DEBUG_F( print_gimple_stmt, stderr, get_offset, 0);
+ DEBUG("\n");
+
+ DEBUG_L("get_field_addr: ");
+ DEBUG_F( print_gimple_stmt, stderr, get_field_addr, 0);
+ DEBUG("\n");
+
DEBUG_L("temp_set: ");
DEBUG_F( print_gimple_stmt, stderr, temp_set, 0);
DEBUG("\n");
DEBUG_L("final_set: ");
DEBUG_F( print_gimple_stmt, stderr, final_set, 0);
DEBUG("\n");
+
+ gsi_insert_before( &gsi, get_field_arry_addr, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, get_index, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, get_offset, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, get_field_addr, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, temp_set, GSI_SAME_STMT); // << malformed???
+ gsi_insert_before( &gsi, final_set, GSI_SAME_STMT);
//delete stmt
@@ -587,6 +676,28 @@ str_reorg_instance_interleave_trans ( Info *info)
// FROM gsi_insert_after( &gsi, "base.field = res")
tree lhs_ass =
build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
+
+ DEBUG_L("base: %p\n", base);
+ DEBUG_A(" base: ");
+ DEBUG_F(print_generic_expr, stderr, base, (dump_flags_t)0);
+ DEBUG("\n");
+
+ DEBUG_L("field: %p\n", field);
+ DEBUG_A(" : ");
+ DEBUG_F(print_generic_expr, stderr, field, (dump_flags_t)0);
+ DEBUG("\n");
+
+ tree field_type = TREE_TYPE( field);
+ DEBUG_L("field_type: %p\n", field_type);
+ DEBUG_A(" : ");
+ DEBUG_F(print_generic_expr, stderr, field_type, (dump_flags_t)0);
+ DEBUG("\n");
+
+ DEBUG_L("lhs_ass: %p\n", lhs_ass);
+ DEBUG_A(" lhs_ass: ");
+ DEBUG_F(print_generic_expr, stderr, lhs_ass, (dump_flags_t)0);
+ DEBUG("\n");
+
gimple *gset_field = gimple_build_assign( lhs_ass, res);
gsi_insert_after( &gsi, gset_field, GSI_SAME_STMT);
@@ -1133,9 +1244,12 @@ create_a_new_type ( Info_t *info, tree type)
size_t tlen = strlen ( REORG_SP_BASE_PREFIX) + strlen ( type_name);
char *base_name = ( char*)alloca ( tlen + 1);
strcpy ( base_name, REORG_SP_BASE_PREFIX);
- DECL_NAME ( base_var) = get_identifier ( base_name);
+ //DECL_NAME ( base_var) = get_identifier ( base_name);
strcat ( base_name, type_name);
+
+ DECL_NAME ( base_var) = get_identifier ( base_name); // wrong spot above???
+
TREE_STATIC ( base_var) = 1;
TREE_ADDRESSABLE ( base_var) = 1;
DECL_NONALIASED ( base_var) = 1;
@@ -1204,6 +1318,7 @@ find_coresponding_field ( tree base_decl, tree field)
if ( strcmp ( reorg_field_name, field_name) == 0 )
{
+ gcc_assert ( TREE_TYPE( field) == TREE_TYPE( TREE_TYPE(reorg_field)));
return reorg_field;
}
}