X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fc-omp.c;h=31970bdeaeebab72a95db3919ff2eeb5caaa7745;hb=6f97810bc1fc594a6f0b71fcf294f34f5bcd9c80;hp=b949501d52b0750228788a9a7753e22ea6ca2a29;hpb=389dd41bd043170e7dc7660304f14a5f16af3562;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/c-omp.c b/gcc/c-omp.c index b949501d52b..31970bdeaee 100644 --- a/gcc/c-omp.c +++ b/gcc/c-omp.c @@ -1,7 +1,7 @@ -/* This file contains routines to construct GNU OpenMP constructs, +/* This file contains routines to construct GNU OpenMP constructs, called from parsing in the C and C++ front ends. - Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Richard Henderson , Diego Novillo . @@ -24,13 +24,10 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" -#include "tm.h" #include "tree.h" -#include "function.h" #include "c-common.h" #include "toplev.h" -#include "gimple.h" -#include "bitmap.h" +#include "gimple.h" /* For create_tmp_var_raw. */ #include "langhooks.h" @@ -142,9 +139,10 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, tree lhs, tree rhs) /* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize it even after unsharing function body. */ tree var = create_tmp_var_raw (TREE_TYPE (addr), NULL); + DECL_CONTEXT (var) = current_function_decl; addr = build4 (TARGET_EXPR, TREE_TYPE (addr), var, addr, NULL, NULL); } - lhs = build_indirect_ref (loc, addr, NULL); + lhs = build_indirect_ref (loc, addr, RO_NULL); /* There are lots of warnings, errors, and conversions that need to happen in the course of interpreting a statement. Use the normal mechanisms @@ -153,7 +151,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, tree lhs, tree rhs) input_location, rhs, NULL_TREE); if (x == error_mark_node) return error_mark_node; - gcc_assert (TREE_CODE (x) == MODIFY_EXPR); + gcc_assert (TREE_CODE (x) == MODIFY_EXPR); rhs = TREE_OPERAND (x, 1); /* Punt the actual generation of atomic operations to common code. */ @@ -274,7 +272,7 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, fail = true; } - init = build_modify_expr (elocus, decl, NULL_TREE, NOP_EXPR, + init = build_modify_expr (elocus, decl, NULL_TREE, NOP_EXPR, /* FIXME diagnostics: This should be the location of the INIT. */ elocus, @@ -300,7 +298,8 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, || TREE_CODE (cond) == LE_EXPR || TREE_CODE (cond) == GT_EXPR || TREE_CODE (cond) == GE_EXPR - || TREE_CODE (cond) == NE_EXPR) + || TREE_CODE (cond) == NE_EXPR + || TREE_CODE (cond) == EQ_EXPR) { tree op0 = TREE_OPERAND (cond, 0); tree op1 = TREE_OPERAND (cond, 1); @@ -345,18 +344,21 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, cond_ok = true; } - if (TREE_CODE (cond) == NE_EXPR) + if (TREE_CODE (cond) == NE_EXPR + || TREE_CODE (cond) == EQ_EXPR) { if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))) cond_ok = false; else if (operand_equal_p (TREE_OPERAND (cond, 1), TYPE_MIN_VALUE (TREE_TYPE (decl)), 0)) - TREE_SET_CODE (cond, GT_EXPR); + TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR + ? GT_EXPR : LE_EXPR); else if (operand_equal_p (TREE_OPERAND (cond, 1), TYPE_MAX_VALUE (TREE_TYPE (decl)), 0)) - TREE_SET_CODE (cond, LT_EXPR); + TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR + ? LT_EXPR : GE_EXPR); else cond_ok = false; }