[PATCH] Cilk Plus Array Notation for C++

Aldy Hernandez aldyh@redhat.com
Tue Jun 18 23:42:00 GMT 2013


Thanks for fixing everything.  This looks much better.

I don't have much, just small typos.  It's up to Jason and Richard to 
take it from here.

Aldy

----

> +      else
> +	{
> +	  val = convert_like_with_context (conv, arg, fn, i-is_method,
> +					   conversion_warning
> +					   ? complain
> +					   : complain & (~tf_warning));

s/i-is_method/i - is_method/

I know this isn't your fault, since the original code had this, but if 
you're going to copy over, might as well fix small formatting errors :).

> +/* Extracts all the array notation triplet information from LIST and stores them
> +   in a 2-D arrays (size x rank) of START, LENGTH and STRIDE, holding the

s/2-D arrays/2-D array/

> +   For example: For an array notation A[5:10:2], the vector start  will be

Extra space after start.

> +      /* We need to do this because we are "faking" the builtin function types,
> +	 so the compiler does a bunch of typecasts and this will get rid of
> +	 all that!  */
> +      while (TREE_CODE (call_fn) == CONVERT_EXPR
> +	     || TREE_CODE (call_fn) == NOP_EXPR)
> +	call_fn = TREE_OPERAND (call_fn, 0);

We already have an automated way of doing this.  Will this work for you?:

/* Given an expression as a tree, strip any conversion that generates
    no instruction.  Accepts both tree and const_tree arguments since
    we are not modifying the tree itself.  */

#define STRIP_NOPS(EXP) \
   (EXP) = tree_strip_nop_conversions (CONST_CAST_TREE (EXP))

Similarly elsewhere.

> +/* Helper function for expand_conditonal_array_notations. Encloses the

Two spaces after "."

> +static tree
> +expand_return_expr (tree expr)
> +{
> +  tree new_mod_list, new_var, new_mod, retval_expr;
> +  location_t loc = EXPR_LOCATION (expr);
> +
> +  if (TREE_CODE (expr) != RETURN_EXPR)
> +    return expr;

Well, since we're using C++, might as well move the comparison with 
RETURN_EXPR earlier, to avoid setting loc.

> +  /* Skip empty subtrees.  */
> +  if (!t)
> +    return t;

No need to document the obvious.

> +    case ARRAY_NOTATION_REF:
> +      {
> +	tree start_index, length, stride;
> +	op1 = tsubst_non_call_postfix_expression (ARRAY_NOTATION_ARRAY (t),
> +						  args, complain, in_decl);
> +	start_index = RECUR (ARRAY_NOTATION_START (t));
> +	length = RECUR (ARRAY_NOTATION_LENGTH (t));
> +	stride = RECUR (ARRAY_NOTATION_STRIDE (t));
> +	if (!cilkplus_an_triplet_types_ok_p (loc, start_index, length, stride,
> +					     TREE_TYPE (op1)))
> +	  RETURN (error_mark_node);
> +	RETURN (build_array_notation_ref (EXPR_LOCATION (t), op1, start_index,
> +					  length, stride, TREE_TYPE (op1)));

Indentation of RETURN is wrong.

> +      /* If the return expression contains array notatinos, then flag it as

s/notatinos/notations.  Though I like the sound of "notatinos" :-).

> +      /* If find_rank returns false,  then it should have reported an error,

s/  then/then

> +     to convert them. They will be broken up into modify exprs in future,

Two spaces after period.



More information about the Gcc-patches mailing list