summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oblock <gary@amperecomputing.com>2021-02-04 20:20:20 -0800
committerGary Oblock <gary@amperecomputing.com>2021-02-04 20:20:20 -0800
commit52668d10195df9b7c9dc839e7bea6a4cf8e0aee6 (patch)
treea82a406aaabf5eddc2a1a34ab0536b618b24472d
parent6df9dd86e3ded551fc6090ecd9edda75551c9292 (diff)
Some cleanup.
-rw-r--r--gcc/ipa-str-reorg-instance-interleave.c124
-rw-r--r--gcc/ipa-structure-reorg.c136
2 files changed, 5 insertions, 255 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c
index df4cd29ad8a..44757f0e44e 100644
--- a/gcc/ipa-str-reorg-instance-interleave.c
+++ b/gcc/ipa-str-reorg-instance-interleave.c
@@ -77,19 +77,12 @@ static void create_pointer_reps ( Info_t *);
static void create_base_vars ( Info_t *);
static void create_a_pointer_rep ( Info_t *, tree);
static void create_a_base_var ( Info_t *, tree);
-#if 0
-static void create_new_types ( Info_t *);
-static void create_a_new_type ( Info_t *, tree);
-#endif
static unsigned int reorg_perf_qual ( Info *);
static tree find_corresponding_field ( tree, tree);
static void remove_default_def ( tree, struct function *);
static void new_element_assign_transformation ( gimple *, ReorgType_t *, Info_t *);
static void pointer_assign_transformation ( gimple *, ReorgType_t *, Info_t *);
static void element_assign_modif_trans ( gimple *, tree, Info_t *);
-#if 0
-static void make_transformed_ref ( tree, ReorgType_t *, tree *, gimple_seq *, tree *, Info_t *);
-#endif
static void new_make_transformed_ref ( tree, ReorgType_t *, tree *, gimple_seq *, tree *, tree, Info_t *);
//static tree find_deepest_comp_ref ( tree);
@@ -372,37 +365,6 @@ str_reorg_instance_interleave_trans ( Info *info)
enum ReorgOpTrans right_op_trans =
recognize_op ( rhs, true, info);
- // TBD lets rethink these
- #if 0
- // Ignore meaningless case
- if ( right_op_trans == ReorgOpT_Scalar
- && left_op_trans == ReorgOpT_Scalar )
- break;
-
- // TBD Do these make sense?
- if ( ( left_op_trans != ReorgOpT_Scalar
- &&
- left_op_trans != ReorgOpT_Indirect )
- ||
- ( right_op_trans != ReorgOpT_Scalar
- &&
- right_op_trans != ReorgOpT_Indirect ))
- {
- if ( left_op_trans == ReorgOpT_AryDir ||
- right_op_trans == ReorgOpT_AryDir )
- {
- // Not implemented in single pool
- internal_error ( "ReorgOpT_AryDir not possible");
- }
- else
- {
- internal_error (
- "Reached tree operand default for "
- "ReorgT_StrAssign");
- }
- }
- #endif
-
bool ro_on_left = tree_contains_a_reorgtype_p ( lhs, info);
bool ro_on_right = tree_contains_a_reorgtype_p ( rhs, info);
@@ -1189,20 +1151,12 @@ str_reorg_instance_interleave_trans ( Info *info)
// each comment starting with "FROM."
ReorgType_t *ri = contains_a_reorgtype( stmt, info);
- #if FIX_CALLOC
tree num_arg = gimple_call_arg( stmt, 0); // Likely not needed! //
- #else
- tree size_arg = gimple_call_arg( stmt, 0); // Likely not needed! //
- #endif
// Note the num_arg is either a const or an ssa name so it
// can be used as is in the calloc for each field;
- #if FIX_CALLOC
tree size_arg = gimple_call_arg( stmt, 1);
- #else
- tree num_arg = gimple_call_arg( stmt, 1);
- #endif
tree val = gimple_call_lhs( stmt);
//DEBUG_L("val is: ");
@@ -1210,36 +1164,9 @@ str_reorg_instance_interleave_trans ( Info *info)
//DEBUG(", tree code type: %s\n", code_str(TREE_CODE(TREE_TYPE(val))));
gcc_assert( TREE_CODE( TREE_TYPE(val)) == POINTER_TYPE);
- #if 0
- tree size = TYPE_SIZE_UNIT( TREE_TYPE( TREE_TYPE( val)));
- #endif
- #if 0
- tree int_ptrsize_type = signed_type_for ( ptr_type_node);
- //DEBUG_L("int_ptrsize_type = %p\n", TREE_TYPE ( size));
- gcc_assert ( TREE_TYPE ( size));
- tree len = make_temp_ssa_name ( TREE_TYPE ( size), NULL, "malloc_len");
- #endif
-
gimple_stmt_iterator gsi = gsi_for_stmt( stmt);
- #if 0
- // Cast arg to compatible type
- gcc_assert( TREE_TYPE ( size));
- TREE_TYPE (arg) = TREE_TYPE ( size);
- tree cast_arg =
- make_temp_ssa_name( TREE_TYPE ( size), NULL, "cast_arg");
- gimple *gcast_arg = gimple_build_assign ( cast_arg, CONVERT_EXPR, arg);
- SSA_NAME_DEF_STMT ( cast_arg) = gcast_arg;
- gsi_insert_before( &gsi, gcast_arg, GSI_SAME_STMT);
-
- gimple *glen =
- gimple_build_assign ( len, TRUNC_DIV_EXPR, cast_arg, size);
- SSA_NAME_DEF_STMT ( len) = glen;
-
- gsi_insert_before( &gsi, glen, GSI_SAME_STMT);
- #endif
-
// Note in other places in this doc this would
// be "insert glen before stmt" instead of this but
// here we need to create new basic blocks.
@@ -1384,12 +1311,6 @@ str_reorg_instance_interleave_trans ( Info *info)
//DEBUG_F(print_generic_expr, stderr, lhs_ass_type, (dump_flags_t)0);
//DEBUG("\n");
- #if 0
- gcc_assert ( sizetype);
- tree mem_size =
- make_temp_ssa_name( sizetype, NULL, "malloc_mem_size");
- #endif
-
// We need field_size to be of the correct type so
// we type cast.
//tree field_size =
@@ -1408,16 +1329,6 @@ str_reorg_instance_interleave_trans ( Info *info)
TYPE_SIZE_UNIT ( TREE_TYPE ( field)));
SSA_NAME_DEF_STMT ( field_size) = gfield_size;
- #if 0
- // Move gsize here
- gimple *gsize =
- gimple_build_assign ( mem_size,
- MULT_EXPR,
- field_size,
- len);
- SSA_NAME_DEF_STMT ( mem_size) = gsize;
- #endif
-
gcc_assert ( ptr_type_node);
tree res =
make_temp_ssa_name ( ptr_type_node, NULL, "res");
@@ -1432,11 +1343,7 @@ str_reorg_instance_interleave_trans ( Info *info)
//DEBUG_F(print_generic_expr, stderr, res_type, (dump_flags_t)0);
//DEBUG("\n");
- #if FIX_CALLOC
gcall *calloc_call = gimple_build_call( fndecl_calloc, 2, num_arg, field_size);
- #else
- gcall *calloc_call = gimple_build_call( fndecl_calloc, 2, field_size, num_arg);
- #endif
gimple_call_set_lhs( calloc_call, res);
SSA_NAME_DEF_STMT ( res) = calloc_call;
@@ -2379,8 +2286,6 @@ str_reorg_instance_interleave_trans ( Info *info)
// Normal ssa name case
DEBUG_L("Dangling Types for Normal SSA Names:\n");
- #define MOD_DANG 1
-
INDENT(4);
// We use len instead of using func->length() in the for loop test
// because new ssa names are created in the loop body and we
@@ -2407,12 +2312,9 @@ str_reorg_instance_interleave_trans ( Info *info)
int levels;
tree bottom_type = base_type_with_levels ( type, &levels);
-
- #if MOD_DANG
// Find if modified here.
tree canonical_type = TYPE_MAIN_VARIANT ( bottom_type);
tree modified = find_modified ( canonical_type, false, info);
- #endif
ReorgType_t *ri = get_reorgtype_info ( bottom_type, info);
DEBUG_L("ssa_name = ");
@@ -2426,21 +2328,12 @@ str_reorg_instance_interleave_trans ( Info *info)
DEBUG_F(print_generic_expr, stderr, bottom_type, (dump_flags_t)0);
DEBUG(", ri = %p\n",ri);
- #if MOD_DANG
- // Next test shouldn't skip if modified
+ // This test shouldn't skip if modified
if ( ri == NULL && modified == NULL )
{
DEBUG_L("Skip, ri == NULL\n");
continue;
}
- #else
- // If it's not a dangling type we don't care
- if ( ri == NULL )
- {
- DEBUG_L("Skip, ri == NULL\n");
- continue;
- }
- #endif
// A default def is processed seperately
if ( a_default_def )
@@ -2449,7 +2342,6 @@ str_reorg_instance_interleave_trans ( Info *info)
continue;
}
- #if MOD_DANG
// We must not do this for modified types too!
if ( modified == NULL && levels == 0 )
@@ -2457,15 +2349,6 @@ str_reorg_instance_interleave_trans ( Info *info)
DEBUG_L("Skip not one level pointer to record\n");
continue;
}
- #else
- // TBD CHECK FOR pointer to record.
- // QUESTION aren't levels > 1 also a possibility?
- if ( levels != 1 )
- {
- DEBUG_L("Skip not one level pointer to record\n");
- continue;
- }
- #endif
gcc_assert ( !no_defining_stmt);
gcc_assert ( !defined_by_nop);
@@ -2473,7 +2356,6 @@ str_reorg_instance_interleave_trans ( Info *info)
DEBUG_L("Defining stmt: ");
DEBUG_F ( print_gimple_stmt, stderr, defining_stmt, 0);
- #if MOD_DANG
// new_type can also be the result of a modified type!
// Note, the levels
tree new_type;
@@ -2485,9 +2367,7 @@ str_reorg_instance_interleave_trans ( Info *info)
{
new_type = make_multilevel ( ri->pointer_rep, levels - 1);
}
- #else
- tree new_type = ri->pointer_rep;
- #endif
+
tree new_ssa_name = make_temp_ssa_name( new_type, NULL, "dedangled");
DEBUG_L("new_ssa_name = ");
DEBUG_F(print_generic_expr, stderr, new_ssa_name, (dump_flags_t)0);
diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c
index ebcfef722dd..dc0318098f8 100644
--- a/gcc/ipa-structure-reorg.c
+++ b/gcc/ipa-structure-reorg.c
@@ -52,16 +52,6 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "tree-ssanames.h"
-#if 0
-typedef struct type_holder TypeHolder;
-
-struct type_holder
-{
- std::vector <tree> refed_types;
- std::vector <tree> rec_types;
-};
-#endif
-
static void setup_debug_flags ( Info *);
static void initial_debug_info ( Info *);
static void final_debug_info ( Info *);
@@ -374,30 +364,6 @@ reorg_analysis ( Info *info)
// that's a simple assignment to a typed
// variable.
- #if 0
- gimple *use_stmt;
- use_operand_p immuse;
- bool yup_a_use = single_imm_use ( t, &immuse, &use_stmt);
- DEBUG_A("VOID case: %sa single imm use, ", yup_a_use ? "" : "not ");
- DEBUG("%san assign\n",
- yup_a_use && is_gimple_assign ( use_stmt) ? "" : "not ");
- if ( TREE_CODE ( t) == SSA_NAME
- && yup_a_use
- && is_gimple_assign ( use_stmt) )
- {
- tree use_lhs = gimple_assign_lhs ( use_stmt);
- bt = base_type_of ( TREE_TYPE ( use_lhs));
- //DEBUG_A("found bt: ");
- //DEBUG_F(flexible_print, stderr, bt, 1, (dump_flags_t)0);
- }
- else
- {
- //DEBUG_A("bailed on base type of complicated case\n");
- //INDENT(-2);
- continue;
- }
- #endif
-
tree ssa_name = gimple_call_lhs( stmt);
gimple *use_stmt;
imm_use_iterator iter;
@@ -593,14 +559,7 @@ find_decls_and_types ( Info *info)
tree canonical = TYPE_MAIN_VARIANT ( base_type_of ( type));
// This is here as a convenience.
- #if 1
- #if 0
- find_all_record_types( &type_mod_info, canonical, info);
- #endif
find_all_record_types( canonical, info);
- #else
- possibly_modify_pointer_types ( canonical, info);
- #endif
if ( escaping_nonescaping_sets.non_escaping.find ( type)
!=
@@ -632,9 +591,6 @@ find_decls_and_types ( Info *info)
tree decl = var->decl;
tree canonical = TYPE_MAIN_VARIANT ( base_type_of ( decl));
- #if 0
- find_all_record_types( &type_mod_info, canonical, info);
- #endif
find_all_record_types( canonical, info);
if ( escaping_nonescaping_sets.non_escaping.find ( decl)
@@ -795,10 +751,6 @@ find_decls_and_types ( Info *info)
print_progdecls ( info->reorg_dump_file, 2, info);
}
- #if 0
- find_and_create_all_modified_types ( &type_mod_info, info);
- #endif
-
return true;
}
@@ -1093,10 +1045,6 @@ find_decls_and_types ( Info *info)
#endif
// Note, these replace possibly_modify_pointer_types.
-#if 0
-static void
-find_all_record_types ( std::map <tree,TypeHolder> *types, tree type, Info_t *info){}
-#endif
static void
find_all_record_types ( tree type, Info_t *info)
{
@@ -1117,10 +1065,6 @@ find_all_record_types ( tree type, Info_t *info)
}
}
-#if 0
-static void
-find_and_create_all_modified_types ( std::map <tree,TypeHolder> *types, Info_t *info) {}
-#endif
void
find_and_create_all_modified_types ( Info_t *info)
{
@@ -1388,14 +1332,6 @@ find_and_create_all_modified_types ( Info_t *info)
//DEBUG_A("new_decl = ");
//DEBUG_F(flexible_print, stderr, new_decl, 1, (dump_flags_t)0);
- // Doesn't actually seem to be needed !?!
- #if 0
- layout_decl ( new_decl, 0);
- #endif
-
- // We might be missing a bunch of attributes (see
- // tree-nested.c:899) But we seem without without them!
-
DECL_CHAIN ( new_decl) = new_fields; // <- bug: need decl, not type
new_fields = new_decl;
}
@@ -1416,17 +1352,6 @@ find_and_create_all_modified_types ( Info_t *info)
//DEBUG_F( dump_modified_types, stderr, false, info);
// Lay it out
- #if 0
-
- #if 0
- layout_type ( modified_type);
- #else
- // from stor-layout.c:finish_builtin_struct (NOPE!)
- TYPE_STUB_DECL ( modified_type) = TYPE_NAME ( modified_type);
- layout_decl ( TYPE_NAME ( modified_type), 0);
- #endif
-
- #else
// From ubsan.c:ubsan_get_type_descriptor_type
// This doesn't break anything but it doesn't help either!
@@ -1437,19 +1362,9 @@ find_and_create_all_modified_types ( Info_t *info)
TYPE_NAME ( modified_type),
modified_type);
- //DECL_IGNORED_P (type_decl) = 1; // ???
- //DECL_ARTIFICIAL (type_decl) = 1; // ???
-
- // TYPE_NAME ( modified_type) = type_decl; // ??? What the FUCK!
-
TYPE_STUB_DECL ( modified_type) = type_decl;
- //TYPE_ARTIFICIAL ( modified_type) = 1; // ???
-
- //use_dump_record = true; // enables my debugging code added to layout_type
layout_type ( modified_type);
- //use_dump_record = false;
- #endif
//DEBUG_LA("modified_type (right after layout) = \n");
//DEBUG_F( dump_record, stderr, modified_type, true);
@@ -1549,57 +1464,12 @@ dump_modified_types (FILE *file, bool extra_details, Info_t *info)
tree orig_type = modifi->first;
tree new_type = modifi->second;
//DEBUG_A("");
- #if 1
+
dump_record (file, orig_type, extra_details);
- #else
- flexible_print ( file, orig_type, 1, (dump_flags_t)0);
- for ( field = TYPE_FIELDS ( orig_type);
- field; field = DECL_CHAIN ( field))
- {
- //DEBUG_A("");
- fprintf ( file, " ", TYPE_FIELDS ( new_type));
- flexible_print ( file, field, 1, (dump_flags_t)0);
- if ( extra_details )
- {
- tree off = DECL_FIELD_OFFSET ( field);
- if ( off )
- {
- fprintf ( file, " ");
- flexible_print ( file, off, 1, (dump_flags_t)0);
- }
- else
- {
- fprintf ( file, " (nil)\n");
- }
- }
- }
- #endif
+
//DEBUG_A("");
- #if 1
+
dump_record (file, new_type, extra_details);
- #else
- flexible_print ( file, new_type, 1, (dump_flags_t)0);
- for ( field = TYPE_FIELDS ( new_type);
- field; field = DECL_CHAIN ( field))
- {
- //DEBUG_A("");
- fprintf ( file, " ");
- flexible_print ( file, field, 1, (dump_flags_t)0);
- if ( extra_details )
- {
- tree off = DECL_FIELD_OFFSET ( field);
- if ( off )
- {
- fprintf ( file, " ");
- flexible_print ( file, off, 1, (dump_flags_t)0);
- }
- else
- {
- fprintf ( file, " (nil)\n");
- }
- }
- }
- #endif
}
}