diff options
author | Gary Oblock <gary@amperecomputing.com> | 2020-09-18 00:13:16 -0700 |
---|---|---|
committer | Gary Oblock <gary@amperecomputing.com> | 2020-09-18 00:13:16 -0700 |
commit | 24ccc02f2498bbe0d4ecb2ec8c5ff7f71277bf7a (patch) | |
tree | 686c5b865fa1e8bd6e9fea67ca861457e3111a04 | |
parent | fac145f1ccdc690b710e6458f877f518a3dabd62 (diff) |
Debug code for 2nd malloc insanity with the basic blocks.
-rw-r--r-- | gcc/ipa-str-reorg-instance-interleave.c | 67 | ||||
-rw-r--r-- | gcc/ipa-structure-reorg.h | 2 |
2 files changed, 59 insertions, 10 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c index f5cb57c1381..3a64f26afd8 100644 --- a/gcc/ipa-str-reorg-instance-interleave.c +++ b/gcc/ipa-str-reorg-instance-interleave.c @@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see #include <set> #include "ipa-structure-reorg.h" #include "dumpfile.h" +#include "tree-cfg.h" #include "tree-pretty-print.h" #include "gimple-pretty-print.h" #include "langhooks.h" @@ -633,6 +634,10 @@ str_reorg_instance_interleave_trans ( Info *info) case ReorgT_Malloc: { DEBUG_L("Transform ReorgT_Malloc\n"); + + DEBUG_L("BEFORE MALLOC ===========================================\n"); + DEBUG_F( dump_function_to_file, func->decl, stderr, (dump_flags_t)0); + INDENT(2); // We need to use the user malloc function @@ -713,6 +718,12 @@ str_reorg_instance_interleave_trans ( Info *info) basic_block after_bb = new_edge->dest; remove_edge ( new_edge); basic_block prev_bb = before_bb; + + DEBUG_L("Before <bb %d>:\n", before_bb->index); + INDENT(4); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, gcast_arg, 0); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, glen, 0); + INDENT(-4); // FROM failure_bb = create_empty_block(prev_bb) basic_block failure_bb = create_empty_bb ( prev_bb); @@ -765,6 +776,8 @@ str_reorg_instance_interleave_trans ( Info *info) // This, after the following loop, will hold the start of the // field related code. + DEBUG_L("Field Allocation Blocks Follow:\n"); + INDENT(4); tree new_ok_field_L; // FROM (for fields) { @@ -799,7 +812,6 @@ str_reorg_instance_interleave_trans ( Info *info) //DEBUG("\n"); gimple_stmt_iterator gsi = gsi_start_bb ( new_bb); - // Note, switching the order of edge creation and // setting dominator seems to make no difference // set edge probability and flags @@ -828,6 +840,10 @@ str_reorg_instance_interleave_trans ( Info *info) base, base_field, NULL_TREE); + DEBUG_A("Field "); + DEBUG_F(flexible_print, stderr, base_field, 0, (dump_flags_t)0); + DEBUG_A(", <bb %d>\n"); + //DEBUG_L("base: %p\n", base); //DEBUG_A(" base: "); //DEBUG_F(print_generic_expr, stderr, base, (dump_flags_t)0); @@ -929,10 +945,20 @@ str_reorg_instance_interleave_trans ( Info *info) gsi_insert_after ( &gsi, gcast_res, GSI_CONTINUE_LINKING); gsi_insert_after ( &gsi, gset_field, GSI_CONTINUE_LINKING); gsi_insert_after ( &gsi, gcond, GSI_CONTINUE_LINKING); + + INDENT(4); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, gfield_size, 0); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, gsize, 0); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, malloc_call, 0); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, gcast_res, 0); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, gset_field, 0); + DEBUG_A("");DEBUG_F( print_gimple_stmt, stderr, gcond, 0); + INDENT(-4); prev_bb = new_bb; prev_order = new_bb; } + INDENT(-4); // Loop cleaup fo failure code bb here. There is loop state // overhead having nothing to do with the transformation @@ -957,7 +983,8 @@ str_reorg_instance_interleave_trans ( Info *info) succ_to_after_e->count () = prev_bb->count; add_bb_to_loop ( success_bb, before_bb->loop_father); - // code in success_bb + // Code In success_bb + DEBUG_L("Success Code Here <bb %d>:\n", success_bb->index); // gcc_assert ( reorg_pointer_type); tree success_val = @@ -971,12 +998,14 @@ str_reorg_instance_interleave_trans ( Info *info) SSA_NAME_DEF_STMT ( success_val) = set_succ; gsi_insert_after( &gsi, set_succ, GSI_NEW_STMT); + DEBUG_F( print_gimple_stmt, stderr, set_succ, 0); // FROM gsi_insert_after( &gsi, new_ok_field ) //gimple *gnew_ok_field = gimple_build_label ( new_ok_field_L); //gsi_insert_after ( &gsi, gnew_ok_field, GSI_SAME_STMT); - - // add code to after_bb + + // Add Code To after_bb + DEBUG_L("After Code Here <bb %d>:\n", after_bb->index); // // FROM gsi = gsi_start_bb( after_bb) // Reuse gsi @@ -1001,6 +1030,7 @@ str_reorg_instance_interleave_trans ( Info *info) //gsi_insert_after( &gsi, gm_cast_phi_val, GSI_NEW_STMT); // TBD What does GSI_NEW_STMT do if the block isn't emply? gsi_insert_before( &gsi, gm_cast_phi_val, GSI_NEW_STMT); + DEBUG_F( print_gimple_stmt, stderr, gm_cast_phi_val, 0); //// FROM gsi_insert_after( &gsi, after_label) //gimple *gafter_label = gimple_build_label( after_label_L); @@ -1008,6 +1038,7 @@ str_reorg_instance_interleave_trans ( Info *info) // failure_bb code here + DEBUG_L("Failure Code Here <bb %d>:\n", failure_bb->index); // // FROM fail_val is new SSA @@ -1024,6 +1055,7 @@ str_reorg_instance_interleave_trans ( Info *info) SSA_NAME_DEF_STMT ( fail_val) = gretnull; gsi_insert_after( &gsi, gretnull, GSI_NEW_STMT); + DEBUG_F( print_gimple_stmt, stderr, gretnull, 0); for( field = TYPE_FIELDS( reorg_type); field; @@ -1046,6 +1078,7 @@ str_reorg_instance_interleave_trans ( Info *info) SSA_NAME_DEF_STMT ( m_to_free) = gaddr2free; gsi_insert_after( &gsi, gaddr2free, GSI_CONTINUE_LINKING); + DEBUG_F( print_gimple_stmt, stderr, gaddr2free, 0); gcc_assert ( ptr_type_node); tree m_cast2free = @@ -1056,9 +1089,11 @@ str_reorg_instance_interleave_trans ( Info *info) SSA_NAME_DEF_STMT ( m_cast2free) = gm_cast2free; gsi_insert_after( &gsi, gm_cast2free, GSI_CONTINUE_LINKING); + DEBUG_F( print_gimple_stmt, stderr, gm_cast2free, 0); gcall *free_call = gimple_build_call( fndecl_free, 1, m_cast2free); gsi_insert_after( &gsi, free_call, GSI_CONTINUE_LINKING); + DEBUG_F( print_gimple_stmt, stderr, free_call, 0); cgraph_node::get ( cfun->decl)-> create_edge ( cgraph_node::get_create ( fndecl_free), @@ -1073,6 +1108,7 @@ str_reorg_instance_interleave_trans ( Info *info) gimple *gzero = gimple_build_assign( lhs_ass, null_pointer_node); gsi_insert_after( &gsi, gzero, GSI_CONTINUE_LINKING); + DEBUG_F( print_gimple_stmt, stderr, free_call, 0); } //// FROM gsi_insert_after( &gsi, bad_field ) @@ -1081,6 +1117,10 @@ str_reorg_instance_interleave_trans ( Info *info) //DEBUG_F( print_program, PRINT_FORMAT, stderr, 4); } INDENT(-2); + + DEBUG_L("AFTER MALLOC ===========================================\n"); + DEBUG_F( dump_function_to_file, func->decl, stderr, (dump_flags_t)0); + break; case ReorgT_Calloc: // TBD @@ -1676,6 +1716,11 @@ str_reorg_instance_interleave_trans ( Info *info) } #endif + if ( dom_info_available_p ( CDI_DOMINATORS)) + { + free_dominance_info (CDI_DOMINATORS); + } + pop_cfun (); } @@ -1911,7 +1956,7 @@ static bool is_array_access( tree); static unsigned int reorg_perf_qual ( Info *info) { - #if 0 + #if 1 // TBD use design in doc but mark ReorgTypes // (do_instance_interleave) that qualify instead of deleting them // unless both dead field elimination and field reorderig are not @@ -1950,8 +1995,13 @@ reorg_perf_qual ( Info *info) FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node) { struct function *func = DECL_STRUCT_FUNCTION ( node->decl); push_cfun ( func); - #if 0 + DEBUG_A("Function: %s\n", lang_hooks.decl_printable_name ( func->decl, 2)); + + if (dom_info_available_p (CDI_DOMINATORS)) + free_dominance_info (CDI_DOMINATORS); + + calculate_dominance_info ( CDI_DOMINATORS); // TBD class loop *loop; @@ -1999,7 +2049,8 @@ reorg_perf_qual ( Info *info) for ( ith = 0; ith < num_ops; ith++ ) { tree op = gimple_op ( stmt, ith); - DEBUG_A(""); + if ( op == NULL ) continue; + DEBUG_A("op %p: ", op); DEBUG_F( flexible_print, stderr, op, 1, (dump_flags_t)0); #if 0 if ( is_array_access( acc) ) @@ -2012,7 +2063,6 @@ reorg_perf_qual ( Info *info) } } INDENT(-4); - #endif // Disable for a bit #if 0 @@ -2096,7 +2146,6 @@ reorg_perf_qual ( Info *info) } // pop_cfun (); } - // TBD Somebody somewhere needs to compute: // reorg_perf // regular_perf diff --git a/gcc/ipa-structure-reorg.h b/gcc/ipa-structure-reorg.h index 286e57c2380..8454c42dd89 100644 --- a/gcc/ipa-structure-reorg.h +++ b/gcc/ipa-structure-reorg.h @@ -253,7 +253,7 @@ extern bool print_internals (gimple *, void *); // defined marcos in the code. However, some of uses // should obviously be converted to dump file information. -#define DEBUGGING 1 +#define DEBUGGING 0 #if DEBUGGING enum Display { Show_nothing, |