This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Add #pragma ivdep support to the ME and C FE (was: Re: RFC patch for #pragma ivdep)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 8 Oct 2013 23:15:14 +0200
- Subject: Re: Patch: Add #pragma ivdep support to the ME and C FE (was: Re: RFC patch for #pragma ivdep)
- Authentication-results: sourceware.org; auth=none
- References: <5253AB86 dot 7060505 at net-b dot de> <20131008070139 dot GO30970 at tucnak dot zalov dot cz> <52547051 dot 40601 at net-b dot de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 08, 2013 at 10:51:29PM +0200, Tobias Burnus wrote:
> + return false;
> + }
> + c_parser_for_statement (parser, true);
> + return false;
> +
> case PRAGMA_GCC_PCH_PREPROCESS:
> c_parser_error (parser, "%<#pragma GCC pch_preprocess%> must be first");
> c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
> diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
> index f39b194..5979a4a 100644
> --- a/gcc/cfgloop.c
> +++ b/gcc/cfgloop.c
> @@ -507,6 +507,37 @@ flow_loops_find (struct loops *loops)
> loop->latch = latch;
> }
> }
> + /* 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. */
Mixing tabs with spaces above.
> + if (loop->latch)
> + FOR_EACH_EDGE (e, ei, loop->latch->succs)
> + {
> + if (e->dest->flags & BB_RTL)
> + break;
I'd prefer Richard to review this (and probably Joseph the C FE part).
You can't really have loop->latch in GIMPLE and the successors
in RTL, so perhaps you can check that in the if (loop->latch) check
already.
> + gimple_stmt_iterator gsi = gsi_last_nondebug_bb (e->dest);
GIMPLE_COND must be the last in the bb, can't be followed by
debug stmts, so you can safely use just gsi_last_bb (e->dest) instead.
> @@ -7378,6 +7388,22 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
> ret = gimplify_addr_expr (expr_p, pre_p, post_p);
> break;
>
> + case ANNOTATE_EXPR:
> + {
> + tree cond = TREE_OPERAND (*expr_p, 0);
> + tree id = build_int_cst (integer_type_node,
> + ANNOTATE_EXPR_ID (*expr_p));
> + tree tmp = create_tmp_var_raw (TREE_TYPE(cond), NULL);
> + gimplify_arg (&cond, pre_p, EXPR_LOCATION (*expr_p));
> + gimple call = gimple_build_call_internal (IFN_ANNOTATE, 2,
> + cond, id);
> + gimple_call_set_lhs (call, tmp);
> + gimplify_seq_add_stmt (pre_p, call);
> + *expr_p = tmp;
Again, mixing tabs with spaces, tabs should be used always.
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -591,6 +591,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
> #define PREDICT_EXPR_PREDICTOR(NODE) \
> ((enum br_predictor)tree_low_cst (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0), 0))
>
> +#define ANNOTATE_EXPR_ID(NODE) \
> + ((enum annot_expr_kind) ANNOTATE_EXPR_CHECK(NODE)->base.u.version)
Missing space between CHECK and (.
> +#define SET_ANNOTATE_EXPR_ID(NODE, ID) \
> + (ANNOTATE_EXPR_CHECK(NODE)->base.u.version = ID)
Likewise. Shouldn't it be = (ID) ?
Jakub