diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-09 12:15:31 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-09 12:15:31 +0000 |
commit | 2dc0a33e89b15b9d3c1eb07104f6d812210775f9 (patch) | |
tree | 54b0e306a9a4059e91a6c893c69b1893ec2efc72 /gcc/ipa-split.c | |
parent | dc7e8ee74d6bfb98e34619dc4877d95097fcc7d6 (diff) | |
download | gcc-2dc0a33e89b15b9d3c1eb07104f6d812210775f9.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165221 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r-- | gcc/ipa-split.c | 89 |
1 files changed, 54 insertions, 35 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 56f689babf3..23882b2f8a6 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -132,29 +132,34 @@ struct split_point best_split_point; 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. */ static bool -test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, - void *data ATTRIBUTE_UNUSED) +test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data) { t = get_base_address (t); - if (t && !is_gimple_reg (t) - && ((TREE_CODE (t) == VAR_DECL + if (!t || is_gimple_reg (t)) + return false; + + if (TREE_CODE (t) == PARM_DECL + || (TREE_CODE (t) == VAR_DECL && auto_var_in_fn_p (t, current_function_decl)) - || (TREE_CODE (t) == RESULT_DECL) - || (TREE_CODE (t) == PARM_DECL))) + || TREE_CODE (t) == RESULT_DECL + || TREE_CODE (t) == LABEL_DECL) return bitmap_bit_p ((bitmap)data, DECL_UID (t)); - /* For DECL_BY_REFERENCE, the return value is actually pointer. We want to pretend - that the value pointed to is actual result decl. */ - if (t && (TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t)) + /* For DECL_BY_REFERENCE, the return value is actually a pointer. We want + to pretend that the value pointed to is actual result decl. */ + if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t)) && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_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; } @@ -173,8 +178,8 @@ dump_split_point (FILE * file, struct split_point *current) dump_bitmap (file, current->ssa_names_to_pass); } -/* Look for all BBs in header that might lead to split part and verify that - they are not defining any of SSA vars used by split part. +/* Look for all BBs in header that might lead to the split part and verify + that they are not defining any non-SSA var used by the split part. Parameters are the same as for consider_split. */ static bool @@ -186,7 +191,7 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars, edge e; edge_iterator ei; bool ok = true; - + FOR_EACH_EDGE (e, ei, current->entry_bb->preds) if (e->src != ENTRY_BLOCK_PTR && !bitmap_bit_p (current->split_bbs, e->src->index)) @@ -194,7 +199,7 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars, VEC_safe_push (basic_block, heap, worklist, e->src); bitmap_set_bit (seen, e->src->index); } - + while (!VEC_empty (basic_block, worklist)) { gimple_stmt_iterator bsi; @@ -210,21 +215,29 @@ 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)) { - if (is_gimple_debug (gsi_stmt (bsi))) + gimple stmt = gsi_stmt (bsi); + if (is_gimple_debug (stmt)) continue; if (walk_stmt_load_store_addr_ops - (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, - test_nonssa_use, test_nonssa_use)) + (stmt, non_ssa_vars, 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; + goto done; + } } for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) { if (walk_stmt_load_store_addr_ops - (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, - test_nonssa_use, test_nonssa_use)) + (gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, test_nonssa_use, + test_nonssa_use)) { ok = false; goto done; @@ -542,13 +555,12 @@ find_retval (basic_block return_bb) return NULL; } -/* Callback for walk_stmt_load_store_addr_ops. If T is non-ssa automatic - variable, mark it as used in bitmap passed via DATA. +/* Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic + variable, mark it as used in bitmap passed via DATA. Return true when access to T prevents splitting the function. */ static bool -mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, - void *data ATTRIBUTE_UNUSED) +mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data) { t = get_base_address (t); @@ -560,21 +572,27 @@ mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, if (TREE_CODE (t) == PARM_DECL) { 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; } - if ((TREE_CODE (t) == VAR_DECL && auto_var_in_fn_p (t, current_function_decl)) - || (TREE_CODE (t) == RESULT_DECL)) + if ((TREE_CODE (t) == VAR_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)); - /* For DECL_BY_REFERENCE, the return value is actually pointer. We want to pretend - that the value pointed to is actual result decl. */ - if (t && (TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t)) + /* For DECL_BY_REFERENCE, the return value is actually a pointer. We want + to pretend that the value pointed to is actual result decl. */ + if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t)) && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_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; } @@ -617,13 +635,13 @@ visit_bb (basic_block bb, basic_block return_bb, && stmt_can_throw_external (stmt)) { 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; } if (gimple_code (stmt) == GIMPLE_EH_DISPATCH) { 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; } @@ -642,12 +660,13 @@ visit_bb (basic_block bb, basic_block return_bb, case BUILT_IN_APPLY: case BUILT_IN_VA_START: 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; break; case BUILT_IN_EH_POINTER: 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; break; default: |