aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2013-10-24 18:25:44 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2013-10-24 18:25:44 +0200
commit8170608bfc488f0dde37b332776e59c912244366 (patch)
treeddaa06506f828f6ab35f493e688951e5b042fbdf /gcc/tree-cfg.c
parenta079f50a721208e94d23fee77ad77322ad1b74a8 (diff)
downloadgcc-8170608bfc488f0dde37b332776e59c912244366.zip
gcc-8170608bfc488f0dde37b332776e59c912244366.tar.gz
gcc-8170608bfc488f0dde37b332776e59c912244366.tar.bz2
re PR other/33426 (Support of #pragma ivdep)
2013-08-24 Tobias Burnus <burnus@net-b.de> PR other/33426 * c-pragma.c (init_pragma) Add #pragma ivdep handling. * c-pragma.h (pragma_kind): Add PRAGMA_IVDEP. PR other/33426 * c-parser.c (c_parser_pragma, c_parser_for_statement): Handle PRAGMA_IVDEP. (c_parser_statement_after_labels): Update call. PR other/33426 * tree-cfg.c (replace_loop_annotate): New function. (execute_build_cfg): Call it. * gimplify.c (gimple_boolify, gimplify_expr): Handle * ANNOTATE_EXPR. * internal-fn.c (expand_ANNOTATE): New function. * internal-fn.def (ANNOTATE): Define as new internal function. * tree-core.h (tree_node_kind): Add annot_expr_ivdep_kind. * tree-pretty-print.c (dump_generic_node): Handle ANNOTATE_EXPR. * tree.def (ANNOTATE_EXPR): New DEFTREECODE. * doc/extend.texi (Pragmas): Document #pragma ivdep. * doc/generic.texi (Expressions): Document ANNOTATE_EXPR. PR other/33426 * testsuite/gcc.dg/ivdep.c: New. * testsuite/gcc.dg/vect/vect-ivdep-1.c: New. From-SVN: r204021
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 2021d94..cf8200a 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -250,6 +250,71 @@ build_gimple_cfg (gimple_seq seq)
discriminator_per_locus.dispose ();
}
+
+/* Search for ANNOTATE call with annot_expr_ivdep_kind; if found, remove
+ it and set loop->safelen to INT_MAX. We assume that the annotation
+ comes immediately before the condition. */
+
+static void
+replace_loop_annotate ()
+{
+ struct loop *loop;
+ loop_iterator li;
+ basic_block bb;
+ gimple_stmt_iterator gsi;
+ gimple stmt;
+
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ gsi = gsi_last_bb (loop->header);
+ stmt = gsi_stmt (gsi);
+ if (stmt && gimple_code (stmt) == GIMPLE_COND)
+ {
+ gsi_prev_nondebug (&gsi);
+ if (gsi_end_p (gsi))
+ continue;
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) != GIMPLE_CALL)
+ continue;
+ if (!gimple_call_internal_p (stmt)
+ || gimple_call_internal_fn (stmt) != IFN_ANNOTATE)
+ continue;
+ if ((annot_expr_kind) tree_low_cst (gimple_call_arg (stmt, 1), 0)
+ != annot_expr_ivdep_kind)
+ continue;
+ stmt = gimple_build_assign (gimple_call_lhs (stmt),
+ gimple_call_arg (stmt, 0));
+ gsi_replace (&gsi, stmt, true);
+ loop->safelen = INT_MAX;
+ }
+ }
+
+ /* Remove IFN_ANNOTATE. Safeguard for the case loop->latch == NULL. */
+ FOR_EACH_BB (bb)
+ {
+ gsi = gsi_last_bb (bb);
+ stmt = gsi_stmt (gsi);
+ if (stmt && gimple_code (stmt) == GIMPLE_COND)
+ gsi_prev_nondebug (&gsi);
+ if (gsi_end_p (gsi))
+ continue;
+ stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) != GIMPLE_CALL)
+ continue;
+ if (!gimple_call_internal_p (stmt)
+ || gimple_call_internal_fn (stmt) != IFN_ANNOTATE)
+ continue;
+ if ((annot_expr_kind) tree_low_cst (gimple_call_arg (stmt, 1), 0)
+ != annot_expr_ivdep_kind)
+ continue;
+ warning (0, "ignoring %<GCC ivdep%> annotation");
+ stmt = gimple_build_assign (gimple_call_lhs (stmt),
+ gimple_call_arg (stmt, 0));
+ gsi_replace (&gsi, stmt, true);
+ }
+}
+
+
static unsigned int
execute_build_cfg (void)
{
@@ -264,6 +329,7 @@ execute_build_cfg (void)
}
cleanup_tree_cfg ();
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
+ replace_loop_annotate ();
return 0;
}