On Wed, Dec 18, 2013 at 11:36:04PM +0000, Iyer, Balaji V wrote:
> --- a/gcc/cp/decl2.c
> +++ b/gcc/cp/decl2.c
> @@ -1124,6 +1124,10 @@ is_late_template_attribute (tree attr, tree decl)
>        && is_attribute_p ("omp declare simd", name))
>      return true;
>  
> +  /* Ditto as above for Cilk Plus SIMD-enabled function attributes.  */
> +  if (flag_enable_cilkplus && is_attribute_p ("cilk simd function", name))
> +    return true;

Why?  It doesn't have any argument, why it should be processed late?

> @@ -17097,6 +17102,14 @@ cp_parser_direct_declarator (cp_parser* parser,
>  
>                 attrs = cp_parser_std_attribute_spec_seq (parser);
>  
> +               /* In here, we handle cases where attribute is used after
> +                  the function declaration.  For example:
> +                  void func (int x) __attribute__((vector(..)));  */
> +               if (flag_enable_cilkplus
> +                   && cp_lexer_next_token_is_keyword (parser->lexer,
> +                                                      RID_ATTRIBUTE))
> +                 attrs = chainon (cp_parser_gnu_attributes_opt (parser),
> +                                  attrs);
>                 late_return = (cp_parser_late_return_type_opt
>                                (parser, declarator,
>                                 memfn ? cv_quals : -1));

Doesn't this change the grammar (for all attributes, not just Cilk+ specific
ones) just based on whether -fcilkplus has been specified or not?

> @@ -17820,10 +17833,14 @@ cp_parser_late_return_type_opt (cp_parser* parser, 
> cp_declarator *declarator,
>                        && declarator
>                        && declarator->kind == cdk_id);
>  
> +  bool cilk_simd_fn_vector_p = (parser->cilk_simd_fn_info
> +                        && declarator
> +                        && declarator->kind == cdk_id);

Formatting looks wrong, put = on the next line and align && right below
parser.
> +
> +cp_omp_declare_simd_data info;

Global var?  Why?  Isn't heap or GC allocation better?
> +  /* The vectorlength clause in #pragma simdbehaves exactly like OpenMP's

Missing space after simd

> @@ -8602,9 +8602,12 @@ apply_late_template_attributes (tree *decl_p, tree 
> attributes, int attr_flags,
>           {
>             *p = TREE_CHAIN (t);
>             TREE_CHAIN (t) = NULL_TREE;
> -           if (flag_openmp
> -               && is_attribute_p ("omp declare simd",
> -                                  get_attribute_name (t))
> +           if (((flag_openmp
> +                 && is_attribute_p ("omp declare simd",
> +                                    get_attribute_name (t)))
> +                || (flag_enable_cilkplus
> +                    && is_attribute_p ("cilk simd function",
> +                                       get_attribute_name (t))))

Again, why this?

        Jakub

Reply via email to