summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oblock <gary@amperecomputing.com>2020-06-15 21:33:43 -0700
committerGary Oblock <gary@amperecomputing.com>2020-06-15 21:33:43 -0700
commitf2fa8fd1cc3bdfb6d2b17ee07650329786f510f3 (patch)
treeb27cecc1b9857d1e5dba6664d475f6d1079fb3f1
parented6642af4835582bea6ec22e1b8442a3e90be194 (diff)
malloc transformation limps through to completion (with issues)
-rw-r--r--gcc/ipa-str-reorg-instance-interleave.c206
-rw-r--r--gcc/ipa-structure-reorg.c48
-rw-r--r--gcc/ipa-structure-reorg.h3
3 files changed, 195 insertions, 62 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c
index b22d5bc594e..699a8fbda1e 100644
--- a/gcc/ipa-str-reorg-instance-interleave.c
+++ b/gcc/ipa-str-reorg-instance-interleave.c
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "tree-ssanames.h"
#include "cfghooks.h"
+#include "function.h"
static void str_reorg_instance_interleave_qual_part ( Info *);
static void str_reorg_instance_interleave_type_part ( Info *);
@@ -74,6 +75,8 @@ str_reorg_instance_interleave_trans ( Info *info)
FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
{
struct function *func = DECL_STRUCT_FUNCTION ( node->decl);
+ // Ulgy GCC idiom with global pointer to current function.
+ set_cfun ( func);
if ( info->show_transforms )
{
fprintf( dump_file, "Function \"%s\":\n",
@@ -92,16 +95,17 @@ str_reorg_instance_interleave_trans ( Info *info)
bb->index);
}
- gimple_stmt_iterator gsi;
- for ( gsi = gsi_start_bb ( bb);
- !gsi_end_p ( gsi);
- gsi_next ( &gsi) )
+ gimple_stmt_iterator outer_gsi;
+ gimple_stmt_iterator next_gsi;
+ for ( outer_gsi = gsi_start_bb ( bb); !gsi_end_p ( outer_gsi); outer_gsi = next_gsi )
{
+ next_gsi = outer_gsi;
+ gsi_next ( &next_gsi);
// Every statement that uses a reorg type needs to
// be examined. Some are harmless and are skipped
// whereas others are transformed. However, anything
// else is an error.
- gimple *stmt = gsi_stmt ( gsi);
+ gimple *stmt = gsi_stmt ( outer_gsi);
ReorgType_t *ri = contains_a_reorgtype( stmt, info);
if ( ri != NULL )
{
@@ -322,11 +326,18 @@ str_reorg_instance_interleave_trans ( Info *info)
tree arg = gimple_call_arg( stmt, 0);
// TBD: len is new SSA
tree val = gimple_call_lhs( stmt);
- gcc_assert( TREE_CODE( TREE_TYPE(val)) == INDIRECT_REF);
+ //DEBUG_L("val is: ");
+ //DEBUG_F( print_generic_expr, stderr, val, (dump_flags_t)-1);
+ //DEBUG(", tree code type: %s\n", code_str(TREE_CODE(TREE_TYPE(val))));
+ //gcc_assert( TREE_CODE( TREE_TYPE(val)) == INDIRECT_REF);
+ gcc_assert( TREE_CODE( TREE_TYPE(val)) == POINTER_TYPE);
tree size = TYPE_SIZE_UNIT( TREE_TYPE( TREE_TYPE( val)));
// FROM len = val/size (insert before stmt) <== maybe arg/size
- tree len =
- make_temp_ssa_name( sizetype, NULL, "fail_val");
+ //tree len = make_temp_ssa_name( sizetype, NULL, "fail_val");
+ // The above segfaulted ??? note, it's not an idiom seen in gcc
+ tree int_ptrsize_type = signed_type_for ( ptr_type_node);
+ DEBUG_L("int_ptrsize_type = %p\n", int_ptrsize_type);
+ tree len = make_temp_ssa_name ( int_ptrsize_type, NULL, "malloc_len");
gimple_stmt_iterator gsi = gsi_for_stmt( stmt);
//gimple *glen =
// gimple_build_assign ( len, TRUNC_DIV_EXPR, val, size);
@@ -358,6 +369,7 @@ str_reorg_instance_interleave_trans ( Info *info)
// FROM failure_bb = create_empty_block(prev_bb)
basic_block failure_bb = create_empty_bb ( prev_bb);
// FROM make_edge( failure_bb, after_bb, EDGE_FALLTHRU);
+ // TBD set edge probability and flags
edge failure_edge = make_edge ( failure_bb,
after_bb, EDGE_FALLTHRU);
// FROM bad_field is new label
@@ -365,44 +377,48 @@ str_reorg_instance_interleave_trans ( Info *info)
create_artificial_label ( UNKNOWN_LOCATION);
// FROM delete stmt
gsi_remove ( &gsi, true);
-
+
+ tree return_type = TREE_TYPE ( arg);
+ tree fail_val =
+ make_temp_ssa_name ( return_type, NULL, "malloc_fail_val");
+ tree field;
+ tree reorg_type = ri->gcc_type; // is this useful here?
+ tree reorg_pointer_type = ri->pointer_rep;
+ tree base = ri->clone;
+
+ #if 0
+ // if defed off here... move this
// code in failure_bb
//
// FROM fail_val is new SSA
- tree return_type = TREE_TYPE ( arg);
- tree fail_val =
- make_temp_ssa_name ( return_type, NULL, "fail_val");
// FROM gsi = gsi_start_bb ( failure_bb)
gsi = gsi_start_bb ( failure_bb);
// FROM gsi_insert_after ( &gsi, "goto after_label")
gimple *goto_al = gimple_build_goto ( after_label_L);
gsi_insert_after ( &gsi, goto_al, GSI_SAME_STMT);
// (per field) {
- tree field;
- tree reorg_type = ri->gcc_type; // is this useful here?
- tree reorg_pointer_type = ri->pointer_rep;
tree fndecl_free = builtin_decl_explicit( BUILT_IN_FREE);
- tree base = ri->clone;
for( field = TYPE_FIELDS( reorg_type);
field;
- field = DECL_CHAIN( field)) {
- // FROM gsi_insert_after( &gsi, "base.field = 0")
- tree lhs_ass =
- build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
- gimple *gzero = gimple_build_assign( lhs_ass, null_pointer_node);
- gsi_insert_after( &gsi, gzero, GSI_SAME_STMT);
-
- // FROM gsi_insert_after( &gsi, "free(field)")
- // TBD -- I'm
- tree to_free =
- make_temp_ssa_name( reorg_pointer_type, NULL, "to_free");
- gcall *free_call = gimple_build_call( fndecl_free, 1, to_free);
- gsi_insert_after( &gsi, free_call, GSI_SAME_STMT);
- tree rhs_ass =
- build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
- gimple *gaddr2free = gimple_build_assign( to_free, rhs_ass);
- gsi_insert_after( &gsi, gaddr2free, GSI_SAME_STMT);
- }
+ field = DECL_CHAIN( field))
+ {
+ // FROM gsi_insert_after( &gsi, "base.field = 0")
+ tree lhs_ass =
+ build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
+ gimple *gzero = gimple_build_assign( lhs_ass, null_pointer_node);
+ gsi_insert_after( &gsi, gzero, GSI_SAME_STMT);
+
+ // FROM gsi_insert_after( &gsi, "free(field)")
+ // TBD -- I'm
+ tree to_free =
+ make_temp_ssa_name( reorg_pointer_type, NULL, "malloc_to_free");
+ gcall *free_call = gimple_build_call( fndecl_free, 1, to_free);
+ gsi_insert_after( &gsi, free_call, GSI_SAME_STMT);
+ tree rhs_ass =
+ build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
+ gimple *gaddr2free = gimple_build_assign( to_free, rhs_ass);
+ gsi_insert_after( &gsi, gaddr2free, GSI_SAME_STMT);
+ }
// FROM gsi_insert_after( &gsi, "fail_val = minint")
gimple *gretnull =
gimple_build_assign ( fail_val,
@@ -412,6 +428,7 @@ str_reorg_instance_interleave_trans ( Info *info)
// FROM gsi_insert_after( &gsi, bad_field )
gimple *gbad_field = gimple_build_label( bad_field_L);
gsi_insert_after( &gsi, gbad_field, GSI_SAME_STMT);
+ #endif
// loop setup trickery for gimple idioms
//
@@ -441,11 +458,22 @@ str_reorg_instance_interleave_trans ( Info *info)
basic_block new_bb = create_empty_bb ( prev_order);
// FROM gsi = gsi_start_bb( new_bb)
gimple_stmt_iterator gsi = gsi_start_bb ( new_bb);
+ // Note, switching the order of edge creation and
+ // setting dominator seems to make no difference
+ #if 0
// FROM set imm dom new_bb as prev_bb
set_immediate_dominator ( CDI_DOMINATORS, new_bb, prev_bb);
// FROM make_edge( prev_bb, new_bb, EDGE_TRUE_VALUE);
make_edge ( prev_bb, new_bb, EDGE_TRUE_VALUE);
+ #else
+ // TBD set edge probability and flags
+ make_edge ( prev_bb, new_bb, EDGE_TRUE_VALUE);
+ // TBD what happens if I punt on this????
+ //set_immediate_dominator ( CDI_DOMINATORS, new_bb, prev_bb);
+ #endif
+
// FROM make_edge( new_bb, failure_bb, EDGE_FALSE_VALUE);
+ // TBD set edge probability and flags
make_edge ( new_bb, failure_bb, EDGE_FALSE_VALUE);
// FROM new_ok_field is new label
new_ok_field_L =
@@ -458,6 +486,10 @@ str_reorg_instance_interleave_trans ( Info *info)
gimple *gcond =
gimple_build_cond ( NE_EXPR, res, null_pointer_node,
new_ok_field_L, bad_field_L);
+ // Moved label her from end
+ gimple *gprev_ok_field = gimple_build_label ( prev_ok_field_L);
+ gsi_insert_after ( &gsi, gprev_ok_field, GSI_NEW_STMT);
+ //gsi_insert_after ( &gsi, gcond, GSI_SAME_STMT);
gsi_insert_after ( &gsi, gcond, GSI_SAME_STMT);
// FROM gsi_insert_after( &gsi, "base.field = res")
tree lhs_ass =
@@ -469,7 +501,7 @@ str_reorg_instance_interleave_trans ( Info *info)
// The alternative to sizetype are long_integer_type_node
// and integer_type_node.
tree mem_size =
- make_temp_ssa_name( sizetype, NULL, "mem_size");
+ make_temp_ssa_name( sizetype, NULL, "malloc_mem_size");
gcall *malloc_call = gimple_build_call( fndecl_malloc, 1, mem_size);
gimple_call_set_lhs( malloc_call, res);
gsi_insert_after( &gsi, malloc_call, GSI_SAME_STMT);
@@ -480,12 +512,13 @@ str_reorg_instance_interleave_trans ( Info *info)
gimple *gsize =
gimple_build_assign ( mem_size,
MULT_EXPR,
- TYPE_SIZE ( field),
+ TYPE_SIZE ( TREE_TYPE ( field)),
len);
gsi_insert_after( &gsi, gsize, GSI_SAME_STMT);
- // FROM gsi_insert_after( &gsi, prev_ok_field)
- gimple *gprev_ok_field = gimple_build_label ( prev_ok_field_L);
- gsi_insert_after ( &gsi, gprev_ok_field, GSI_SAME_STMT);
+ // Moved label to top
+ //// FROM gsi_insert_after( &gsi, prev_ok_field)
+ //gimple *gprev_ok_field = gimple_build_label ( prev_ok_field_L);
+ //gsi_insert_after ( &gsi, gprev_ok_field, GSI_SAME_STMT);
// FROM prev_bb = new_bb
prev_bb = new_bb;
// FROM prev_order = new_bb
@@ -499,8 +532,10 @@ str_reorg_instance_interleave_trans ( Info *info)
// FROM success_bb = create_empty_block(prev_bb_order);
basic_block success_bb = create_empty_bb ( prev_bb);
// FROM set imm dom success_bb as prev_bb
- set_immediate_dominator ( CDI_DOMINATORS, success_bb, prev_bb);
+ // TBD let's punt of the dominators for a bit
+ //set_immediate_dominator ( CDI_DOMINATORS, success_bb, prev_bb);
// FROM make_edge( prev_bb, success_bb, EDGE_TRUE_VALUE);
+ // TBD set edge probability and flags
make_edge ( prev_bb, success_bb, EDGE_TRUE_VALUE);
// FROM make_edge( success_bb, after_bb, EDGE_TRUE_VALUE);
edge success_edge = make_edge ( success_bb, after_bb, EDGE_TRUE_VALUE);
@@ -509,24 +544,26 @@ str_reorg_instance_interleave_trans ( Info *info)
//
// FROM success_val is new SSA
tree success_val =
- make_temp_ssa_name( reorg_pointer_type, NULL, "success_val");
+ make_temp_ssa_name( reorg_pointer_type, NULL, "malloc_success_val");
// FROM gsi = gsi_start_bb( failure_bb)
// Reuse the same gsi??? Or create a new one???
//gimple_stmt_iterator gsi = gsi_start_bb ( failure_bb);
gsi = gsi_start_bb ( success_bb); // used to be failure_bb
// FROM gsi_insert_after( &gsi, "goto after_label")
- // Reuse goto_al
//gimple *goto_al = gimple_build_goto( after_label_L);
- goto_al = gimple_build_goto( after_label_L);
- gsi_insert_after( &gsi, goto_al, GSI_SAME_STMT);
+ // Emit the label first and then everything else after it
+ gimple *gnew_ok_field = gimple_build_label ( new_ok_field_L);
+ gsi_insert_after ( &gsi, gnew_ok_field, GSI_NEW_STMT);
+ gimple *goto_al_succ = gimple_build_goto( after_label_L);
+ gsi_insert_after( &gsi, goto_al_succ, GSI_SAME_STMT);
// FROM gsi_insert_after( &gsi, "success_val = 0")
gimple *set_succ =
gimple_build_assign ( success_val,
build_int_cst ( reorg_pointer_type, 0));
gsi_insert_after( &gsi, set_succ, GSI_SAME_STMT);
// 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);
+ //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
//
@@ -534,15 +571,83 @@ str_reorg_instance_interleave_trans ( Info *info)
// Reuse gsi
//gimple_stmt_iterator gsi = gsi_start_bb( after_bb);
gsi = gsi_start_bb( after_bb);
+
+ // put the label first
+ // FROM gsi_insert_after( &gsi, after_label)
+ gimple *gafter_label = gimple_build_label( after_label_L);
+ gsi_insert_after( &gsi, gafter_label, GSI_NEW_STMT);
+
// FROM gsi_insert_after( &gsi, "lhs = "phi(success_val, fail_val)
gphi *der_phi = create_phi_node( val, after_bb); // was lhs?? instead of val
add_phi_arg( der_phi, success_val, success_edge, UNKNOWN_LOCATION);
add_phi_arg( der_phi, fail_val, failure_edge, UNKNOWN_LOCATION);
gsi_insert_after( &gsi, der_phi, GSI_SAME_STMT);
- // FROM gsi_insert_after( &gsi, after_label)
- gimple *gafter_label = gimple_build_label( after_label_L);
- gsi_insert_after( &gsi, gafter_label, GSI_SAME_STMT);
+ //// FROM gsi_insert_after( &gsi, after_label)
+ //gimple *gafter_label = gimple_build_label( after_label_L);
+ //gsi_insert_after( &gsi, gafter_label, GSI_SAME_STMT);
+
+
+ // Try failure_bb code here
+ #if 1
+ // if defed on here... moved this
+ // code in failure_bb
+ //
+ // FROM fail_val is new SSA
+ //tree return_type = TREE_TYPE ( arg);
+ //tree fail_val =
+ // make_temp_ssa_name ( return_type, NULL, "fail_val");
+ // FROM gsi = gsi_start_bb ( failure_bb)
+ gsi = gsi_start_bb ( failure_bb);
+
+ // Put the label first
+ // FROM gsi_insert_after( &gsi, bad_field )
+ gimple *gbad_field = gimple_build_label( bad_field_L);
+ gsi_insert_after( &gsi, gbad_field, GSI_NEW_STMT);
+
+ // FROM gsi_insert_after ( &gsi, "goto after_label")
+ gimple *goto_al = gimple_build_goto ( after_label_L);
+ gsi_insert_after ( &gsi, goto_al, GSI_SAME_STMT);
+ // (per field) {
+ //tree field; // defined above
+ //tree reorg_type = ri->gcc_type; // is this useful here?
+ //tree reorg_pointer_type = ri->pointer_rep;
+ tree fndecl_free = builtin_decl_explicit( BUILT_IN_FREE);
+ //tree base = ri->clone;
+ for( field = TYPE_FIELDS( reorg_type);
+ field;
+ field = DECL_CHAIN( field)) {
+ // FROM gsi_insert_after( &gsi, "base.field = 0")
+ tree lhs_ass =
+ build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
+ gimple *gzero = gimple_build_assign( lhs_ass, null_pointer_node);
+ gsi_insert_after( &gsi, gzero, GSI_SAME_STMT);
+
+ // FROM gsi_insert_after( &gsi, "free(field)")
+ // TBD -- I'm
+ tree to_free =
+ make_temp_ssa_name( reorg_pointer_type, NULL, "malloc_to_free");
+ gcall *free_call = gimple_build_call( fndecl_free, 1, to_free);
+ gsi_insert_after( &gsi, free_call, GSI_SAME_STMT);
+ tree rhs_ass =
+ build3( COMPONENT_REF, ptr_type_node, base, field, NULL_TREE);
+ gimple *gaddr2free = gimple_build_assign( to_free, rhs_ass);
+ gsi_insert_after( &gsi, gaddr2free, GSI_SAME_STMT);
+ }
+ // FROM gsi_insert_after( &gsi, "fail_val = minint")
+ gimple *gretnull =
+ gimple_build_assign ( fail_val,
+ //build_int_cst ( size_type_node,
+ TYPE_MIN_VALUE ( TREE_TYPE ( fail_val))); // );
+ gsi_insert_after( &gsi, gretnull, GSI_SAME_STMT);
+
+ //// FROM gsi_insert_after( &gsi, bad_field )
+ //gimple *gbad_field = gimple_build_label( bad_field_L);
+ //gsi_insert_after( &gsi, gbad_field, GSI_SAME_STMT);
+ #endif
+
+ DEBUG_L("End of malloc:\n");
+ DEBUG_F( print_program, stderr, 4);
}
#endif
INDENT(-2);
@@ -859,6 +964,9 @@ create_a_new_type ( Info_t *info, tree type)
strcat ( name, gcc_name);
TYPE_NAME ( pointer_rep) = get_identifier ( name);
ri->pointer_rep = pointer_rep;
+ DEBUG_L("pointer_rep = ");
+ DEBUG_F( print_generic_expr, stderr, pointer_rep, (dump_flags_t)-1);
+ DEBUG("\n");
// TBD ! Some of the key bits from above seem to be missing below.
// Specifically make_node for the base type, setting the base (clone)
diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c
index 50a52f75c49..3e59bd38b1e 100644
--- a/gcc/ipa-structure-reorg.c
+++ b/gcc/ipa-structure-reorg.c
@@ -50,7 +50,9 @@ static void final_debug_info ( Info *);
static unsigned int reorg_analysis ( Info *);
static void reorg_analysis_debug ( Info *, ReorgType *);
static bool find_decls_and_types ( Info *);
-//static void add_reorg_type( tree, Info *);
+#if USE_REORG_TYPES
+static void add_reorg_type( tree, Info *);
+#endif
static void disqualify_struct_in_struct_or_union ( Info *);
static void initial_reorg_debug ( Info *, ReorgType *reorg );
static void disqualify_struct_in_struct_or_union_debug ( Info *,
@@ -86,7 +88,7 @@ static void print_reorgs ( FILE *, int, Info *);
//static void print_reorg ( FILE *, int, ReorgType_t *);
static void print_progdecls ( FILE *, int, Info *);
static void print_progdecl ( FILE *, int, ProgDecl_t *);
-static void print_program ( FILE *, int);
+//static void print_program ( FILE *, int);
static void print_function ( FILE *, int, function *);
static ReorgType_t *get_reorgtype( gimple *stmt, Info *, int);
static int num_reorgtypes( gimple *, Info *);
@@ -94,7 +96,7 @@ static bool uses_field_of_reorgtypes( gimple *, Info *);
//-- debugging only --
#if DEBUGGING
-static const char *code_str( enum tree_code);
+//static const char *code_str( enum tree_code);
static const char *type_name_to_str( tree);
//static void handle_debug_indenting( int);
int debug_indenting = 0;
@@ -229,6 +231,7 @@ reorg_analysis ( Info *info)
// specified since I am not sure what this function should
// concretely do.
// Eric this is not really helping me... ;-)
+ DEBUG_L("reorg_analysis: entered\n");
#if INTEGRATION_FUNCTIONAL
const bool run_escape_analysis = flag_ipa_dead_field_eliminate && !flag_ipa_instance_interleave && !flag_ipa_field_reorder;
if (run_escape_analysis)
@@ -260,9 +263,10 @@ reorg_analysis ( Info *info)
// This is a work around
if ( func == NULL )
{
- //DEBUG_L("tripped work around\n");
+ //DEBUG_L(" tripped work around\n");
continue;
- }
+ }
+ //DEBUG_L(" bypassed work around\n");
// Note,there is a major design issue with the design of this code.
// This can stand as is for now but it must be fixed relatively soon.
@@ -360,6 +364,8 @@ reorg_analysis_debug ( Info *info, ReorgType *reorg )
static bool find_decls_and_types ( Info *info)
{
+ 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
// hopefully will have an associated allocation.)
@@ -371,6 +377,7 @@ static bool find_decls_and_types ( Info *info)
// Find all struct types for initial ReorgTypes
// marking them all to initially be deleted.
// This is done by walking all variables.
+
std::set<tree> typeset;
varpool_node *var;
FOR_EACH_VARIABLE ( var)
@@ -398,7 +405,9 @@ static bool find_decls_and_types ( Info *info)
;
}
- //add_reorg_type ( base, info);
+ #if USE_REORG_TYPES
+ add_reorg_type ( base, info);
+ #endif
typeset.insert ( base); // ???
}
}
@@ -418,10 +427,10 @@ static bool find_decls_and_types ( Info *info)
struct function *fn = DECL_STRUCT_FUNCTION ( node->decl);
// enable this to see error in test_1_8. Note, not a bug...
- //DEBUG_L( "function name = %s\n", lang_hooks.decl_printable_name ( node->decl, 2));
+ DEBUG_L( " function name = %s\n", lang_hooks.decl_printable_name ( node->decl, 2));
if ( fn == NULL )
{
- //DEBUG( " EMPTY\n");
+ DEBUG_L( " EMPTY\n");
continue;
}
@@ -442,7 +451,9 @@ static bool find_decls_and_types ( Info *info)
continue;
}
- //add_reorg_type ( base, info);
+ #if USE_REORG_TYPES
+ add_reorg_type ( base, info);
+ #endif
typeset.insert ( base); // ???
}
}
@@ -685,7 +696,7 @@ static bool find_decls_and_types ( Info *info)
return true;
}
-/*
+#if USE_REORG_TYPES
static void
add_reorg_type ( tree base, Info *info)
{
@@ -698,7 +709,7 @@ add_reorg_type ( tree base, Info *info)
// and is marked to be deleted.
info->num_deleted++;
}
-*/
+#endif
void
disqualify_struct_in_struct_or_union ( Info *info)
@@ -1487,6 +1498,9 @@ is_reorg_type( tree rt, Info *info )
tree
base_type_of ( tree type)
{
+ //DEBUG_L("base_type_of: ");
+ //DEBUG_F( print_generic_expr, stderr, type, TDF_DETAILS);
+ //DEBUG("\n");
for ( ; POINTER_TYPE_P ( type) ||
TREE_CODE ( type) == ARRAY_TYPE ||
TREE_CODE ( type) == VAR_DECL ||
@@ -1627,6 +1641,10 @@ detect_reorg ( tree *tp, int *dummy, void *data)
ReorgType_t *
contains_a_reorgtype ( gimple *stmt, Info *info)
{
+ //DEBUG_L ( "contains_a_reorgtype: ");
+ //DEBUG_F ( print_gimple_stmt, stderr, stmt, 0);
+ //INDENT(2);
+
// Note walk_stmt_info is compilcated, use it's info
// field for hidden_info
hidden_info_t hi = { NULL, info };
@@ -1636,6 +1654,7 @@ contains_a_reorgtype ( gimple *stmt, Info *info)
walk_gimple_op ( stmt,
detect_reorg,
&walk_info);
+ //INDENT(-2);
return hi.found_reorg;
}
@@ -1736,7 +1755,7 @@ print_progdecl ( FILE *file, int leading_space, ProgDecl_t *progdecl )
fprintf ( file, "\n");
}
-static void
+void
print_program ( FILE *file, int leading_space )
{
struct cgraph_node *node;
@@ -1806,7 +1825,9 @@ uses_field_of_reorgtypes( gimple *stmt, Info * info)
}
//-- debugging only --
-static const char *
+//static const char *
+#if DEBUGGING
+const char *
code_str( enum tree_code tc)
{
switch ( tc )
@@ -1852,6 +1873,7 @@ code_str( enum tree_code tc)
}
}
}
+#endif
const char *
type_name_to_str ( tree tn)
diff --git a/gcc/ipa-structure-reorg.h b/gcc/ipa-structure-reorg.h
index 75aa8f385c1..818d0f4dc62 100644
--- a/gcc/ipa-structure-reorg.h
+++ b/gcc/ipa-structure-reorg.h
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#define INTEGRATION_FUNCTIONAL 0
// Erick this is when you do something that really steps on some toes
#define KLUDGE 1
+#define USE_REORG_TYPES 1
typedef struct RT_Elim RT_Elim;
typedef struct RT_Reorder RT_Reorder;
@@ -225,6 +226,7 @@ extern ReorgType_t *contains_a_reorgtype ( gimple *, Info *);
extern bool is_reorg_type ( tree, Info_t *);
extern tree base_type_of ( tree);
extern void print_reorg ( FILE *, int, ReorgType_t *);
+extern void print_program ( FILE *, int);
extern void print_type ( FILE *, tree);
//#define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -237,6 +239,7 @@ extern void print_type ( FILE *, tree);
#if DEBUGGING
extern int debug_indenting;
extern void handle_debug_indenting( int);
+extern const char *code_str( enum tree_code);
// Line numbered
#define DEBUG_L(...) { fprintf( stderr, "L# %4d: %*s", __LINE__, debug_indenting, ""); fprintf( stderr, __VA_ARGS__); }