diff options
author | Gary Oblock <gary@amperecomputing.com> | 2020-08-19 12:29:19 -0700 |
---|---|---|
committer | Gary Oblock <gary@amperecomputing.com> | 2020-08-19 12:29:19 -0700 |
commit | 748b3cbc17d48520ba503f245c3356c7eaf3e494 (patch) | |
tree | b10ebb554dd76ed320d9d3680784ce64e0529252 | |
parent | 8eb34491762368af8b58d9bfdff2bca96ab1757f (diff) |
Fixed some bugs seen in unit tests. Units tests still have issues
with unimplemented features.
Fixes were with function return type and calls returning reorg types.
-rw-r--r-- | gcc/ipa-str-reorg-instance-interleave.c | 149 | ||||
-rw-r--r-- | gcc/ipa-structure-reorg.c | 247 | ||||
-rw-r--r-- | gcc/ipa-structure-reorg.h | 2 |
3 files changed, 302 insertions, 96 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c index d90669372f7..7a9dd3ee559 100644 --- a/gcc/ipa-str-reorg-instance-interleave.c +++ b/gcc/ipa-str-reorg-instance-interleave.c @@ -128,13 +128,13 @@ str_reorg_instance_interleave_trans ( Info *info) ReorgType_t *ri = contains_a_reorgtype( stmt, info); if ( ri == NULL ) { - DEBUG_L("No Transfrom on: "); - DEBUG_F( print_gimple_stmt, stderr, stmt, 4, TDF_SLIM); + //DEBUG_L("No Transfrom on: "); + //DEBUG_F( print_gimple_stmt, stderr, stmt, 4, TDF_SLIM); } else { - DEBUG_F( print_reorg_with_msg, stderr, ri, 0, - "reorg from str_reorg_instance_interleave_trans"); + //DEBUG_F( print_reorg_with_msg, stderr, ri, 0, + // "reorg from str_reorg_instance_interleave_trans"); enum ReorgTransformation trans = reorg_recognize ( stmt, node, info); @@ -213,8 +213,7 @@ str_reorg_instance_interleave_trans ( Info *info) DEBUG_L("ReorgT_ElemAssign: "); DEBUG_F( print_gimple_stmt, stderr, stmt, 0); - DEBUG("\n"); - INDENT(2); + //INDENT(2); // Needed for helloworld tree lhs = gimple_assign_lhs( stmt); tree rhs = gimple_assign_rhs1( stmt); @@ -396,7 +395,7 @@ str_reorg_instance_interleave_trans ( Info *info) } // end recognize_op ( rhs, info) switch - INDENT(-2); + //INDENT(-2); } // end ReorgT_ElemAssign case break; case ReorgT_If_Null: @@ -531,7 +530,7 @@ str_reorg_instance_interleave_trans ( Info *info) case ReorgT_Malloc: { DEBUG_L("Transform ReorgT_Malloc\n"); - INDENT(2); + //INDENT(2); // We need to use the user malloc function // declaration rather than the builtin!!! @@ -726,32 +725,32 @@ str_reorg_instance_interleave_trans ( Info *info) base, 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("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"); + //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("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"); + //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"); tree lhs_ass_type = TREE_TYPE ( lhs_ass); - DEBUG_L("lhs_ass_type: %p\n", lhs_ass_type); - DEBUG_A(" lhs_ass_type: "); - DEBUG_F(print_generic_expr, stderr, lhs_ass_type, (dump_flags_t)0); - DEBUG("\n"); + //DEBUG_L("lhs_ass_type: %p\n", lhs_ass_type); + //DEBUG_A(" lhs_ass_type: "); + //DEBUG_F(print_generic_expr, stderr, lhs_ass_type, (dump_flags_t)0); + //DEBUG("\n"); gcc_assert ( sizetype); tree mem_size = @@ -789,10 +788,10 @@ str_reorg_instance_interleave_trans ( Info *info) make_temp_ssa_name ( TREE_TYPE ( base_field), NULL, "cast_res"); tree res_type = TREE_TYPE( res); - DEBUG_L("res_type: %p\n", res_type); - DEBUG_A(" : "); - DEBUG_F(print_generic_expr, stderr, res_type, (dump_flags_t)0); - DEBUG("\n"); + //DEBUG_L("res_type: %p\n", res_type); + //DEBUG_A(" : "); + //DEBUG_F(print_generic_expr, stderr, res_type, (dump_flags_t)0); + //DEBUG("\n"); // Move malloc_call here gcall *malloc_call = gimple_build_call( fndecl_malloc, 1, mem_size); @@ -995,7 +994,7 @@ str_reorg_instance_interleave_trans ( Info *info) //DEBUG_L("End of malloc:\n"); //DEBUG_F( print_program, PRINT_FORMAT, stderr, 4); } - INDENT(-2); + //INDENT(-2); break; case ReorgT_Calloc: DEBUG_L("ReorgT_Calloc\n"); @@ -1175,30 +1174,22 @@ str_reorg_instance_interleave_trans ( Info *info) */ break; case ReorgT_UserFunc: - // Needed for helloworld. - // TBD The type must be adjusted (maybe.) - - // New thoughts for - // ... = func(...,reorg_type *x,..) - // Doesn't the func decl type have to be adjusted for - // x to be the pointer rep? Where do I do it? - // Here doesn't seem like a great idea. - // Note, do we need to emit this? - // x' = (pointre_rep)x - // ... = func(...,x',...) - // Look at is_user_funtion on hint on the - // how to get info on func. - - - // Note, what proably needed is an extra - // mini-pass to adjust all "dangling" SSA temps. - // I mean dangling in the sense that they are - // pointers to a reorg type on the left hand side - // of an assign and they haven't been modified to - // use the correct reorg pointer represenatation, - // even though the right hand side has been. - - DEBUG_L("ReorgT_UserFunc\n"); + { + DEBUG_L("ReorgT_UserFunc: "); + DEBUG_F( print_gimple_stmt, stderr, stmt, 0); + // Needed for helloworld. + // The type must be adjusted, but not here. + + // Note, what is done is there is a case (for + // GIMPLE_CALL) in the mini-pass to adjust a + // call's "dangling" SSA temp. I mean dangling + // in the sense that there are pointers to a + // reorg type on the left hand side of + // statements and they haven't been modified to + // use the correct reorg pointer + // represenatation, even though the right hand + // side has been. + } break; case ReorgT_Convert: // Ignore type casting because another @@ -1227,7 +1218,7 @@ str_reorg_instance_interleave_trans ( Info *info) struct function *func = DECL_STRUCT_FUNCTION ( node->decl); push_cfun ( func); - // We need a map of old ssa_name to new ssa_name. + // We need a map of old ssa_name to new ssa_name. Not currently used. std::map <tree,tree> ssa_map; // Walk function decl. @@ -1250,7 +1241,7 @@ str_reorg_instance_interleave_trans ( Info *info) // For parameters //DEBUG_L("Dangling Types for Function Params (default defs).\n"); - INDENT(4); + //INDENT(4); tree parm; for ( parm = DECL_ARGUMENTS ( func->decl); parm; @@ -1316,13 +1307,15 @@ str_reorg_instance_interleave_trans ( Info *info) use_operand_p use; // Modify stmts using old default def to use // new default def - FOR_EACH_IMM_USE_STMT ( stmt, iter, old_default_def) + FOR_EACH_IMM_USE_STMT ( stmt, iter, old_default_def) // <== use other form??? Not { //DEBUG_A("before: "); //DEBUG_F ( print_gimple_stmt, stderr, stmt, 0); use_operand_p use_p; ssa_op_iter ssa_iter; - FOR_EACH_SSA_USE_OPERAND( use_p, stmt, ssa_iter, SSA_OP_USE ) + // The F_E_S_U_O macro was blowing up on a phi + //FOR_EACH_SSA_USE_OPERAND( use_p, stmt, ssa_iter, SSA_OP_USE ) + FOR_EACH_PHI_OR_STMT_USE ( use_p, stmt, ssa_iter, SSA_OP_USE ) { if ( use_p == NULL ) continue; tree use = USE_FROM_PTR (use_p); @@ -1341,10 +1334,10 @@ str_reorg_instance_interleave_trans ( Info *info) } } } - INDENT(-4); + //INDENT(-4); DEBUG_L("Dangling Types for Function Local (default defs).\n"); - INDENT(4); + //INDENT(4); // For locals // @@ -1399,11 +1392,11 @@ str_reorg_instance_interleave_trans ( Info *info) } } } - INDENT(-4); + //INDENT(-4); // Normal ssa name case DEBUG_L("Dangling Types for Normal SSA Names:\n"); - INDENT(4); + //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 // shouldn't process them. @@ -1457,7 +1450,7 @@ str_reorg_instance_interleave_trans ( Info *info) { if ( (*SSANAMES ( func))[j] == new_ssa_name ) { - //DEBUG_L("new name at j = %d\n",j); + DEBUG_L("new name at j = %d\n",j); break; } } @@ -1473,7 +1466,9 @@ str_reorg_instance_interleave_trans ( Info *info) // Deal with the uses use_operand_p use_p; ssa_op_iter ssa_iter; - FOR_EACH_SSA_USE_OPERAND( use_p, use_stmt, ssa_iter, SSA_OP_USE ) + // The F_E_S_U_O macro was blowing up on a phi + //FOR_EACH_SSA_USE_OPERAND( use_p, use_stmt, ssa_iter, SSA_OP_USE ) + FOR_EACH_PHI_OR_STMT_USE ( use_p, use_stmt, ssa_iter, SSA_OP_USE ) { //DEBUG_L("use_p = %p\n",use_p); if ( use_p == NULL ) continue; @@ -1496,14 +1491,22 @@ str_reorg_instance_interleave_trans ( Info *info) // Note, the following code might be a bit overly // simplistic. - if ( gimple_code ( def) != GIMPLE_ASSIGN ) continue; - - gimple_assign_set_lhs ( def, new_ssa_name); + if ( gimple_code ( def) == GIMPLE_ASSIGN ) + { + gimple_assign_set_lhs ( def, new_ssa_name); + } + else + if ( gimple_code ( def) == GIMPLE_CALL ) + { + gimple_call_set_lhs ( def, new_ssa_name); + } + else + continue; // This is where we know that ssa_name needs to be replaced release_ssa_name_fn ( func, ssa_name); } - INDENT(-4); + //INDENT(-4); pop_cfun (); } @@ -1511,8 +1514,8 @@ str_reorg_instance_interleave_trans ( Info *info) DEBUG_L("after mini-passes\n"); // TBD Should this be a diagnostic or not? - DEBUG ("INTERNALS PRINT\n"); - DEBUG_F (apply_to_all_gimple, print_internals, true, (void *)info); + //DEBUG ("INTERNALS PRINT\n"); + //DEBUG_F (apply_to_all_gimple, print_internals, true, (void *)info); if ( info->show_all_reorg_cands ) { diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c index d4f53f4521c..8302e140851 100644 --- a/gcc/ipa-structure-reorg.c +++ b/gcc/ipa-structure-reorg.c @@ -69,6 +69,7 @@ static void transformation_legality_debug ( Info *, ReorgType *); static bool reorg_legality ( Info *); static void reorg_common_middle_code ( Info *); static void modify_declarations ( Info *); +static bool modify_func_decl_core ( struct function *, Info *); //static void modify_decl_core ( tree *, Info *); static void reorg_forbidden ( gimple *, Info *); // Name changed and moved to its own file @@ -161,7 +162,7 @@ ipa_structure_reorg ( void) { //DEBUG_L("before str_reorg_instance_interleave_qual\n"); str_reorg_instance_interleave_qual ( &info); - DEBUG_L("after str_reorg_instance_interleave_qual\n"); + //DEBUG_L("after str_reorg_instance_interleave_qual\n"); } if ( info.show_all_reorg_cands_in_detail ) @@ -383,9 +384,10 @@ reorg_analysis_debug ( Info *info, ReorgType *reorg ) } } -static bool find_decls_and_types ( Info *info) +static bool +find_decls_and_types ( Info *info) { - DEBUG_L("find_decls_and_types: entered\n"); + //DEBUG_L("find_decls_and_types: entered\n"); // Don't keep any structure types if they aren't // used in an array or have a pointer type (which @@ -898,8 +900,8 @@ transformation_legality ( Info *info) { if ( reorg_recognize( stmt, node, info) == Not_Supported ) { - DEBUG_L("deleting %d reorgs for unsuported stmt: ", num); - DEBUG_F ( print_gimple_stmt, stderr, stmt, 0); + //DEBUG_L("deleting %d reorgs for unsuported stmt: ", num); + //DEBUG_F ( print_gimple_stmt, stderr, stmt, 0); int i; for ( i = 0; i < num; i++ ) { @@ -957,22 +959,189 @@ modify_declarations ( Info *info) for ( pv = info->prog_decl->begin (); pv != info->prog_decl->end (); pv++ ) { - //modify_decl_core ( &( pv->gcc_decl->decl), info); modify_decl_core ( &( pv->gcc_decl), info); } + // NOTE, Call modufy_decl_core breaks hello world! + + // Modify the declaration of the function type itself. + struct cgraph_node *node; + FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node) + { + struct function *func = DECL_STRUCT_FUNCTION ( node->decl); + push_cfun ( func); // Is push and necessary? + modify_func_decl_core ( func, info); + pop_cfun (); + } + // Note, do not relayout functions decls.... } +static int +number_of_levels ( tree type) +{ +tree prev_type; + int levels = 0; + for ( ; TREE_CODE ( type) == POINTER_TYPE; levels++ ) + { + prev_type = type; + type = TREE_TYPE ( prev_type); + //DEBUG_A( "prev_type: %p, type: %p\n", prev_type, type); + } + //DEBUG_A("number_of_levels = %d\n", levels); + return levels; +} + +static bool +modify_func_decl_core ( struct function *func, Info *info) +{ + //DEBUG_L("BEFORE modify_func_decl_core:\n"); + //INDENT(4); + //DEBUG_A("func->decl = %p, ", func->decl); + //DEBUG_F( flexible_print, stderr, func->decl, (dump_flags_t)0); + //DEBUG("\n"); + //DEBUG_A("TREE_TYPE (func->decl) = %p, ", TREE_TYPE (func->decl)); + //DEBUG_F( flexible_print, stderr, TREE_TYPE (func->decl), (dump_flags_t)0); + //DEBUG("\n"); + //DEBUG_A("TREE_TYPE(TREE_TYPE (func->decl)) = %p, ", TREE_TYPE(TREE_TYPE (func->decl))); + //DEBUG_F( flexible_print, stderr, TREE_TYPE(TREE_TYPE (func->decl)), (dump_flags_t)0); + //DEBUG("\n"); + // TBD Implement + tree *func_type_loc = &(TREE_TYPE(TREE_TYPE (func->decl))); + tree func_type = *func_type_loc; + tree base = base_type_of ( func_type); + + ReorgType_t *ri = get_reorgtype_info ( base, info); + if ( ri == NULL ) + { + //DEBUG_A("Return as not a reorg type.\n"); + //INDENT(-4); + return false; + } + //DEBUG_A("pointer_rep = "); + //DEBUG_F( flexible_print, stderr, ri->pointer_rep, (dump_flags_t)0); + //DEBUG("\n"); + //DEBUG_A("TYPE_MAIN_VARIANT( pointer_rep) = "); + //DEBUG_F( flexible_print, stderr, TYPE_MAIN_VARIANT( ri->pointer_rep),(dump_flags_t)0); + //DEBUG("\n"); + + + int levels = number_of_levels ( func_type); + + // TBD This code must in the near future handle an + // abritary number of levels! + if ( levels == 1 ) + { + //DEBUG_A( "levels == 1\n"); + // Why type main variant pointer_rep ??? + // We created it! + gcc_assert ( TYPE_MAIN_VARIANT ( ri->pointer_rep)); + //TREE_TYPE( *func_type_loc) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + //*func_type_loc = TYPE_MAIN_VARIANT ( ri->pointer_rep); + TREE_TYPE ( TREE_TYPE ( func->decl)) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + } + else + { + //DEBUG_A( "levels != 1\n"); + gcc_assert(0); + } + + //DEBUG_L("AFTER modify_func_decl_core:\n"); + //DEBUG_A("func->decl = %p, ", func->decl); + //DEBUG_F( flexible_print, stderr, func->decl, (dump_flags_t)0); + //DEBUG("\n"); + //DEBUG_A("TREE_TYPE (func->decl) = %p, ", TREE_TYPE (func->decl)); + //DEBUG_F( flexible_print, stderr, TREE_TYPE (func->decl), (dump_flags_t)0); + //DEBUG("\n"); + //DEBUG_A("TREE_TYPE(TREE_TYPE (func->decl)) = %p, ", TREE_TYPE(TREE_TYPE (func->decl))); + //DEBUG_F( flexible_print, stderr, TREE_TYPE(TREE_TYPE (func->decl)), (dump_flags_t)0); + //DEBUG("\n"); + + //INDENT(-4); + return true; +} + // Returns true if a modification occurred +#if 1 +// Dubious version bool modify_decl_core ( tree *location, Info *info) { - //DEBUG_L("before modify_decl_core"); + //DEBUG_L("before modify_decl_core: "); + //DEBUG_F( flexible_print, stderr, *location, (dump_flags_t)0); + //DEBUG("\n"); + tree type = *location; + //DEBUG_A("type = "); + //DEBUG_F( flexible_print, stderr, type, (dump_flags_t)0); + tree base = base_type_of ( type); + //DEBUG_A(", base = "); + //DEBUG_F( flexible_print, stderr, base, (dump_flags_t)0); + //DEBUG("\n"); + ReorgType_t *ri = get_reorgtype_info ( base, info); + if ( ri == NULL ) + { + return false; + } + + // array case -- not doing non-dynamically + // allocated arrays yet so this case won't + // currently occur + + // borrowed from wrangle_ssa_type + tree prev_type; + int levels; + for ( levels = 0; TREE_CODE ( type) == POINTER_TYPE; levels++ ) + { + prev_type = type; + type = TREE_TYPE ( prev_type); + //DEBUG_L( "prev_type: %p, type: %p\n", prev_type, type); + } + // TBD might use build_pointer_type to build new type for *(N)reorg_type + // to *(N-1)ri->pointer_rep + // Fakes this for levels == 1 + if ( levels == 0) // How did this test ever work???? It didn't + //if ( levels == 1) + { + //DEBUG_L( "LEVEL ONE\n"); + //modify_ssa_name_type ( side, ri->pointer_rep); + gcc_assert ( TYPE_MAIN_VARIANT ( ri->pointer_rep)); + //TREE_TYPE ( *location) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + TREE_TYPE(*location) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + } + else + { + //DEBUG_L( "LEVEL > ONE\n"); + gcc_assert(0); + } + + if ( DECL_INITIAL ( *location) != NULL ) + { + // Note this assumes the levels code above is not general + DECL_INITIAL ( *location) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + } + + relayout_decl ( *location); + + //DEBUG_L(" after modify_decl_core"); //DEBUG_F( print_generic_decl, stderr, *location, (dump_flags_t)0); //DEBUG("\n"); + return true; +} +#else +// Nodubious version +bool +modify_decl_core ( tree *location, Info *info) +{ + //DEBUG_L("before modify_decl_core: "); + //DEBUG_F( flexible_print, stderr, *location, (dump_flags_t)0); + //DEBUG("\n"); tree type = *location; + //DEBUG_A("type = "); + //DEBUG_F( flexible_print, stderr, type, (dump_flags_t)0); tree base = base_type_of ( type); + //DEBUG_A(", base = "); + //DEBUG_F( flexible_print, stderr, base, (dump_flags_t)0); + //DEBUG("\n"); ReorgType_t *ri = get_reorgtype_info ( base, info); if ( ri == NULL ) { @@ -995,16 +1164,18 @@ modify_decl_core ( tree *location, Info *info) // TBD might use build_pointer_type to build new type for *(N)reorg_type // to *(N-1)ri->pointer_rep // Fakes this for levels == 1 - if ( levels == 0) + if ( levels == 0) // How did this test ever work???? It didn't + //if ( levels == 1) { - //DEBUG_L( "LEVEL ZERO\n"); + //DEBUG_L( "LEVEL ONE\n"); //modify_ssa_name_type ( side, ri->pointer_rep); gcc_assert ( TYPE_MAIN_VARIANT ( ri->pointer_rep)); - TREE_TYPE ( *location) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + //TREE_TYPE ( *location) = TYPE_MAIN_VARIANT ( ri->pointer_rep); + TREE_TYPE(*location) = TYPE_MAIN_VARIANT ( ri->pointer_rep); } else { - DEBUG_L( "LEVEL > ZERO\n"); + //DEBUG_L( "LEVEL > ONE\n"); gcc_assert(0); } @@ -1021,32 +1192,33 @@ modify_decl_core ( tree *location, Info *info) //DEBUG("\n"); return true; } +#endif void delete_reorgtype ( ReorgType_t *rt, Info *info ) { - DEBUG_L( "delete_reorgtype( %s ):", type_name_to_str( TYPE_NAME( rt->gcc_type))); + //DEBUG_L( "delete_reorgtype( %s ):", type_name_to_str( TYPE_NAME( rt->gcc_type))); if ( !rt->delete_me ) { - DEBUG( "TO DELETE\n"); + //DEBUG( "TO DELETE\n"); info->num_deleted++; rt->delete_me = true; } else { - DEBUG( "SKIP\n"); + //DEBUG( "SKIP\n"); } } void undelete_reorgtype ( ReorgType_t *rt, Info *info ) { - DEBUG_L( "undelete_reorgtype( %s ): ", type_name_to_str( TYPE_NAME( rt->gcc_type))); + //DEBUG_L( "undelete_reorgtype( %s ): ", type_name_to_str( TYPE_NAME( rt->gcc_type))); if ( rt->delete_me ) { - DEBUG( "UNDELETE\n"); + //DEBUG( "UNDELETE\n"); info->num_deleted--; rt->delete_me = false; } else { - DEBUG( "SKIP\n"); + //DEBUG( "SKIP\n"); } } @@ -1466,7 +1638,7 @@ recognize_op ( tree op, Info *info) //DEBUG_L(" returns: ReorgOpT_Scalar\n"); return ReorgOpT_Scalar; } - //DEBUG_L("TREE_CODE( inner_op) not INDIRECT_REF or MEM_REF\n"); + DEBUG_L("TREE_CODE( inner_op) not INDIRECT_REF or MEM_REF\n"); // Note, doesn't this ignore ARRAY_REF of this? // I think it's OK at least until we start supporting // multi-pools. @@ -1749,6 +1921,19 @@ tree_contains_a_reorgtype_p ( tree expr, Info *info) return tre_hi.found_reorg != NULL; } +ReorgType_t * +tree_contains_a_reorgtype ( tree expr, Info *info) +{ + hidden_info_t tre_hi = { NULL, info }; + // The stuff comment out was for gimple walks. Yikes! + //struct walk_stmt_info walk_info; + //memset ( &walk_info, 0, sizeof ( walk_info)); + //walk_info.info = ( void*)&tre_hi; + walk_tree_1 ( &expr, detect_reorg_in_expr, (void *)&tre_hi, NULL, NULL); + + return tre_hi.found_reorg; +} + void print_reorg_with_msg ( FILE *file, ReorgType_t *reorg, @@ -1910,8 +2095,8 @@ print_program ( FILE *file, bool my_format, int leading_space, Info_t *info) } } - DEBUG ("INTERNALS PRINT\n"); - DEBUG_F (apply_to_all_gimple, print_internals, true, (void*)info); + //DEBUG ("INTERNALS PRINT\n"); + //DEBUG_F (apply_to_all_gimple, print_internals, true, (void*)info); } static void @@ -2068,9 +2253,9 @@ modify_ssa_name_type ( tree ssa_name, tree type) // This rips off the code in make_ssa_name_fn. // Note, this probabily be made into special function // that is part of tree-ssanames. - DEBUG_L("modify_ssa_name_type ssa_name "); - DEBUG_F(print_generic_expr, stderr, ssa_name, (dump_flags_t)0); - DEBUG("\n"); + //DEBUG_L("modify_ssa_name_type ssa_name "); + //DEBUG_F(print_generic_expr, stderr, ssa_name, (dump_flags_t)0); + //DEBUG("\n"); //gcc_assert ( TREE_TYPE ( type)); //DEBUG_A("type: "); //DEBUG_F(print_generic_expr, stderr, type, (dump_flags_t)0); @@ -2190,6 +2375,22 @@ wf_func ( tree *slot, tree *dummy) return 0; } +#if DEBUGGING +void +flexible_print( FILE *f, tree t, dump_flags_t d) +{ + if ( DECL_P( t) ) + { + print_generic_decl(f,t,d); + } + else + { + print_generic_expr(f,t,d); + } +} +#endif + + void wolf_fence ( Info *info // Pass level gobal info (might not use it) diff --git a/gcc/ipa-structure-reorg.h b/gcc/ipa-structure-reorg.h index caf29354a3d..471590a762a 100644 --- a/gcc/ipa-structure-reorg.h +++ b/gcc/ipa-structure-reorg.h @@ -231,6 +231,7 @@ extern ReorgType_t *get_reorgtype_info ( tree, Info_t *); extern void print_reorg_with_msg ( FILE *, ReorgType_t *, int, const char *); extern ReorgType_t *contains_a_reorgtype ( gimple *, Info *); extern bool tree_contains_a_reorgtype_p ( tree, Info *); +extern ReorgType_t *tree_contains_a_reorgtype ( tree, Info *); extern bool is_reorg_type ( tree, Info_t *); extern tree base_type_of ( tree); extern void print_reorg ( FILE *, int, ReorgType_t *); @@ -250,6 +251,7 @@ extern bool print_internals (gimple *, void *); extern int debug_indenting; extern void handle_debug_indenting( int); extern const char *code_str( enum tree_code); +extern void flexible_print( FILE *, tree, dump_flags_t); extern void wolf_fence( Info *); // Line numbered |