diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-27 12:04:21 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-27 12:04:21 +0000 |
commit | 58287c3f4b74a0bb479c7036117d5804eb6765c4 (patch) | |
tree | c299b554740820453d3def4a8e59007a86edd7c7 /gcc/gimple-low.c | |
parent | db827453ce1b7f76552f8ba9a8d18e65d7bf8de8 (diff) | |
download | gcc-58287c3f4b74a0bb479c7036117d5804eb6765c4.tar.gz |
2012-11-26 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 193836 using svnmerge.py
**broken, gcc/melt/xtramelt-ana-base.melt dont compile**
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@193843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r-- | gcc/gimple-low.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 8557c83c3c5..282dba187c3 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "diagnostic-core.h" #include "tree-pass.h" +#include "langhooks.h" /* The differences between High GIMPLE and Low GIMPLE are the following: @@ -55,8 +56,6 @@ struct return_statements_t }; typedef struct return_statements_t return_statements_t; -DEF_VEC_O(return_statements_t); -DEF_VEC_ALLOC_O(return_statements_t,heap); struct lower_data { @@ -65,7 +64,7 @@ struct lower_data /* A vector of label and return statements to be moved to the end of the function. */ - VEC(return_statements_t,heap) *return_statements; + vec<return_statements_t> return_statements; /* True if the current statement cannot fall through. */ bool cannot_fallthru; @@ -105,7 +104,7 @@ lower_function_body (void) BLOCK_SUBBLOCKS (data.block) = NULL_TREE; BLOCK_CHAIN (data.block) = NULL_TREE; TREE_ASM_WRITTEN (data.block) = 1; - data.return_statements = VEC_alloc (return_statements_t, heap, 8); + data.return_statements.create (8); bind = gimple_seq_first_stmt (body); lowered_body = NULL; @@ -119,9 +118,8 @@ lower_function_body (void) If we've already got one in the return_statements vector, we don't need to do anything special. Otherwise build one by hand. */ if (gimple_seq_may_fallthru (lowered_body) - && (VEC_empty (return_statements_t, data.return_statements) - || gimple_return_retval (VEC_last (return_statements_t, - data.return_statements).stmt) != NULL)) + && (data.return_statements.is_empty () + || gimple_return_retval (data.return_statements.last().stmt) != NULL)) { x = gimple_build_return (NULL); gimple_set_location (x, cfun->function_end_locus); @@ -131,18 +129,9 @@ lower_function_body (void) /* If we lowered any return statements, emit the representative at the end of the function. */ - while (!VEC_empty (return_statements_t, data.return_statements)) + while (!data.return_statements.is_empty ()) { - return_statements_t t; - - /* Unfortunately, we can't use VEC_pop because it returns void for - objects. */ - t = VEC_last (return_statements_t, data.return_statements); - VEC_truncate (return_statements_t, - data.return_statements, - VEC_length (return_statements_t, - data.return_statements) - 1); - + return_statements_t t = data.return_statements.pop (); x = gimple_build_label (t.label); gsi_insert_after (&i, x, GSI_CONTINUE_LINKING); gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING); @@ -185,7 +174,7 @@ lower_function_body (void) = blocks_nreverse (BLOCK_SUBBLOCKS (data.block)); clear_block_marks (data.block); - VEC_free(return_statements_t, heap, data.return_statements); + data.return_statements.release (); return 0; } @@ -751,8 +740,14 @@ block_may_fallthru (const_tree block) case CLEANUP_POINT_EXPR: return block_may_fallthru (TREE_OPERAND (stmt, 0)); - default: + case TARGET_EXPR: + return block_may_fallthru (TREE_OPERAND (stmt, 1)); + + case ERROR_MARK: return true; + + default: + return lang_hooks.block_may_fallthru (stmt); } } @@ -841,10 +836,10 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data) return_statements_t tmp_rs; /* Match this up with an existing return statement that's been created. */ - for (i = VEC_length (return_statements_t, data->return_statements) - 1; + for (i = data->return_statements.length () - 1; i >= 0; i--) { - tmp_rs = VEC_index (return_statements_t, data->return_statements, i); + tmp_rs = data->return_statements[i]; if (gimple_return_retval (stmt) == gimple_return_retval (tmp_rs.stmt)) { @@ -860,7 +855,7 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data) /* Not found. Create a new label and record the return statement. */ tmp_rs.label = create_artificial_label (cfun->function_end_locus); tmp_rs.stmt = stmt; - VEC_safe_push (return_statements_t, heap, data->return_statements, tmp_rs); + data->return_statements.safe_push (tmp_rs); /* Generate a goto statement and remove the return statement. */ found: |