This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Cilk Plus Array Notation for C++


On 06/28/2013 12:54 AM, Iyer, Balaji V wrote:
            /* If stride and start are of same type and the induction var
               is not, convert induction variable to stride's type.  */
            if (TREE_TYPE (start) == TREE_TYPE (stride)
                && TREE_TYPE (stride) != TREE_TYPE (var))
              {
                st = start;
                str = stride;
                v = build_c_cast (loc, TREE_TYPE (str), var);
              }
            else if (TREE_TYPE (start) != TREE_TYPE (stride))
              {
                /* If we reach here, then the stride and start are of
                   different types, and so it doesn't really matter what
                   the induction variable type is, convert everything to
                   integer.  The reason why we pick an integer
                   instead of something like size_t is because the stride
                   and length can be + or -.  */
                st = build_c_cast (loc, ptrdiff_type_node, start);
                str = build_c_cast (loc, ptrdiff_type_node, stride);
                v = build_c_cast (loc, ptrdiff_type_node, var);
              }
            else
              {
                st = start;
                str = stride;
                v = var;
              }

I still think that what you want is to unconditionally convert start and stride to ptrdiff_t, either here or in build_array_notation_ref.

+           tree ii_tree = array_exprs[ii][jj];
+           (*node)[ii][jj].is_vector = true;
+           (*node)[ii][jj].value = ARRAY_NOTATION_ARRAY (ii_tree);
+           (*node)[ii][jj].start = ARRAY_NOTATION_START (ii_tree);
+           (*node)[ii][jj].length =
+             fold_build1 (CONVERT_EXPR, integer_type_node,
+                          ARRAY_NOTATION_LENGTH (ii_tree));
+           (*node)[ii][jj].stride =
+             fold_build1 (CONVERT_EXPR, integer_type_node,
+                          ARRAY_NOTATION_STRIDE (ii_tree));

I still don't understand what the purpose of cilkplus_an_parts is; it seems to have exactly the same information as the ARRAY_NOTATION_REF, so you might as well keep the array of ARRAY_NOTATION_REF instead of copying it into an array of cilkplus_an_parts.

+       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);

You don't need to check the triplet types in tsubst, since you're checking them in build_array_notation_ref.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]