summaryrefslogtreecommitdiff
path: root/gcc/ipa-structure-reorg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-structure-reorg.c')
-rw-r--r--gcc/ipa-structure-reorg.c95
1 files changed, 74 insertions, 21 deletions
diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c
index 13b8749ee12..b8a89d6fe1f 100644
--- a/gcc/ipa-structure-reorg.c
+++ b/gcc/ipa-structure-reorg.c
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
@@ -68,7 +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 void modify_decl_core ( tree *, Info *);
+//static void modify_decl_core ( tree *, Info *);
static void reorg_forbidden ( gimple *, Info *);
// Name changed and moved to its own file
//static void reorg_transformation ( Info *);
@@ -136,7 +137,11 @@ ipa_structure_reorg ( void)
return true;
}
+ DEBUG_L("after reorg_analysis\n");
+
bool qualified = reorg_qualification(&info);
+ DEBUG_L("after reorg_qualification\n");
+
if ( qualified )
{
if ( flag_ipa_structure_reorg || flag_ipa_dead_field_eliminate )
@@ -156,6 +161,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");
}
if ( info.show_all_reorg_cands_in_detail )
@@ -165,6 +171,7 @@ ipa_structure_reorg ( void)
}
reorg_common_middle_code( &info); // ??? might not amount to anything
+ DEBUG_L("after reorg_common_middle_code\n");
if ( flag_ipa_structure_reorg || flag_ipa_dead_field_eliminate )
{
@@ -215,8 +222,8 @@ initial_debug_info ( Info *info)
{
if ( info->reorg_dump_file )
{
- print_program ( info->reorg_dump_file, PRINT_FORMAT, 0);
- }
+ print_program ( info->reorg_dump_file, PRINT_FORMAT, 0, info);
+ }
}
static void
@@ -224,8 +231,7 @@ final_debug_info ( Info *info)
{
if ( info->reorg_dump_file )
{
- print_program ( info->reorg_dump_file, PRINT_FORMAT, 0);
- wolf_fence ( info);
+ print_program ( info->reorg_dump_file, PRINT_FORMAT, 0, info);
}
}
@@ -652,6 +658,7 @@ static bool find_decls_and_types ( Info *info)
{
//DEBUG_L( "function: %s\n", lang_hooks.decl_printable_name ( node->decl, 2));
//INDENT(2);
+ #if !NEW_SSA_SCHEME
// local declarations
unsigned i;
tree decl;
@@ -669,7 +676,7 @@ static bool find_decls_and_types ( Info *info)
//DEBUG_F( print_progdecl, stderr, 2, &decl_info);
}
}
-
+
// parameter declarations
//DEBUG_L( "ProgDecl parameter declarations:\n");
tree parm;
@@ -692,6 +699,7 @@ static bool find_decls_and_types ( Info *info)
//DEBUG_A(" -- Added to ProgDecls\n");
}
}
+ #endif
//INDENT(-2);
}
//INDENT(-2);
@@ -1010,18 +1018,21 @@ modify_declarations ( Info *info)
// Note, do not relayout functions decls....
}
-static void
+// TBD Reading this I don't see how it actually works
+// correctly
+// Returns true if a modification occurred
+bool
modify_decl_core ( tree *location, Info *info)
{
- //DEBUG_L("before modify_decl_core");
- //DEBUG_F( print_generic_decl, stderr, *location, (dump_flags_t)0);
- //DEBUG("\n");
+ DEBUG_L("before modify_decl_core");
+ DEBUG_F( print_generic_decl, stderr, *location, (dump_flags_t)0);
+ DEBUG("\n");
tree type = *location;
tree base = base_type_of ( type);
ReorgType_t *ri = get_reorgtype_info ( base, info);
if ( ri == NULL )
{
- return;
+ return false;
}
// array case -- not doing non-dynamically
@@ -1035,20 +1046,21 @@ modify_decl_core ( tree *location, Info *info)
{
prev_type = type;
type = TREE_TYPE ( prev_type);
- //DEBUG_L( "prev_type: %p, type: %p\n", prev_type, 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)
{
- //DEBUG_L( "LEVEL ZERO\n");
+ DEBUG_L( "LEVEL ZERO\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);
}
else
{
- //DEBUG_L( "LEVEL > ZERO\n");
+ DEBUG_L( "LEVEL > ZERO\n");
gcc_assert(0);
}
@@ -1060,9 +1072,10 @@ modify_decl_core ( tree *location, Info *info)
relayout_decl ( *location);
- //DEBUG_L(" after modify_decl_core");
- //DEBUG_F( print_generic_decl, stderr, *location, (dump_flags_t)0);
- //DEBUG("\n");
+ DEBUG_L(" after modify_decl_core");
+ DEBUG_F( print_generic_decl, stderr, *location, (dump_flags_t)0);
+ DEBUG("\n");
+ return true;
}
void
@@ -1926,7 +1939,7 @@ print_progdecl ( FILE *file, int leading_space, ProgDecl_t *progdecl )
}
void
-print_program ( FILE *file, bool my_format, int leading_space )
+print_program ( FILE *file, bool my_format, int leading_space, Info_t *info)
{
struct cgraph_node *node;
fprintf ( file, "%*sProgram:\n", leading_space, "");
@@ -1955,6 +1968,9 @@ print_program ( FILE *file, bool my_format, int leading_space )
dump_function_to_file ( func->decl, file, (dump_flags_t)0);
}
}
+
+ DEBUG ("INTERNALS PRINT\n");
+ DEBUG_F (apply_to_all_gimple, print_internals, true, (void*)info);
}
static void
@@ -2111,17 +2127,54 @@ 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.
- if ( TYPE_P ( type))
+ 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);
+ DEBUG("\n");
+ DEBUG_A("TREE_TYPE(type): ");
+ DEBUG_F(print_generic_expr, stderr, TREE_TYPE(type), (dump_flags_t)0);
+ DEBUG("\n");
+ DEBUG_A("TYPE_MAIN_VARIANT(type) :");
+ DEBUG_F(print_generic_expr, stderr, TYPE_MAIN_VARIANT(type), (dump_flags_t)0);
+ DEBUG("\n");
+ DEBUG_A("ssa_defined_default_def_p(ssa_name) %s\n",
+ ssa_defined_default_def_p(ssa_name) ? "true" : "false");
+
+ #if 0
+ // Erick's suggestion
+ TREE_TYPE ( ssa_name) = type;
+ relayout_decl ( ssa_name); // only this breaks
+ #else
+ if ( TYPE_P ( type) )
{
- //DEBUG_L("modify_ssa_name_type TYPE_P true\n");
+ DEBUG_L("TYPE_P true\n");
+ gcc_assert ( TYPE_MAIN_VARIANT ( type));
TREE_TYPE ( ssa_name) = TYPE_MAIN_VARIANT ( type);
- SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, NULL_TREE);
+ if ( ssa_defined_default_def_p ( ssa_name) )
+ {
+ // Again this is what breaks (pretty-print) something
+ // about expecting an integer_type.
+ // Our _reorg_SP_ptr_type_type_t really is an integer
+ // type but it doesn't know it.
+ SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, TYPE_MAIN_VARIANT ( type));
+ }
+ else
+ {
+ // The following breaks defaults defs hence the check above.
+ SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, NULL_TREE);
+ }
}
else
{
+ DEBUG_L("TYPE_P false\n");
+ gcc_assert ( TREE_TYPE ( type));
TREE_TYPE ( ssa_name) = TREE_TYPE ( type);
SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, type);
}
+ #endif
}
//-- debugging only --