OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / gimplify.c
index d95a18e..af3d924 100644 (file)
@@ -2340,7 +2340,7 @@ gimple_boolify (tree expr)
     default:
       /* Other expressions that get here must have boolean values, but
         might need to be converted to the appropriate mode.  */
-      return convert (boolean_type_node, expr);
+      return fold_convert (boolean_type_node, expr);
     }
 }
 
@@ -3042,7 +3042,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
        i = VEC_index (constructor_elt, elts, 1)->value;
        if (r == NULL || i == NULL)
          {
-           tree zero = convert (TREE_TYPE (type), integer_zero_node);
+           tree zero = fold_convert (TREE_TYPE (type), integer_zero_node);
            if (r == NULL)
              r = zero;
            if (i == NULL)
@@ -3545,8 +3545,8 @@ gimplify_boolean_expr (tree *expr_p)
   tree type = TREE_TYPE (*expr_p);
 
   *expr_p = build3 (COND_EXPR, type, *expr_p,
-                   convert (type, boolean_true_node),
-                   convert (type, boolean_false_node));
+                   fold_convert (type, boolean_true_node),
+                   fold_convert (type, boolean_false_node));
 
   return GS_OK;
 }
@@ -4504,6 +4504,11 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel)
              remove = true;
              break;
            }
+         /* Handle NRV results passed by reference.  */
+         if (TREE_CODE (decl) == INDIRECT_REF
+             && TREE_CODE (TREE_OPERAND (decl, 0)) == RESULT_DECL
+             && DECL_BY_REFERENCE (TREE_OPERAND (decl, 0)))
+           OMP_CLAUSE_DECL (c) = decl = TREE_OPERAND (decl, 0);
          omp_add_variable (ctx, decl, flags);
          if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION
              && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
@@ -4531,6 +4536,11 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel)
              remove = true;
              break;
            }
+         /* Handle NRV results passed by reference.  */
+         if (TREE_CODE (decl) == INDIRECT_REF
+             && TREE_CODE (TREE_OPERAND (decl, 0)) == RESULT_DECL
+             && DECL_BY_REFERENCE (TREE_OPERAND (decl, 0)))
+           OMP_CLAUSE_DECL (c) = decl = TREE_OPERAND (decl, 0);
        do_notice:
          if (outer_ctx)
            omp_notice_variable (outer_ctx, decl, true);
@@ -5558,6 +5568,13 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
          ret = gimplify_var_or_parm_decl (expr_p);
          break;
 
+       case RESULT_DECL:
+         /* When within an OpenMP context, notice uses of variables.  */
+         if (gimplify_omp_ctxp)
+           omp_notice_variable (gimplify_omp_ctxp, *expr_p, true);
+         ret = GS_ALL_DONE;
+         break;
+
        case SSA_NAME:
          /* Allow callbacks into the gimplifier during optimization.  */
          ret = GS_ALL_DONE;
@@ -5587,7 +5604,8 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
          ret = gimplify_omp_atomic (expr_p, pre_p);
          break;
 
-       case OMP_RETURN_EXPR:
+       case OMP_RETURN:
+       case OMP_CONTINUE:
          ret = GS_ALL_DONE;
          break;
 
@@ -5703,7 +5721,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
          /* Historically, the compiler has treated a bare
             reference to a volatile lvalue as forcing a load.  */
          tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p));
-         /* Normally, we do want to create a temporary for a
+         /* Normally, we do not want to create a temporary for a
             TREE_ADDRESSABLE type because such a type should not be
             copied by bitwise-assignment.  However, we make an
             exception here, as all we are doing here is ensuring that