Commit 1802378d by Eric Botcazou Committed by Eric Botcazou

re PR tree-optimization/45612 (Reference to undefined label building libada on Solaris 2/SPARC)

	PR tree-optimization/45612
	* ipa-split.c (test_nonssa_use): Remove bogus ATTRIBUTE_UNUSED.
	Test LABEL_DECLs as well.  Fix formatting issues.
	(verify_non_ssa_vars): Return false for a GIMPLE_LABEL statement
	whose label is present in NON_SSA_VARS.
	(mark_nonssa_use): Remove bogus ATTRIBUTE_UNUSED.  Handle LABEL_DECLs
	as well.  Fix formatting issues.
	(visit_bb): Fix typos and formatting issue.

From-SVN: r165221
parent 64978ba3
2010-10-09 Eric Botcazou <ebotcazou@adacore.com>
PR tree-optimization/45612
* ipa-split.c (test_nonssa_use): Remove bogus ATTRIBUTE_UNUSED.
Test LABEL_DECLs as well. Fix formatting issues.
(verify_non_ssa_vars): Return false for a GIMPLE_LABEL statement
whose label is present in NON_SSA_VARS.
(mark_nonssa_use): Remove bogus ATTRIBUTE_UNUSED. Handle LABEL_DECLs
as well. Fix formatting issues.
(visit_bb): Fix typos and formatting issue.
2010-10-09 Nathan Froyd <froydnj@codesourcery.com> 2010-10-09 Nathan Froyd <froydnj@codesourcery.com>
PR tree-optimization/45950 PR tree-optimization/45950
...@@ -132,29 +132,34 @@ struct split_point best_split_point; ...@@ -132,29 +132,34 @@ struct split_point best_split_point;
static tree find_retval (basic_block return_bb); static tree find_retval (basic_block return_bb);
/* Callback for walk_stmt_load_store_addr_ops. If T is non-ssa automatic /* Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic
variable, check it if it is present in bitmap passed via DATA. */ variable, check it if it is present in bitmap passed via DATA. */
static bool static bool
test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data)
void *data ATTRIBUTE_UNUSED)
{ {
t = get_base_address (t); t = get_base_address (t);
if (t && !is_gimple_reg (t) if (!t || is_gimple_reg (t))
&& ((TREE_CODE (t) == VAR_DECL return false;
if (TREE_CODE (t) == PARM_DECL
|| (TREE_CODE (t) == VAR_DECL
&& auto_var_in_fn_p (t, current_function_decl)) && auto_var_in_fn_p (t, current_function_decl))
|| (TREE_CODE (t) == RESULT_DECL) || TREE_CODE (t) == RESULT_DECL
|| (TREE_CODE (t) == PARM_DECL))) || TREE_CODE (t) == LABEL_DECL)
return bitmap_bit_p ((bitmap)data, DECL_UID (t)); return bitmap_bit_p ((bitmap)data, DECL_UID (t));
/* For DECL_BY_REFERENCE, the return value is actually pointer. We want to pretend /* For DECL_BY_REFERENCE, the return value is actually a pointer. We want
that the value pointed to is actual result decl. */ to pretend that the value pointed to is actual result decl. */
if (t && (TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t)) if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t))
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
&& TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL
&& DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))) && DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
return bitmap_bit_p ((bitmap)data, DECL_UID (DECL_RESULT (current_function_decl))); return
bitmap_bit_p ((bitmap)data,
DECL_UID (DECL_RESULT (current_function_decl)));
return false; return false;
} }
...@@ -173,8 +178,8 @@ dump_split_point (FILE * file, struct split_point *current) ...@@ -173,8 +178,8 @@ dump_split_point (FILE * file, struct split_point *current)
dump_bitmap (file, current->ssa_names_to_pass); dump_bitmap (file, current->ssa_names_to_pass);
} }
/* Look for all BBs in header that might lead to split part and verify that /* Look for all BBs in header that might lead to the split part and verify
they are not defining any of SSA vars used by split part. that they are not defining any non-SSA var used by the split part.
Parameters are the same as for consider_split. */ Parameters are the same as for consider_split. */
static bool static bool
...@@ -210,11 +215,19 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars, ...@@ -210,11 +215,19 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
} }
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{ {
if (is_gimple_debug (gsi_stmt (bsi))) gimple stmt = gsi_stmt (bsi);
if (is_gimple_debug (stmt))
continue; continue;
if (walk_stmt_load_store_addr_ops if (walk_stmt_load_store_addr_ops
(gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, (stmt, non_ssa_vars, test_nonssa_use, test_nonssa_use,
test_nonssa_use, test_nonssa_use)) test_nonssa_use))
{
ok = false;
goto done;
}
if (gimple_code (stmt) == GIMPLE_LABEL
&& test_nonssa_use (stmt, gimple_label_label (stmt),
non_ssa_vars))
{ {
ok = false; ok = false;
goto done; goto done;
...@@ -223,8 +236,8 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars, ...@@ -223,8 +236,8 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{ {
if (walk_stmt_load_store_addr_ops if (walk_stmt_load_store_addr_ops
(gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, test_nonssa_use,
test_nonssa_use, test_nonssa_use)) test_nonssa_use))
{ {
ok = false; ok = false;
goto done; goto done;
...@@ -542,13 +555,12 @@ find_retval (basic_block return_bb) ...@@ -542,13 +555,12 @@ find_retval (basic_block return_bb)
return NULL; return NULL;
} }
/* Callback for walk_stmt_load_store_addr_ops. If T is non-ssa automatic /* Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic
variable, mark it as used in bitmap passed via DATA. variable, mark it as used in bitmap passed via DATA.
Return true when access to T prevents splitting the function. */ Return true when access to T prevents splitting the function. */
static bool static bool
mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data)
void *data ATTRIBUTE_UNUSED)
{ {
t = get_base_address (t); t = get_base_address (t);
...@@ -560,21 +572,27 @@ mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, ...@@ -560,21 +572,27 @@ mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t,
if (TREE_CODE (t) == PARM_DECL) if (TREE_CODE (t) == PARM_DECL)
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Can not split use of non-ssa function parameter.\n"); fprintf (dump_file,
"Cannot split: use of non-ssa function parameter.\n");
return true; return true;
} }
if ((TREE_CODE (t) == VAR_DECL && auto_var_in_fn_p (t, current_function_decl)) if ((TREE_CODE (t) == VAR_DECL
|| (TREE_CODE (t) == RESULT_DECL)) && auto_var_in_fn_p (t, current_function_decl))
|| TREE_CODE (t) == RESULT_DECL
|| TREE_CODE (t) == LABEL_DECL)
bitmap_set_bit ((bitmap)data, DECL_UID (t)); bitmap_set_bit ((bitmap)data, DECL_UID (t));
/* For DECL_BY_REFERENCE, the return value is actually pointer. We want to pretend /* For DECL_BY_REFERENCE, the return value is actually a pointer. We want
that the value pointed to is actual result decl. */ to pretend that the value pointed to is actual result decl. */
if (t && (TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t)) if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t))
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
&& TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL
&& DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))) && DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
return bitmap_bit_p ((bitmap)data, DECL_UID (DECL_RESULT (current_function_decl))); return
bitmap_bit_p ((bitmap)data,
DECL_UID (DECL_RESULT (current_function_decl)));
return false; return false;
} }
...@@ -617,13 +635,13 @@ visit_bb (basic_block bb, basic_block return_bb, ...@@ -617,13 +635,13 @@ visit_bb (basic_block bb, basic_block return_bb,
&& stmt_can_throw_external (stmt)) && stmt_can_throw_external (stmt))
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Can not split external resx.\n"); fprintf (dump_file, "Cannot split: external resx.\n");
can_split = false; can_split = false;
} }
if (gimple_code (stmt) == GIMPLE_EH_DISPATCH) if (gimple_code (stmt) == GIMPLE_EH_DISPATCH)
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Can not split eh dispatch.\n"); fprintf (dump_file, "Cannot split: eh dispatch.\n");
can_split = false; can_split = false;
} }
...@@ -642,12 +660,13 @@ visit_bb (basic_block bb, basic_block return_bb, ...@@ -642,12 +660,13 @@ visit_bb (basic_block bb, basic_block return_bb,
case BUILT_IN_APPLY: case BUILT_IN_APPLY:
case BUILT_IN_VA_START: case BUILT_IN_VA_START:
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Can not split builtin_apply and va_start.\n"); fprintf (dump_file,
"Cannot split: builtin_apply and va_start.\n");
can_split = false; can_split = false;
break; break;
case BUILT_IN_EH_POINTER: case BUILT_IN_EH_POINTER:
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Can not split builtin_eh_pointer.\n"); fprintf (dump_file, "Cannot split: builtin_eh_pointer.\n");
can_split = false; can_split = false;
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment