diff options
author | Gary Oblock <gary@amperecomputing.com> | 2021-02-04 20:45:56 -0800 |
---|---|---|
committer | Gary Oblock <gary@amperecomputing.com> | 2021-02-04 20:45:56 -0800 |
commit | 674e2111103802aff88115922046ba8eaed2f6b7 (patch) | |
tree | 6f2b59ff133d62a40b299df0e162a98a758658fc | |
parent | 52668d10195df9b7c9dc839e7bea6a4cf8e0aee6 (diff) |
More cleanup.
-rw-r--r-- | gcc/ipa-str-reorg-instance-interleave.c | 167 | ||||
-rw-r--r-- | gcc/ipa-structure-reorg.c | 278 |
2 files changed, 16 insertions, 429 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c index 44757f0e44e..8d07da3e42f 100644 --- a/gcc/ipa-str-reorg-instance-interleave.c +++ b/gcc/ipa-str-reorg-instance-interleave.c @@ -2456,14 +2456,6 @@ str_reorg_instance_interleave_trans ( Info *info) } INDENT(-4); - // Might be a bad idea. - #if 0 - for ( auto iter = ssa_to_delete.begin ();iter != ssa_to_delete.end (); iter++ ) - { - remove_default_def ( *iter, func); - } - #endif - pop_cfun (); } @@ -2489,9 +2481,6 @@ str_reorg_instance_interleave_trans ( Info *info) return 0; } -#if 0 -#endif - static void new_element_assign_transformation ( gimple *stmt, ReorgType_t *ri, Info_t *info) { @@ -2758,33 +2747,8 @@ new_make_transformed_ref ( tree ref_in, DEBUG_F(flexible_print, stderr, ref_in, 1, (dump_flags_t)0); INDENT(2); - #if 0 - tree gcc_type = ri->gcc_type; - tree mod_gcc_type = find_modified ( gcc_type, - false, - info); - #endif - - #if 0 - tree reorg_ver_type = ri->reorg_ver_type; - - tree mod_ver_type = find_modified ( reorg_ver_type, - false, - info); - #endif - DEBUG_A("modif_type = "); DEBUG_F(flexible_print, stderr, modif_type, 1, (dump_flags_t)0); - #if 0 - DEBUG_A("gcc_type = "); - DEBUG_F(flexible_print, stderr, gcc_type, 1, (dump_flags_t)0); - DEBUG_A("mod_gcc_type = "); - DEBUG_F(flexible_print, stderr, mod_gcc_type, 1, (dump_flags_t)0); - DEBUG_A("reorg_ver_type = "); - DEBUG_F(flexible_print, stderr, reorg_ver_type, 1, (dump_flags_t)0); - DEBUG_A("mod_ver_type = "); - DEBUG_F(flexible_print, stderr, mod_ver_type, 1, (dump_flags_t)0); - #endif // For deeply nested case we need the lowest. tree lowest_comp_ref = find_deepest_comp_ref ( ref_in); @@ -2866,28 +2830,6 @@ new_make_transformed_ref ( tree ref_in, DEBUG_A("exposed_field_type = "); DEBUG_F(flexible_print, stderr, exposed_field_type, 1, (dump_flags_t)0); - #if 0 - // The this changes because it the lowest field now - tree top_field_type = TREE_TYPE ( ref_in); - - DEBUG_A("top_field_type = "); - DEBUG_F(flexible_print, stderr, top_field_type, 1, (dump_flags_t)0); - - // Maybe this should go at the bottom near new_create_deep_ref - // and use use_this_field_type insteaad of top_field_type - // Note, exposed_field_type seems to also work... let's try it. - - #if 0 - *field_val_temp = - make_temp_ssa_name( top_field_type, NULL, "field_val_temp"); - #else - // This doesn't work either but it seems closer that other versions - // and I need to determine the exact nature of the failure. - *field_val_temp = - make_temp_ssa_name( exposed_field_type, NULL, "field_val_temp"); - #endif - #endif - DEBUG_A("create_addr_expr_stmts_for_reorg = %s\n", create_addr_expr_stmts_for_reorg ? "true" : "false"); @@ -2899,14 +2841,6 @@ new_make_transformed_ref ( tree ref_in, // We are punting on this for thr grins of it for now.... I want to // see what breaks. - #if 0 - // The this changes because it the lowest field now - tree top_field_type = TREE_TYPE ( ref_in); - - *field_val_temp = - make_temp_ssa_name( top_field_type, NULL, "field_val_temp"); - #endif - // NOTE. Things get weird fast if inner_op is a decl. tree inner_op = TREE_OPERAND( lowest_comp_ref, 0); @@ -2995,10 +2929,7 @@ new_make_transformed_ref ( tree ref_in, gimple_seq_add_stmt ( pre_ref_seq, get_field_addr); } - #define ABUGFIX 1 - #if 1 tree use_this_field_type; - #if ABUGFIX DEBUG_A("tree_code(ref_in) = %s\n", code_str( TREE_CODE(ref_in))); tree topmost_field; bool its_an_array = TREE_CODE(ref_in) == ARRAY_REF; @@ -3025,7 +2956,6 @@ new_make_transformed_ref ( tree ref_in, } DEBUG_A("topmost_field = "); DEBUG_F(flexible_print, stderr, topmost_field, 1, (dump_flags_t)0); - #endif DEBUG_A("modif_type = "); @@ -3036,15 +2966,12 @@ new_make_transformed_ref ( tree ref_in, // find corresponding field tree struct_type_to_use = find_modified ( modif_type, false, info); - #if ABUGFIX + // TBD instead of orig_field use the actual topmost // field. orig_field is the bottom-most. tree field_to_use = find_corresponding_field ( struct_type_to_use, topmost_field); - #else - tree field_to_use = - find_corresponding_field ( struct_type_to_use, orig_field); - #endif + use_this_field_type = TREE_TYPE ( field_to_use); } else @@ -3052,7 +2979,6 @@ new_make_transformed_ref ( tree ref_in, gcc_assert ( ri); // This works only because it's not been modified! - #if ABUGFIX if ( its_an_array ) { use_this_field_type = array_type; @@ -3061,56 +2987,15 @@ new_make_transformed_ref ( tree ref_in, { use_this_field_type = TREE_TYPE ( topmost_field); } - #else - use_this_field_type = TREE_TYPE ( orig_field); - #endif } - #endif - - #if 0 - #if 0 - // Since this is a base field get rid of the extra pointer type - tree derefed_exposed_field_type = TREE_TYPE( exposed_field_type); - DEBUG_A("derefed_exposed_field_type = "); - DEBUG_F(flexible_print, stderr, derefed_exposed_field_type, 1, (dump_flags_t)0); - - // Of course if the field is a reorg pointer type then there is - // no extra pointer type level! - // Note, I don't this is sufficient to gaurantee that use_this... - // is set correctly based on it being a reorg type or not. - tree use_this_field_type = - derefed_base_field_type != NULL ? derefed_base_field_type : exposed_field_type; - #else - tree use_this_field_type = exposed_field_type; - tree base_of_exposed = base_type_of ( exposed_field_type); - DEBUG_A("base_of_exposed = "); - DEBUG_F(flexible_print, stderr, base_of_exposed, 1, (dump_flags_t)0); - - if ( is_reorg_pointer_type ( base_of_exposed, info) ) - { - DEBUG_A("was a reorg ptr type\n"); - tree derefed_exposed_field_type = TREE_TYPE( exposed_field_type); - DEBUG_A("derefed_exposed_field_type = "); - DEBUG_F(flexible_print, stderr, derefed_exposed_field_type, 1, (dump_flags_t)0); - - if ( derefed_exposed_field_type != NULL ) - { - use_this_field_type = derefed_exposed_field_type; - } - } - #endif - #endif DEBUG_A("use_this_field_type = "); DEBUG_F(flexible_print, stderr, use_this_field_type, 1, (dump_flags_t)0); - // Wait to enable this... try it now - #if 1 *field_val_temp = make_temp_ssa_name( use_this_field_type, NULL, "field_val_temp"); DEBUG_A("created field_val_temp = "); DEBUG_F(flexible_print, stderr, *field_val_temp, 1, (dump_flags_t)0); - #endif *ref_out = new_create_deep_ref ( ref_in, use_this_field_type, field_addr, info); @@ -3292,8 +3177,7 @@ create_deep_ref_aux ( tree ref_in, // This case doesn'ty seem to happen DEBUG_A("field_addr != NULL\n"); tree type_to_use; - #define FIX_FIELD_TYPE 1 - #if FIX_FIELD_TYPE + // TBD type modifications are needed here // (including reorg stuff!) tree inner_op1_type = TREE_TYPE ( inner_op1); @@ -3301,9 +3185,6 @@ create_deep_ref_aux ( tree ref_in, DEBUG_A("type_to_use = "); DEBUG_F(flexible_print, stderr, type_to_use, 1, (dump_flags_t)0); - #else - type_to_use = field_type; - #endif tree deepest = build2 ( MEM_REF, type_to_use, field_addr, build_int_cst (ptr_type_node, 0)); @@ -3859,20 +3740,11 @@ static void str_reorg_instance_interleave_type_part ( Info *info) { DEBUG_A("str_reorg_instance_interleave_type_part:>\n"); - #if 0 - create_new_types ( info); - #endif - #if 1 create_pointer_reps ( info); // TBD - #endif find_and_create_all_modified_types ( info); // Modify - #if 0 - create_pointer_reps ( info); // TBD - #endif - create_base_vars ( info); // TBD } @@ -3955,7 +3827,7 @@ reorg_perf_qual ( Info *info) (*(info->reorg_type))[i].do_instance_interleave = true; } #endif - #if 1 + // We are doing a quick and dirty version of performance // qualification for testing purposes and possibly the // initial version of for the main branch. @@ -3994,13 +3866,11 @@ reorg_perf_qual ( Info *info) // However, the dominace calculations other things need it. push_cfun ( func); - #if 1 if ( dom_info_available_p ( CDI_DOMINATORS) ) { free_dominance_info ( CDI_DOMINATORS); } calculate_dominance_info (CDI_DOMINATORS); - #endif if ( info->show_perf_qualify ) { @@ -4616,8 +4486,6 @@ reorg_perf_qual ( Info *info) #if !USE_DO_INSTANCE_INTERLEAVE remove_deleted_types ( info, "performance qualification", reorg_perf_qual_debug); #endif - - #endif } static void @@ -5173,33 +5041,6 @@ create_base_vars ( Info_t *info) } } -#if 0 -// create_new_types has to crawl "all" the -// types, create new types and transform -// other types that must be changed. -// A type will change when it's a -// a pointer to a ReorgType or it contains -// an interior pointer to one. -static void -create_new_types ( Info_t *info) -{ - DEBUG_LA ("create_new_types:>\n"); - std::map < tree, BoolPair_t>::iterator tmi; - for( tmi = info->struct_types->begin (); - tmi != info->struct_types->end (); - tmi++ ) { - if ( !tmi->second.processed ) - { - create_a_new_type ( info, tmi->first); - } - else - { - DEBUG_A("processed\n"); - } - } -} -#endif - static void create_a_pointer_rep ( Info_t *info, tree type) { diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c index dc0318098f8..f007036b097 100644 --- a/gcc/ipa-structure-reorg.c +++ b/gcc/ipa-structure-reorg.c @@ -1473,171 +1473,6 @@ dump_modified_types (FILE *file, bool extra_details, Info_t *info) } } -#if 0 -// A type needs to be in modified_types iff one or more fields is a -// reorg pointer or a modified record and should involve creating the -// modified types. The process is recursive and natural in that -// attempting to classify the type results in the creation of the -// modified types and also create and note any interior types that -// must be modified. This returns true if modified. -static bool -possibly_modify_pointer_types ( tree type, Info_t *info) -{ - bool modified = false; - - if ( TREE_CODE( type) != RECORD_TYPE ) - return false; - - //DEBUG_L("possibly_modify_pointer_types:> "); - //DEBUG_F(flexible_print, stderr, type, 1, (dump_flags_t)0); - //INDENT(4); - - if ( TYPE_SIZE ( type) == NULL || TYPE_FIELDS ( type) == NULL) - { - //DEBUG_A("Incomplete type\n"); - INDENT(-4); - return false; - } - - // NOPE - if ( info->modified_types->find ( type) != info->modified_types->end () ) - { - //DEBUG_A("Already modified\n"); - //INDENT(-4); - return true; - } - if ( info->dont_modify->find ( type) != info->dont_modify->end () ) - { - //DEBUG_A("Marked to not modify\n"); - //INDENT(-4); - return false; - } - for ( tree field = TYPE_FIELDS ( type); - field; - field = DECL_CHAIN ( field) ) - { - tree field_type = TREE_TYPE ( field); - tree canonical_field_type = TYPE_MAIN_VARIANT ( base_type_of (field_type)); - bool pointer = POINTER_TYPE_P ( field_type); - bool record = TREE_CODE( canonical_field_type) == RECORD_TYPE; - //DEBUG_A("Field: "); - //DEBUG_F(flexible_print, stderr, field, 1, (dump_flags_t)0); - //DEBUG_A(" pointer %s, record %s\n", pointer ? "T" : "F", record ? "T" :"F"); - if ( pointer && record ) - { - bool is_reorg = is_reorg_type ( canonical_field_type, info); - if ( is_reorg ) - { - modified = true; - } - else - if ( possibly_modify_pointer_types ( canonical_field_type, info) ) - { - modified = true; - } - } - else - { - // ??? non record types? - if ( possibly_modify_pointer_types ( canonical_field_type, info) ) - { - modified = true; - } - } - } - - if ( modified ) - { - // Create new record type - tree modified_type = lang_hooks.types.make_type (RECORD_TYPE); - //(*(info->modified_types))[ type] = modified_type; - two_trees_t entry = { type, modified_type}; - info->modified_types->push_back ( entry); - - const char *old_type_name = - identifier_to_locale ( IDENTIFIER_POINTER ( TYPE_NAME ( type))); - size_t len = strlen ( "_modif_") + strlen ( old_type_name); - char *rec_name = ( char*)alloca ( len + 1); - strcpy ( rec_name, "_modif_"); - strcat ( rec_name, old_type_name); - - // Build the new pointer type fields - TYPE_NAME ( modified_type) = get_identifier ( rec_name); - - // TBD Create its fields by walking the old type. - tree field; - tree new_fields = NULL; - for ( field = TYPE_FIELDS ( type); field; field = DECL_CHAIN ( field)) - { - tree field_type = TREE_TYPE ( field); - tree new_fld_type; - - // TBD Do I need a canonical type here instead? - //auto is_modified = info->modified_types->find ( type); - auto is_modified = find_in_vec_of_two_types ( info->modified_types, type); - if ( is_modified != info->modified_types->end () ) - { - if ( POINTER_TYPE_P ( field_type)) - { - ReorgType_t *ri = get_reorgtype_info ( field_type, info); - int levels = number_of_levels ( field_type); - if ( ri == NULL ) - { - new_fld_type = make_multilevel ( is_modified->second, levels); - } - else - { - new_fld_type = make_multilevel ( ri->pointer_rep, levels - 1); - } - } - else - { - new_fld_type = is_modified->second; - } - } - else - { - // This field doesn't need to be modified. - new_fld_type = field_type; - } - tree new_decl = - build_decl ( DECL_SOURCE_LOCATION (field), - FIELD_DECL, DECL_NAME (field), new_fld_type); - DECL_CONTEXT ( new_decl) = modified_type; - layout_decl ( new_decl, 0); - - // 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; - } - - // Reverse fields. Note, a some point try nreverse here instead. - TYPE_FIELDS ( modified_type) = NULL; - tree next_fld; - for ( field = new_fields; - field; - field = next_fld ) - { - next_fld = DECL_CHAIN ( field); - DECL_CHAIN ( field) = TYPE_FIELDS ( modified_type); - TYPE_FIELDS ( modified_type) = field; - } - - // Lay it out - layout_type ( modified_type); - } - else - { - info->dont_modify->insert ( type); - } - //DEBUG_A("Was %smodidied\n", modified ? "" : "not "); - //INDENT(-4); - return modified; -} -#endif - tree find_modified ( tree type, bool reverse, @@ -2111,10 +1946,8 @@ static void reorg_common_middle_code ( Info *info) { if ( BYPASS_TRANSFORM ) return; - #if 0 - modify_declarations( info); - #endif - ; + + // Useed to modify_declarations here } static void @@ -2123,21 +1956,6 @@ modify_declarations ( Info *info) modify_global_declarations (info); } -// Not parctical! -#if 0 -void -modify_local_declarations ( Info *info) -{ - ; -} - -void -modify_parameter_declarations ( Info *info) -{ - ; -} -#endif - void modify_global_declarations ( Info *info) { @@ -2153,14 +1971,7 @@ modify_global_declarations ( Info *info) // lend themselves to any necessary reorg transformation. // Note, it's possible to preserve them, if that makes sense, // in remove_unreferenced_decls. - #if 0 - std::vector<ProgDecl_t>::iterator pv; - for ( pv = info->prog_decl->begin (); - pv != info->prog_decl->end (); pv++ ) - { - modify_decl_core ( &( pv->gcc_decl), info); - } - #else + // The prog_decls are obsolete varpool_node *var; FOR_EACH_VARIABLE ( var) @@ -2176,7 +1987,6 @@ modify_global_declarations ( Info *info) modify_decl_core ( &decl, info); } } - #endif // NOTE, Call modufy_decl_core breaks hello world! @@ -2201,10 +2011,6 @@ modify_global_declarations ( Info *info) push_cfun ( func); // Is this necessary? tree curr_func_type = TREE_TYPE ( func->decl); - #if 0 - modify_func_decl_core ( func, info); - #else - // TBD Check cached function type. If the decl's type // has been modified use the cached new type. auto location = fncache.find ( curr_func_type); @@ -2238,7 +2044,7 @@ modify_global_declarations ( Info *info) // Add the type to the cache. fncache [ curr_func_type] = new_func_type; } - #endif + pop_cfun (); } @@ -2304,10 +2110,7 @@ modify_func_type ( struct function *func, Info *info ) if ( ri != NULL ) { int levels = number_of_levels ( func_ret_type ); - // TBD debug why top approach fails... - #if 0 - func_ret_type = make_multilevel ( ri->pointer_rep, levels); - #else + if ( levels == 1 ) { func_ret_type = TYPE_MAIN_VARIANT ( ri->pointer_rep); @@ -2316,7 +2119,6 @@ modify_func_type ( struct function *func, Info *info ) { func_ret_type = make_multilevel ( ri->pointer_rep, levels); } - #endif } tree interim_args = void_list_node; @@ -2348,9 +2150,7 @@ modify_func_type ( struct function *func, Info *info ) if ( ri != NULL ) { int levels = number_of_levels ( type_of_arg ); - #if 0 - new_arg_type = make_multilevel ( ri->pointer_rep, levels); - #else + if ( number_of_levels ( type_of_arg ) == 1 ) { new_arg_type = TYPE_MAIN_VARIANT ( ri->pointer_rep); @@ -2359,7 +2159,6 @@ modify_func_type ( struct function *func, Info *info ) { new_arg_type = make_multilevel ( ri->pointer_rep, levels); } - #endif } else { @@ -2544,10 +2343,6 @@ modify_func_decl_core ( struct function *func, Info *info) int levels = number_of_levels ( func_type); - #if 0 - TREE_TYPE ( TREE_TYPE ( func->decl)) = - make_multilevel ( ri->pointer_rep, levels); - #else if ( levels == 1 ) { //DEBUG_A( "levels == 1\n"); @@ -2564,7 +2359,6 @@ modify_func_decl_core ( struct function *func, Info *info) TREE_TYPE ( TREE_TYPE ( func->decl)) = make_multilevel ( ri->pointer_rep, levels); } - #endif //DEBUG_L("AFTER modify_func_decl_core:\n"); //DEBUG_A("func->decl = %p, ", func->decl); @@ -2814,13 +2608,10 @@ reorg_recognize ( gimple *stmt, cgraph_node* node, Info_t *info ) return REORG_RECOG_RET_ACT ( ReorgT_Ptr2Zero); } // If we get here this is clearly really odd code - // so we need to bail out. - #if 1 + // so we need to bail out... Nope! + // If seems that this code occurrs in "nature"... sigh... return REORG_RECOG_RET_ACT ( ReorgT_Ignore); - #else - return REORG_RECOG_RET_ACT ( Not_Supported); - #endif } case ReorgOpT_Temp: // t return REORG_RECOG_RET_ACT ( ReorgT_ElemAssign); @@ -3213,25 +3004,6 @@ recognize_op ( tree op, bool lie, Info *info) DEBUG_A ( "type: "); DEBUG_F ( flexible_print, stderr, type, 1, (dump_flags_t)0); - // This type bases approach seems like crap. - // I'm turning it off to see what breaks. - #if 0 - if ( type != NULL && POINTER_TYPE_P (type) ) - { - DEBUG_L("POINTER_TYPE_P (type) = true\n"); - bool a_reorg = is_reorg_type ( type, info); - if ( a_reorg || !lie ) - { - return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Pointer); - } else { - // This would be for when - // the field of a struct element - // is a pointer that's not a reorg - // point. I.e. ReorgT_ElemAssign. - return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Scalar); - } - } - #endif // From the ifdefed off code above it's probably // reasonable to retain the check for a reorg type bool a_reorg = is_reorg_type ( type, info); @@ -3334,18 +3106,13 @@ recognize_op ( tree op, bool lie, Info *info) bool a_deep_reorg = is_reorg_type ( base_type, info); // TBD Test for modified too! - #if 1 + bool modified = find_modified ( base_type, false, info); if ( a_deep_reorg || modified || !lie ) { return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Indirect); } - #else - if ( a_deep_reorg || !lie ) - { - return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Indirect); - } - #endif + // Just normal field reference otherwise... return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Scalar); } @@ -3479,7 +3246,7 @@ recognize_op ( tree op, bool lie, Info *info) DEBUG_F ( flexible_print, stderr, inner_op0, 1, TDF_DETAILS); DEBUG_A ( "inner_op0_type = "); DEBUG_F ( flexible_print, stderr, inner_op0_type, 1, TDF_DETAILS); - #if 1 + tree base_type = base_type_of ( type); DEBUG_A ( "base_type = "); DEBUG_F ( flexible_print, stderr, base_type, 1, TDF_DETAILS); @@ -3488,12 +3255,9 @@ recognize_op ( tree op, bool lie, Info *info) { DEBUG_LA ( "DELTA 1!\n"); } - #else - bool a_reorg = is_reorg_type ( type, info); - #endif + if( a_reorg || !lie ) { - #if 1 if ( POINTER_TYPE_P ( type) ) { DEBUG_LA ( "DELTA 2!\n"); @@ -3503,9 +3267,6 @@ recognize_op ( tree op, bool lie, Info *info) { return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Struct); } - #else - return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Struct); - #endif } return RECOGNIZE_OP_RET_ACTION ( ReorgOpT_Scalar); } @@ -3842,22 +3603,7 @@ contains_a_reorgtype ( gimple *stmt, Info *info) } else { - #if 0 - // Note walk_stmt_info is compilcated, use it's info - // field for hidden_info - hidden_info_t hi = { NULL, info }; - struct walk_stmt_info walk_info; // expt - memset ( &walk_info, 0, sizeof ( walk_info)); - walk_info.info = ( void*)&hi; //expt - walk_gimple_op ( stmt, - detect_reorg, - &walk_info); - //INDENT(-2); - return hi.found_reorg; - #else return the_reorg_walker ( stmt, info); - #endif - } } |