summaryrefslogtreecommitdiff
path: root/gcc/gimple-low.c
diff options
context:
space:
mode:
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-02 13:19:29 +0000
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-02 13:19:29 +0000
commit0d9585ca35b919263b973afb371f0eda04857159 (patch)
tree375ad6b99eeeb983ea0bb3b3219f6c281da0b899 /gcc/gimple-low.c
parent6da7e1105569fc756baf51b0b4bd53eda8e2b338 (diff)
downloadgcc-0d9585ca35b919263b973afb371f0eda04857159.tar.gz
* tree-flow.h: Include new .h files. Move prototypes.
* tree-cfgcleanup.h: New file. Add prototypes from tree-flow.h. * tree-dfa.h: New File. Add prototypes from tree-flow.h. (get_addr_base_and_unit_offset_1) Move from tree-flow-inline.h. * tree-pretty-print.h: Add prototypes from tree-flow.h. * tree-into-ssa.h: New File. Add prototypes from tree-flow.h. ({debug|dump}*): Move debugging prototypes out of tree-into-ssa.c. * tree-into-ssa.c ({debug|dump}*): Move prototypes to header file. * tree.h (get_ref_base_and_extent): Move prototype out. * tree-flow-inline.h (get_addr_base_and_unit_offset_1): Move to tree-dfa.h. * gimple-low.h: New File. Add prototypes from tree-flow.h. * gimple-low.c (try_catch_may_fallthru, block_may_fallthru): Move to... * tree.c (try_catch_may_fallthru, block_may_fallthru): Here. * tree-scalar-evolution.c: Include tree.h. * sese.c: Include tree.h. * dumpfile.c: Move gimple-pretty-print.h include after tree.h. * dwarf2out.c: Include tree-dfa.h. * tree-chrec.c: Include tree.h. * tree-data-ref.c: Include tree.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203113 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r--gcc/gimple-low.c126
1 files changed, 2 insertions, 124 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index cf6bac2b35e..8e083aeb4d7 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -598,56 +598,9 @@ lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
gsi_next (gsi);
}
-/* Try to determine whether a TRY_CATCH expression can fall through.
- This is a subroutine of block_may_fallthru. */
-
-static bool
-try_catch_may_fallthru (const_tree stmt)
-{
- tree_stmt_iterator i;
-
- /* If the TRY block can fall through, the whole TRY_CATCH can
- fall through. */
- if (block_may_fallthru (TREE_OPERAND (stmt, 0)))
- return true;
-
- i = tsi_start (TREE_OPERAND (stmt, 1));
- switch (TREE_CODE (tsi_stmt (i)))
- {
- case CATCH_EXPR:
- /* We expect to see a sequence of CATCH_EXPR trees, each with a
- catch expression and a body. The whole TRY_CATCH may fall
- through iff any of the catch bodies falls through. */
- for (; !tsi_end_p (i); tsi_next (&i))
- {
- if (block_may_fallthru (CATCH_BODY (tsi_stmt (i))))
- return true;
- }
- return false;
-
- case EH_FILTER_EXPR:
- /* The exception filter expression only matters if there is an
- exception. If the exception does not match EH_FILTER_TYPES,
- we will execute EH_FILTER_FAILURE, and we will fall through
- if that falls through. If the exception does match
- EH_FILTER_TYPES, the stack unwinder will continue up the
- stack, so we will not fall through. We don't know whether we
- will throw an exception which matches EH_FILTER_TYPES or not,
- so we just ignore EH_FILTER_TYPES and assume that we might
- throw an exception which doesn't match. */
- return block_may_fallthru (EH_FILTER_FAILURE (tsi_stmt (i)));
- default:
- /* This case represents statements to be executed when an
- exception occurs. Those statements are implicitly followed
- by a RESX statement to resume execution after the exception.
- So in this case the TRY_CATCH never falls through. */
- return false;
- }
-}
-
-
-/* Same as above, but for a GIMPLE_TRY_CATCH. */
+/* Try to determine whether a TRY_CATCH expression can fall through.
+ This is a subroutine of gimple_stmt_may_fallthru. */
static bool
gimple_try_catch_may_fallthru (gimple stmt)
@@ -698,81 +651,6 @@ gimple_try_catch_may_fallthru (gimple stmt)
}
-/* Try to determine if we can fall out of the bottom of BLOCK. This guess
- need not be 100% accurate; simply be conservative and return true if we
- don't know. This is used only to avoid stupidly generating extra code.
- If we're wrong, we'll just delete the extra code later. */
-
-bool
-block_may_fallthru (const_tree block)
-{
- /* This CONST_CAST is okay because expr_last returns its argument
- unmodified and we assign it to a const_tree. */
- const_tree stmt = expr_last (CONST_CAST_TREE (block));
-
- switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
- {
- case GOTO_EXPR:
- case RETURN_EXPR:
- /* Easy cases. If the last statement of the block implies
- control transfer, then we can't fall through. */
- return false;
-
- case SWITCH_EXPR:
- /* If SWITCH_LABELS is set, this is lowered, and represents a
- branch to a selected label and hence can not fall through.
- Otherwise SWITCH_BODY is set, and the switch can fall
- through. */
- return SWITCH_LABELS (stmt) == NULL_TREE;
-
- case COND_EXPR:
- if (block_may_fallthru (COND_EXPR_THEN (stmt)))
- return true;
- return block_may_fallthru (COND_EXPR_ELSE (stmt));
-
- case BIND_EXPR:
- return block_may_fallthru (BIND_EXPR_BODY (stmt));
-
- case TRY_CATCH_EXPR:
- return try_catch_may_fallthru (stmt);
-
- case TRY_FINALLY_EXPR:
- /* The finally clause is always executed after the try clause,
- so if it does not fall through, then the try-finally will not
- fall through. Otherwise, if the try clause does not fall
- through, then when the finally clause falls through it will
- resume execution wherever the try clause was going. So the
- whole try-finally will only fall through if both the try
- clause and the finally clause fall through. */
- return (block_may_fallthru (TREE_OPERAND (stmt, 0))
- && block_may_fallthru (TREE_OPERAND (stmt, 1)));
-
- case MODIFY_EXPR:
- if (TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR)
- stmt = TREE_OPERAND (stmt, 1);
- else
- return true;
- /* FALLTHRU */
-
- case CALL_EXPR:
- /* Functions that do not return do not fall through. */
- return (call_expr_flags (stmt) & ECF_NORETURN) == 0;
-
- case CLEANUP_POINT_EXPR:
- return block_may_fallthru (TREE_OPERAND (stmt, 0));
-
- case TARGET_EXPR:
- return block_may_fallthru (TREE_OPERAND (stmt, 1));
-
- case ERROR_MARK:
- return true;
-
- default:
- return lang_hooks.block_may_fallthru (stmt);
- }
-}
-
-
/* Try to determine if we can continue executing the statement
immediately following STMT. This guess need not be 100% accurate;
simply be conservative and return true if we don't know. This is