summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oblock <gary@amperecomputing.com>2020-09-05 14:06:28 -0700
committerGary Oblock <gary@amperecomputing.com>2020-09-05 14:06:28 -0700
commit505cb71e1db6ca699d06b4d6ba1a0a0865605fd4 (patch)
tree4ecb4e5c4a35a557edf8473cfdedf9011bfa2ccc
parentcbfcdc8e69e841364ae47f1649f7cb4ccd3a83c7 (diff)
Fixed bug that cropped up with inlining on. I needed to add a result
decl to function decls who's return type that I modified. Added code for pointer difference transformation. It's mostly semantic sugar to make GCC happy but it also required multiplying by the structure size (to counteract the code dividing by it.)
-rw-r--r--gcc/ipa-str-reorg-instance-interleave.c84
-rw-r--r--gcc/ipa-structure-reorg.c250
-rw-r--r--gcc/ipa-structure-reorg.h4
3 files changed, 275 insertions, 63 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c
index 7ba1da525f9..82a3919100a 100644
--- a/gcc/ipa-str-reorg-instance-interleave.c
+++ b/gcc/ipa-str-reorg-instance-interleave.c
@@ -484,7 +484,7 @@ str_reorg_instance_interleave_trans ( Info *info)
tree PPI_orig_lhs = gimple_assign_lhs ( stmt);
- tree offset_type = TREE_TYPE ( TYPE_SIZE_UNIT (ri->gcc_type));
+ //tree offset_type = TREE_TYPE ( TYPE_SIZE_UNIT (ri->gcc_type)); // not needed
tree type = ri->pointer_rep;
tree str_siz =
@@ -546,8 +546,56 @@ str_reorg_instance_interleave_trans ( Info *info)
*/
break;
case ReorgT_PtrDiff: // "i = a - b"
- DEBUG_L("ReorgT_PtrDiff\n");
- // Do nothing in the single pool case. TBD test this
+ {
+ DEBUG_L("ReorgT_PtrDiff\n");
+ // We basically need to modify the gimple code
+ // but that also means adding converts.
+ tree type = ri->pointer_rep;
+ tree str_siz =
+ build_int_cst ( type, int_cst_value ( TYPE_SIZE_UNIT (ri->gcc_type)));
+ tree rhs1 = gimple_assign_rhs1( stmt);
+ tree rhs2 = gimple_assign_rhs2( stmt);
+ tree PD_orig_lhs = gimple_assign_lhs ( stmt);
+
+ tree PD_rhs1_cast = make_temp_ssa_name( type, NULL, "PD_rhs1_cast");
+ gimple *gPD_rhs1_cast = gimple_build_assign ( PD_rhs1_cast, CONVERT_EXPR, rhs1);
+ SSA_NAME_DEF_STMT ( PD_rhs1_cast) = gPD_rhs1_cast;
+
+ tree PD_rhs2_cast = make_temp_ssa_name( type, NULL, "PD_rhs2_cast");
+ gimple *gPD_rhs2_cast = gimple_build_assign ( PD_rhs2_cast, CONVERT_EXPR, rhs2);
+ SSA_NAME_DEF_STMT ( PD_rhs2_cast) = gPD_rhs2_cast;
+
+ tree ptrdiff = make_temp_ssa_name( type, NULL, "PtrDiff");
+ gimple *gPD =
+ gimple_build_assign ( ptrdiff, MINUS_EXPR, PD_rhs1_cast, PD_rhs2_cast);
+ SSA_NAME_DEF_STMT ( ptrdiff) = gPD;
+
+ tree PD_adjust = make_temp_ssa_name( type, NULL, "PD_adjust");
+ gimple *gPD_adjust =
+ gimple_build_assign ( PD_adjust, MULT_EXPR, ptrdiff, str_siz);
+
+ gimple *gPD_cast =
+ gimple_build_assign ( PD_orig_lhs, CONVERT_EXPR, PD_adjust);
+ SSA_NAME_DEF_STMT ( PD_orig_lhs) = gPD_cast;
+
+ gimple_stmt_iterator gsi = gsi_for_stmt( stmt);
+ gsi_insert_before( &gsi, gPD_rhs1_cast, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, gPD_rhs2_cast, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, gPD, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, gPD_adjust, GSI_SAME_STMT);
+ gsi_insert_before( &gsi, gPD_cast, GSI_SAME_STMT);
+
+ gsi_remove ( &gsi, true);
+
+ DEBUG_L("");
+ DEBUG_F( print_gimple_stmt, stderr, gPD_rhs1_cast, 0);
+ DEBUG_L("");
+ DEBUG_F( print_gimple_stmt, stderr, gPD_rhs2_cast, 0);
+ DEBUG_L("");
+ DEBUG_F( print_gimple_stmt, stderr, gPD, 0);
+ DEBUG_L("");
+ DEBUG_F( print_gimple_stmt, stderr, gPD_cast, 0);
+ }
break;
case ReorgT_Adr2Ptr: // "a = &x[i]"
DEBUG_L("ReorgT_Adr2Ptr\n");
@@ -1271,8 +1319,8 @@ str_reorg_instance_interleave_trans ( Info *info)
DEBUG_L("Mini-Pass on Function %s:\n", lang_hooks.decl_printable_name ( func->decl, 2));
- DEBUG_L("\n");
- DEBUG_F( wolf_fence, info);
+ //DEBUG_L("\n");
+ //DEBUG_F( wolf_fence, info);
// We need a map of old ssa_name to new ssa_name. Not currently used.
std::map <tree,tree> ssa_map;
@@ -1295,6 +1343,11 @@ str_reorg_instance_interleave_trans ( Info *info)
// Default defs case first
// For parameters
+
+ // Note, we don't do anything unless it's necessary and it's
+ // not necessay if it's been done before. Hence the possibility
+ // of many functions mapping onto one declaration (which I
+ // even doubt is possible in thi case) can't be a problem.
DEBUG_L("Dangling Types for Function Params (default defs).\n");
INDENT(4);
@@ -1396,11 +1449,11 @@ str_reorg_instance_interleave_trans ( Info *info)
INDENT(-2);
}
INDENT(-4);
-
+
DEBUG_L("Dangling Types for Function Local (default defs).\n");
INDENT(4);
- DEBUG_L("\n");
- DEBUG_F( wolf_fence, info);
+ //DEBUG_L("\n");
+ //DEBUG_F( wolf_fence, info);
// For locals
//
@@ -1459,8 +1512,8 @@ str_reorg_instance_interleave_trans ( Info *info)
// Normal ssa name case
DEBUG_L("Dangling Types for Normal SSA Names:\n");
- DEBUG_L("\n");
- DEBUG_F( wolf_fence, info);
+ //DEBUG_L("\n");
+ //DEBUG_F( wolf_fence, info);
INDENT(4);
// We use len instead of using func->length() in the for loop test
@@ -1538,7 +1591,7 @@ str_reorg_instance_interleave_trans ( Info *info)
imm_use_iterator iter;
FOR_EACH_IMM_USE_STMT ( use_stmt, iter, ssa_name)
{
- DEBUG_L("use_stmt: ");
+ DEBUG_L("use_stmt before: ");
DEBUG_F ( print_gimple_stmt, stderr, use_stmt, 0);
// Deal with the uses
@@ -1554,6 +1607,9 @@ str_reorg_instance_interleave_trans ( Info *info)
if (use == ssa_name)
SET_USE ( use_p, new_ssa_name);
}
+ DEBUG_L("use_stmt after: ");
+ DEBUG_F ( print_gimple_stmt, stderr, use_stmt, 0);
+
// Should update_stmt be called here?
// It does not seem either harm or help so I'll
// leave it in.
@@ -1564,8 +1620,7 @@ str_reorg_instance_interleave_trans ( Info *info)
// Modify the LHS too
// TBD This code needs to be more general.
DEBUG_L("What is ssa_name? ");
- DEBUG_F(flexible_print, stderr, ssa_name, (dump_flags_t)0);
- DEBUG("\n");
+ DEBUG_F(flexible_print, stderr, ssa_name, 1, (dump_flags_t)0);
gimple *def = SSA_NAME_DEF_STMT ( ssa_name);
DEBUG_L("def: ");
@@ -1713,8 +1768,7 @@ print_internals (gimple *stmt, void *data)
bool lhs_reorg = tree_contains_a_reorgtype_p ( lhs, info);
//DEBUG_L("rhs1 = ");
- //DEBUG_F(flexible_print, stderr, rhs1, (dump_flags_t)0);
- //DEBUG("\n");
+ //DEBUG_F(flexible_print, stderr, rhs1, 1, (dump_flags_t)0);
bool rhs1_reorg = tree_contains_a_reorgtype_p ( rhs1, info);
bool rhs2_reorg = tree_contains_a_reorgtype_p ( rhs2, info);
bool rhs3_reorg = tree_contains_a_reorgtype_p ( rhs3, info);
diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c
index fbba1227d70..9ef52d37921 100644
--- a/gcc/ipa-structure-reorg.c
+++ b/gcc/ipa-structure-reorg.c
@@ -70,6 +70,10 @@ 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 adjust_result_decl ( struct function *);
+static tree modify_func_type ( struct function *, Info *);
+static bool needs_modification_p ( struct function *, Info *);
+static int number_of_levels ( tree);
//static void modify_decl_core ( tree *, Info *);
static void reorg_forbidden ( gimple *, Info *);
// Name changed and moved to its own file
@@ -136,10 +140,10 @@ ipa_structure_reorg ( void)
DEBUG_F( ssa_check, stderr, Show_everything, Do_not_fail, false, true);
setup_debug_flags ( &info);
- //initial_debug_info ( &info);
+ initial_debug_info ( &info);
- DEBUG_L("");
- DEBUG_F( wolf_fence, &info);
+ //DEBUG_L("");
+ //DEBUG_F( wolf_fence, &info);
if ( !reorg_analysis ( &info) )
{
@@ -150,8 +154,8 @@ ipa_structure_reorg ( void)
bool qualified = reorg_qualification(&info);
DEBUG_L("after reorg_qualification\n");
- DEBUG_L("");
- DEBUG_F(wolf_fence, &info);
+ //DEBUG_L("");
+ //DEBUG_F(wolf_fence, &info);
if ( qualified )
@@ -174,8 +178,8 @@ 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("");
- DEBUG_F(wolf_fence, &info);
+ //DEBUG_L("");
+ //DEBUG_F(wolf_fence, &info);
}
@@ -187,8 +191,8 @@ ipa_structure_reorg ( void)
reorg_common_middle_code( &info); // ??? might not amount to anything
DEBUG_L("after reorg_common_middle_code\n");
- DEBUG_L("");
- DEBUG_F(wolf_fence, &info);
+ //DEBUG_L("");
+ //DEBUG_F(wolf_fence, &info);
if ( flag_ipa_structure_reorg || flag_ipa_dead_field_eliminate )
{
@@ -981,18 +985,183 @@ modify_declarations ( Info *info)
// NOTE, Call modufy_decl_core breaks hello world!
// Modify the declaration of the function type itself.
+ // Note, create a new declaration if necessary. If this
+ // loop already created and the function is seen a second
+ // time reuse the previous one created.
+
+ // Note, most of the function type stuff can use memoization but
+ // it's not worth doing unless it proves to be a significant
+ // performance issue. This is what fncache is all about. But it's
+ // used not to save time but to guarantee that if two functions have
+ // the same type before this exercise, their new types will be
+ // equal afterwards.
+ std::map <tree,tree> fncache;
+
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?
+ 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);
+ tree old_ret_type = TREE_TYPE ( TREE_TYPE ( func->decl));
+ if ( location != fncache.end () )
+ {
+ TREE_TYPE ( func->decl) = location->second;
+
+ // The function type can be cached but this must be created
+ // anew for any function who's return type has changed
+ if ( old_ret_type != TREE_TYPE ( TREE_TYPE ( func->decl)) )
+ {
+ adjust_result_decl ( func);
+ }
+
+ pop_cfun ();
+ continue;
+ }
+
+ // check if funtion type needs modification.
+ if ( needs_modification_p ( func, info) )
+ {
+ // Create new type and set the decl's type to it.
+ tree new_func_type = modify_func_type ( func, info);
+
+ if ( old_ret_type != TREE_TYPE ( new_func_type))
+ {
+ adjust_result_decl ( func);
+ }
+
+ // Add the type to the cache.
+ fncache [ curr_func_type] = new_func_type;
+ }
+ #endif
pop_cfun ();
}
// Note, do not relayout functions decls....
}
+static void
+adjust_result_decl ( struct function *func)
+{
+ tree func_decl = func->decl;
+ tree ret_type = TREE_TYPE ( TREE_TYPE ( func_decl));
+ tree decl_result;
+
+ decl_result =
+ build_decl ( DECL_SOURCE_LOCATION ( func_decl),
+ RESULT_DECL, NULL_TREE, ret_type);
+ DECL_RESULT ( func_decl) = decl_result;
+ DECL_CONTEXT ( decl_result) = func_decl;
+}
+
+
+static tree
+modify_func_type ( struct function *func, Info *info )
+{
+ tree func_type = TREE_TYPE ( func->decl);
+ DEBUG_L("old func_type = ");
+ DEBUG_F( flexible_print, stderr, func_type, 1, (dump_flags_t)0);
+ INDENT(4);
+ tree new_type;
+ tree func_ret_type = TREE_TYPE ( func_type);
+ tree base = base_type_of ( func_ret_type);
+
+ ReorgType_t *ri = get_reorgtype_info ( base, info);
+ if ( ri != NULL )
+ {
+ // TBD Do level based stuff here
+ if ( number_of_levels ( func_ret_type ) == 1 )
+ {
+ func_ret_type = TYPE_MAIN_VARIANT ( ri->pointer_rep);
+ }
+ else
+ {
+ gcc_assert(0);
+ }
+ }
+ tree arg;
+ tree new_args = NULL_TREE;
+ //DEBUG_A("old arg = ");
+ //DEBUG_F( flexible_print, stderr, arg, 1, (dump_flags_t)0);
+ for ( arg = TYPE_ARG_TYPES ( func_type);
+ arg != NULL && arg != void_list_node;
+ arg = TREE_CHAIN ( arg))
+ {
+ //DEBUG_L("arg: ");
+ //DEBUG_F( flexible_print, stderr, arg, 1, (dump_flags_t)0);
+
+ tree type_of_arg = TREE_VALUE (arg);
+ //DEBUG_L("type_of_arg: ");
+ //DEBUG_F( flexible_print, stderr, type_of_arg, 1, (dump_flags_t)0);
+ base = base_type_of ( type_of_arg);
+ //DEBUG_L("base: ");
+ //DEBUG_F( flexible_print, stderr, base, 1, (dump_flags_t)0);
+
+ tree new_arg_type;
+ ri = get_reorgtype_info ( base, info);
+ if ( ri != NULL )
+ {
+ if ( number_of_levels ( type_of_arg ) == 1 )
+ {
+ new_arg_type = TYPE_MAIN_VARIANT ( ri->pointer_rep);
+ }
+ else
+ {
+ gcc_assert(0);
+ }
+ }
+ else
+ {
+ new_arg_type = type_of_arg;
+ }
+ new_args = tree_cons ( NULL_TREE, new_arg_type, new_args);
+ //DEBUG_A("interim new_args = ");
+ //DEBUG_F( flexible_print, stderr, new_args, 1, (dump_flags_t)0);
+ }
+ //DEBUG_A("before reverse new_args = ");
+ //DEBUG_F( flexible_print, stderr, new_args, 1, (dump_flags_t)0);
+ tree last = new_args;
+ new_args = nreverse ( new_args);
+ TREE_CHAIN ( last) = void_list_node;
+
+ DEBUG_A("new args = ");
+ DEBUG_F( flexible_print, stderr, new_args, 1, (dump_flags_t)0);
+ INDENT(-4);
+
+ new_type = build_function_type ( func_ret_type, new_args);
+ DEBUG_L("new_type (func) = ");
+ DEBUG_F( flexible_print, stderr, new_type, 1, (dump_flags_t)0);
+ TREE_TYPE ( func->decl) = new_type;
+ return new_type;
+}
+
+static bool
+needs_modification_p ( struct function *func, Info *info )
+{
+ tree func_type = TREE_TYPE ( func->decl);
+ tree ret_type = TREE_TYPE ( func_type);
+ tree base = base_type_of ( ret_type);
+ if ( get_reorgtype_info ( base, info) != NULL ) return true;
+
+ tree arg;
+ for ( arg = TYPE_ARG_TYPES ( func_type); arg != NULL; arg = TREE_CHAIN ( arg))
+ {
+ base = base_type_of ( ret_type);
+ if ( get_reorgtype_info ( base, info) != NULL ) return true;
+ }
+
+ return false;
+}
+
static int
number_of_levels ( tree type)
{
@@ -1014,14 +1183,11 @@ 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_F( flexible_print, stderr, func->decl, 1, (dump_flags_t)0);
//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_F( flexible_print, stderr, TREE_TYPE (func->decl), 1, (dump_flags_t)0);
//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");
+ //DEBUG_F( flexible_print, stderr, TREE_TYPE(TREE_TYPE (func->decl)), 1, (dump_flags_t)0);
// TBD Implement
tree *func_type_loc = &(TREE_TYPE(TREE_TYPE (func->decl)));
tree func_type = *func_type_loc;
@@ -1035,12 +1201,9 @@ modify_func_decl_core ( struct function *func, Info *info)
return false;
}
//DEBUG_A("pointer_rep = ");
- //DEBUG_F( flexible_print, stderr, ri->pointer_rep, (dump_flags_t)0);
- //DEBUG("\n");
+ //DEBUG_F( flexible_print, stderr, ri->pointer_rep, 1, (dump_flags_t)0);
//DEBUG_A("TYPE_MAIN_VARIANT( pointer_rep) = ");
- //DEBUG_F( flexible_print, stderr, TYPE_MAIN_VARIANT( ri->pointer_rep),(dump_flags_t)0);
- //DEBUG("\n");
-
+ //DEBUG_F( flexible_print, stderr, TYPE_MAIN_VARIANT( ri->pointer_rep), 1, (dump_flags_t)0);
int levels = number_of_levels ( func_type);
@@ -1064,14 +1227,11 @@ modify_func_decl_core ( struct function *func, Info *info)
//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_F( flexible_print, stderr, func->decl, 1, (dump_flags_t)0);
//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_F( flexible_print, stderr, TREE_TYPE (func->decl), 1, (dump_flags_t)0);
//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");
+ //DEBUG_F( flexible_print, stderr, TREE_TYPE(TREE_TYPE (func->decl)), 1, (dump_flags_t)0);
//INDENT(-4);
return true;
@@ -1084,15 +1244,13 @@ 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");
+ //DEBUG_F( flexible_print, stderr, *location, 1, (dump_flags_t)0);
tree type = *location;
//DEBUG_A("type = ");
- //DEBUG_F( flexible_print, stderr, type, (dump_flags_t)0);
+ //DEBUG_F( flexible_print, stderr, type, 0, (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");
+ //DEBUG_F( flexible_print, stderr, base, 1, (dump_flags_t)0);
ReorgType_t *ri = get_reorgtype_info ( base, info);
if ( ri == NULL )
{
@@ -1149,15 +1307,13 @@ 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");
+ //DEBUG_F( flexible_print, stderr, *location, 1, (dump_flags_t)0);
tree type = *location;
//DEBUG_A("type = ");
- //DEBUG_F( flexible_print, stderr, type, (dump_flags_t)0);
+ //DEBUG_F( flexible_print, stderr, type, 0, (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");
+ //DEBUG_F( flexible_print, stderr, base, 1, (dump_flags_t)0);
ReorgType_t *ri = get_reorgtype_info ( base, info);
if ( ri == NULL )
{
@@ -1848,7 +2004,7 @@ get_reorgtype_info ( tree type, Info* info)
// Remember, the same_type_p here is my own temporary hack.
//DEBUG_L("");
//DEBUG_F( print_generic_expr, stderr, type, TDF_DETAILS);
- // DEBUG("\n");
+ //DEBUG("\n");
if ( same_type_p ( ri->gcc_type, type) )
{
//DEBUG_A( " returns %p\n", &(*ri));
@@ -1910,16 +2066,13 @@ static tree
detect_reorg_in_expr ( tree *tp, int *w_s, void *data)
{
//DEBUG_L("*tp = ");
- //DEBUG_F( flexible_print, stderr, *tp, (dump_flags_t)0);
- //DEBUG("\n")
+ //DEBUG_F( flexible_print, stderr, *tp, 1, (dump_flags_t)0);
hidden_info_t *tre_hi = ( hidden_info_t *)data;
//DEBUG_L("TREE_TYPE ( *tp) = ");
- //DEBUG_F( flexible_print, stderr, TREE_TYPE ( *tp), (dump_flags_t)0);
- //DEBUG("\n")
+ //DEBUG_F( flexible_print, stderr, TREE_TYPE ( *tp), 1, (dump_flags_t)0);
tree operand = base_type_of ( TREE_TYPE ( *tp));
//DEBUG_L("operand = %p, ", operand);
- DEBUG_F( flexible_print, stderr, operand, (dump_flags_t)0);
- DEBUG("\n");
+ DEBUG_F( flexible_print, stderr, operand, 1, (dump_flags_t)0);
ReorgType_t *ri = get_reorgtype_info ( operand, tre_hi->info);
if ( ri != NULL )
{
@@ -2111,10 +2264,12 @@ print_program ( FILE *file, bool my_format, int leading_space, Info_t *info)
struct function *func = DECL_STRUCT_FUNCTION ( node->decl);
if ( my_format )
{
+ flexible_print ( file, TREE_TYPE( func->decl), 1, (dump_flags_t)0);
print_function ( file, leading_space + 4, func);
}
else
{
+ flexible_print ( file, TREE_TYPE( func->decl), 1, (dump_flags_t)0);
dump_function_header ( file, func->decl, (dump_flags_t)0);
dump_function_to_file ( func->decl, file, (dump_flags_t)0);
}
@@ -2471,7 +2626,7 @@ wolf_fence (
{
if ( ssa_check ( stderr, Show_failures, Fail_1st_bad, false, false) )
{
- fprintf ( stderr, "Wolf! : ");
+ fprintf ( stderr, "Wolf!\n");
gcc_assert (0);
}
@@ -2532,8 +2687,9 @@ ssa_check ( FILE *file, Display display, Failure failure, bool types, bool heade
return failure != Do_not_fail && has_a_failure;
}
+#endif
void
-flexible_print( FILE *f, tree t, dump_flags_t d)
+flexible_print( FILE *f, tree t, int nl, dump_flags_t d)
{
if ( DECL_P( t) )
{
@@ -2543,8 +2699,8 @@ flexible_print( FILE *f, tree t, dump_flags_t d)
{
print_generic_expr(f,t,d);
}
+ if ( nl ) fprintf ( f, "\n");
}
-#endif
//---------------- Pass Control Follows ----------------
diff --git a/gcc/ipa-structure-reorg.h b/gcc/ipa-structure-reorg.h
index e0b22efc8ed..f7644a0d71e 100644
--- a/gcc/ipa-structure-reorg.h
+++ b/gcc/ipa-structure-reorg.h
@@ -263,7 +263,6 @@ enum Failure {
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 *);
extern bool ssa_check ( FILE *, Display, Failure, bool, bool);
@@ -281,4 +280,7 @@ extern bool ssa_check ( FILE *, Display, Failure, bool, bool);
#define DEBUG(...)
#define DEBUG_F(...)
#define INDENT(a)
+
#endif
+extern void flexible_print( FILE *, tree, int, dump_flags_t);
+