summaryrefslogtreecommitdiff
path: root/gcc/gimple-low.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-21 22:01:24 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-21 22:01:24 +0000
commitffde65b31066f17eef243be882bb89a6e19370aa (patch)
treeea876d041c0a63eefccdac5416a8678e75da4cfc /gcc/gimple-low.c
parenta8c7acc4db08ce7c8ac3ddcb943f9219e2893792 (diff)
downloadgcc-ffde65b31066f17eef243be882bb89a6e19370aa.tar.gz
[.]
2015-01-21 Basile Starynkevitch <basile@starynkevitch.net> {{merged with trunk -i.e. GCC5.0 in stage4- using svn merge -r209216:219879 svn+ssh://bstarynk@gcc.gnu.org/svn/gcc/trunk but should probably have used svn merge -r209216:219879 ^/trunk we don't use svnmerge.py anymore since our svn is version 1.8.10 }} VERY UNSTABLE 2015-01-20 Basile Starynkevitch <basile@starynkevitch.net> Move previous topdir ChangeLog.MELT to ChangeLog.MELT.2008-2014 [contrib/] 2015-01-21 Basile Starynkevitch <basile@starynkevitch.net> * MELT-Plugin-Makefile: Able to make upgrade-melt as a plugin. Works for GCC 5.0. Remove GCC 4.7 old stuff. Move previous contrib/ChangeLog.MELT to ChangeLog.MELT.2008-2014 [gcc/] 2015-01-21 Basile Starynkevitch <basile@starynkevitch.net> {{merged with trunk -i.e. GCC5.0 in stage4- using svn merge -r209216:219879 svn+ssh://bstarynk@gcc.gnu.org/svn/gcc/trunk but should probably have used svn merge -r209216:219879 ^/trunk **@@@ UNSTABLE since libmelt-ana-gimple.melt not compiling, but translator painfully bootstrapping!!@@@@ }} * toplev.c: Merged manually by keeping MELT extra stuff. * toplev.h: Likewise. * gengtype.c: Add "melt-runtime.h" in list, but merged with trunk. * melt-runtime.h (MELT_VERSION_STRING): Bump to "1.2-pre-merged". (meltgc_walk_gimple_seq): Remove. (gt_ggc_mx_gimple_statement_d): Same for GCC 4.9 & 5.0 * melt-runtime.cc: Update copyright year. (ggc_alloc_cleared_melt_valuevector_st, melt_resize_scangcvect): Call ggc_internal_cleared_alloc. (melt_val2passflag): Skip TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_verify_rtl_sharing for GCC 5.0. (meltgc_walkstmt_cb, meltgc_walktree_cb) (melt_tree_walk_frame_size, meltgc_walk_gimple_seq): Remove. (melt_gt_ggc_mx_gimple_seq_d): Call gt_ggc_mx_gimple_statement_base. * melt-build-script.tpl: Update copyright year. Don't symlink meltrunsup.h anymore. * melt-build-script.sh: Regenerate. * melt/warmelt-base.melt: Update copyright year. (valdesc_object, valdesc_mapobjects, valdesc_mapstrings) (valdesc_multiple, valdesc_closure, valdesc_routine, valdesc_hook) (valdesc_bucketlongs, valdesc_jsonobject, valdesc_string) (valdesc_strbuf, valdesc_pair, valdesc_list, valdesc_int) (valdesc_double, valdesc_mixint, valdesc_mixloc) (valdesc_mixbigint, valdesc_real, valdesc_special_data): Use ggc_internal_alloc & ggc_internal_cleared_alloc for GCC 5.0. (json_canonical_name): Use ISUPPER, ISALPHA, TOUPPER instead of their standard <ctype.h> lowercase macros. * melt/warmelt-modes.melt: Update copyright year. (generate_runtypesupport_forwcopy_fun): Emit both GCC 4.9 & 5.0 compatible code. * melt/libmelt-ana-base.melt: Update copyright year. * melt/libmelt-ana-gimple.melt: TO BE IMPROVED * melt/generated/*: Painfully regenerated several times thru GCC 4.9 MELT plugin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@219975 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r--gcc/gimple-low.c80
1 files changed, 57 insertions, 23 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index da3fb9fb35e..7ae1330eafe 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -1,6 +1,6 @@
/* GIMPLE lowering pass. Converts High GIMPLE into Low GIMPLE.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of GCC.
@@ -22,9 +22,23 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
+#include "hash-set.h"
+#include "machmode.h"
+#include "vec.h"
+#include "double-int.h"
+#include "input.h"
+#include "alias.h"
+#include "symtab.h"
+#include "wide-int.h"
+#include "inchash.h"
#include "tree.h"
+#include "fold-const.h"
#include "tree-nested.h"
#include "calls.h"
+#include "predict.h"
+#include "hard-reg-set.h"
+#include "input.h"
+#include "function.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
@@ -35,7 +49,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-iterator.h"
#include "tree-inline.h"
#include "flags.h"
-#include "function.h"
#include "diagnostic-core.h"
#include "tree-pass.h"
#include "langhooks.h"
@@ -60,7 +73,7 @@ along with GCC; see the file COPYING3. If not see
struct return_statements_t
{
tree label;
- gimple stmt;
+ greturn *stmt;
};
typedef struct return_statements_t return_statements_t;
@@ -122,7 +135,8 @@ lower_function_body (void)
/* If the function falls off the end, we need a null return statement.
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)
+ bool may_fallthru = gimple_seq_may_fallthru (lowered_body);
+ if (may_fallthru
&& (data.return_statements.is_empty ()
|| (gimple_return_retval (data.return_statements.last().stmt)
!= NULL)))
@@ -131,6 +145,7 @@ lower_function_body (void)
gimple_set_location (x, cfun->function_end_locus);
gimple_set_block (x, DECL_INITIAL (current_function_decl));
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
+ may_fallthru = false;
}
/* If we lowered any return statements, emit the representative
@@ -141,6 +156,14 @@ lower_function_body (void)
x = gimple_build_label (t.label);
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
+ if (may_fallthru)
+ {
+ /* Remove the line number from the representative return statement.
+ It now fills in for the fallthru too. Failure to remove this
+ will result in incorrect results for coverage analysis. */
+ gimple_set_location (t.stmt, UNKNOWN_LOCATION);
+ may_fallthru = false;
+ }
}
/* Once the old body has been lowered, replace it with the new
@@ -163,8 +186,6 @@ const pass_data pass_data_lower_cf =
GIMPLE_PASS, /* type */
"lower", /* name */
OPTGROUP_NONE, /* optinfo_flags */
- false, /* has_gate */
- true, /* has_execute */
TV_NONE, /* tv_id */
PROP_gimple_any, /* properties_required */
PROP_gimple_lcf, /* properties_provided */
@@ -181,7 +202,7 @@ public:
{}
/* opt_pass methods: */
- unsigned int execute () { return lower_function_body (); }
+ virtual unsigned int execute (function *) { return lower_function_body (); }
}; // class pass_lower_cf
@@ -290,8 +311,11 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
return;
case GIMPLE_EH_ELSE:
- lower_sequence (gimple_eh_else_n_body_ptr (stmt), data);
- lower_sequence (gimple_eh_else_e_body_ptr (stmt), data);
+ {
+ geh_else *eh_else_stmt = as_a <geh_else *> (stmt);
+ lower_sequence (gimple_eh_else_n_body_ptr (eh_else_stmt), data);
+ lower_sequence (gimple_eh_else_e_body_ptr (eh_else_stmt), data);
+ }
break;
case GIMPLE_NOP:
@@ -363,7 +387,9 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
return;
case GIMPLE_TRANSACTION:
- lower_sequence (gimple_transaction_body_ptr (stmt), data);
+ lower_sequence (gimple_transaction_body_ptr (
+ as_a <gtransaction *> (stmt)),
+ data);
break;
default:
@@ -380,7 +406,7 @@ static void
lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data)
{
tree old_block = data->block;
- gimple stmt = gsi_stmt (*gsi);
+ gbind *stmt = as_a <gbind *> (gsi_stmt (*gsi));
tree new_block = gimple_bind_block (stmt);
if (new_block)
@@ -453,7 +479,9 @@ lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
for (; !gsi_end_p (i); gsi_next (&i))
{
data->cannot_fallthru = false;
- lower_sequence (gimple_catch_handler_ptr (gsi_stmt (i)), data);
+ lower_sequence (gimple_catch_handler_ptr (
+ as_a <gcatch *> (gsi_stmt (i))),
+ data);
if (!data->cannot_fallthru)
cannot_fallthru = false;
}
@@ -494,7 +522,7 @@ lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
This is a subroutine of gimple_stmt_may_fallthru. */
static bool
-gimple_try_catch_may_fallthru (gimple stmt)
+gimple_try_catch_may_fallthru (gtry *stmt)
{
gimple_stmt_iterator i;
@@ -515,7 +543,8 @@ gimple_try_catch_may_fallthru (gimple stmt)
through iff any of the catch bodies falls through. */
for (; !gsi_end_p (i); gsi_next (&i))
{
- if (gimple_seq_may_fallthru (gimple_catch_handler (gsi_stmt (i))))
+ if (gimple_seq_may_fallthru (gimple_catch_handler (
+ as_a <gcatch *> (gsi_stmt (i)))))
return true;
}
return false;
@@ -574,11 +603,12 @@ gimple_stmt_may_fallthru (gimple stmt)
return false;
case GIMPLE_BIND:
- return gimple_seq_may_fallthru (gimple_bind_body (stmt));
+ return gimple_seq_may_fallthru (
+ gimple_bind_body (as_a <gbind *> (stmt)));
case GIMPLE_TRY:
if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
- return gimple_try_catch_may_fallthru (stmt);
+ return gimple_try_catch_may_fallthru (as_a <gtry *> (stmt));
/* It must be a GIMPLE_TRY_FINALLY. */
@@ -593,8 +623,12 @@ gimple_stmt_may_fallthru (gimple stmt)
&& gimple_seq_may_fallthru (gimple_try_cleanup (stmt)));
case GIMPLE_EH_ELSE:
- return (gimple_seq_may_fallthru (gimple_eh_else_n_body (stmt))
- || gimple_seq_may_fallthru (gimple_eh_else_e_body (stmt)));
+ {
+ geh_else *eh_else_stmt = as_a <geh_else *> (stmt);
+ return (gimple_seq_may_fallthru (gimple_eh_else_n_body (eh_else_stmt))
+ || gimple_seq_may_fallthru (gimple_eh_else_e_body (
+ eh_else_stmt)));
+ }
case GIMPLE_CALL:
/* Functions that do not return do not fall through. */
@@ -620,7 +654,7 @@ gimple_seq_may_fallthru (gimple_seq seq)
static void
lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
{
- gimple stmt = gsi_stmt (*gsi);
+ greturn *stmt = as_a <greturn *> (gsi_stmt (*gsi));
gimple t;
int i;
return_statements_t tmp_rs;
@@ -722,7 +756,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
these builtins are modelled as non-local label jumps to the label
that is passed to these two builtins, so pretend we have a non-local
label during GIMPLE passes too. See PR60003. */
- cfun->has_nonlocal_label = true;
+ cfun->has_nonlocal_label = 1;
/* NEXT_LABEL is the label __builtin_longjmp will jump to. Its address is
passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver. */
@@ -800,10 +834,10 @@ lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
tree pptr = gimple_call_arg (call, 0);
tree align = gimple_call_arg (call, 1);
tree res = gimple_call_lhs (call);
- tree ptr = create_tmp_reg (ptr_type_node, NULL);
+ tree ptr = create_tmp_reg (ptr_type_node);
if (TREE_CODE (pptr) == ADDR_EXPR)
{
- tree tem = create_tmp_var (ptr_type_node, NULL);
+ tree tem = create_tmp_var (ptr_type_node);
TREE_ADDRESSABLE (tem) = 1;
gimple_call_set_arg (call, 0, build_fold_addr_expr (tem));
stmt = gimple_build_assign (ptr, tem);
@@ -814,7 +848,7 @@ lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
build_int_cst (ptr_type_node, 0)));
if (res == NULL_TREE)
{
- res = create_tmp_reg (integer_type_node, NULL);
+ res = create_tmp_reg (integer_type_node);
gimple_call_set_lhs (call, res);
}
tree align_label = create_artificial_label (UNKNOWN_LOCATION);