Mercurial > hg > CbC > CbC_gcc
comparison gcc/c-family/c-omp.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* This file contains routines to construct OpenACC and OpenMP constructs, | 1 /* This file contains routines to construct OpenACC and OpenMP constructs, |
2 called from parsing in the C and C++ front ends. | 2 called from parsing in the C and C++ front ends. |
3 | 3 |
4 Copyright (C) 2005-2017 Free Software Foundation, Inc. | 4 Copyright (C) 2005-2018 Free Software Foundation, Inc. |
5 Contributed by Richard Henderson <rth@redhat.com>, | 5 Contributed by Richard Henderson <rth@redhat.com>, |
6 Diego Novillo <dnovillo@redhat.com>. | 6 Diego Novillo <dnovillo@redhat.com>. |
7 | 7 |
8 This file is part of GCC. | 8 This file is part of GCC. |
9 | 9 |
534 { | 534 { |
535 location_t elocus; | 535 location_t elocus; |
536 bool fail = false; | 536 bool fail = false; |
537 int i; | 537 int i; |
538 | 538 |
539 if ((code == CILK_SIMD || code == CILK_FOR) | |
540 && !c_check_cilk_loop (locus, TREE_VEC_ELT (declv, 0))) | |
541 fail = true; | |
542 | |
543 gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (initv)); | 539 gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (initv)); |
544 gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (condv)); | 540 gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (condv)); |
545 gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (incrv)); | 541 gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (incrv)); |
546 for (i = 0; i < TREE_VEC_LENGTH (declv); i++) | 542 for (i = 0; i < TREE_VEC_LENGTH (declv); i++) |
547 { | 543 { |
669 if (TREE_CODE (cond) == NE_EXPR | 665 if (TREE_CODE (cond) == NE_EXPR |
670 || TREE_CODE (cond) == EQ_EXPR) | 666 || TREE_CODE (cond) == EQ_EXPR) |
671 { | 667 { |
672 if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))) | 668 if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))) |
673 { | 669 { |
674 if (code != CILK_SIMD && code != CILK_FOR) | 670 cond_ok = false; |
675 cond_ok = false; | |
676 } | 671 } |
677 else if (operand_equal_p (TREE_OPERAND (cond, 1), | 672 else if (operand_equal_p (TREE_OPERAND (cond, 1), |
678 TYPE_MIN_VALUE (TREE_TYPE (decl)), | 673 TYPE_MIN_VALUE (TREE_TYPE (decl)), |
679 0)) | 674 0)) |
680 TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR | 675 TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR |
682 else if (operand_equal_p (TREE_OPERAND (cond, 1), | 677 else if (operand_equal_p (TREE_OPERAND (cond, 1), |
683 TYPE_MAX_VALUE (TREE_TYPE (decl)), | 678 TYPE_MAX_VALUE (TREE_TYPE (decl)), |
684 0)) | 679 0)) |
685 TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR | 680 TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR |
686 ? LT_EXPR : GE_EXPR); | 681 ? LT_EXPR : GE_EXPR); |
687 else if (code != CILK_SIMD && code != CILK_FOR) | 682 else |
688 cond_ok = false; | 683 cond_ok = false; |
689 } | 684 } |
690 | 685 |
691 if (cond_ok && TREE_VEC_ELT (condv, i) != cond) | 686 if (cond_ok && TREE_VEC_ELT (condv, i) != cond) |
692 { | 687 { |
830 = (struct c_omp_check_loop_iv_data *) data; | 825 = (struct c_omp_check_loop_iv_data *) data; |
831 if (DECL_P (*tp)) | 826 if (DECL_P (*tp)) |
832 { | 827 { |
833 int i; | 828 int i; |
834 for (i = 0; i < TREE_VEC_LENGTH (d->declv); i++) | 829 for (i = 0; i < TREE_VEC_LENGTH (d->declv); i++) |
835 if (*tp == TREE_VEC_ELT (d->declv, i)) | 830 if (*tp == TREE_VEC_ELT (d->declv, i) |
831 || (TREE_CODE (TREE_VEC_ELT (d->declv, i)) == TREE_LIST | |
832 && *tp == TREE_PURPOSE (TREE_VEC_ELT (d->declv, i)))) | |
836 { | 833 { |
837 location_t loc = d->expr_loc; | 834 location_t loc = d->expr_loc; |
838 if (loc == UNKNOWN_LOCATION) | 835 if (loc == UNKNOWN_LOCATION) |
839 loc = d->stmt_loc; | 836 loc = d->stmt_loc; |
840 switch (d->kind) | 837 switch (d->kind) |
897 c_omp_check_loop_iv_r, &data, &pset, lh); | 894 c_omp_check_loop_iv_r, &data, &pset, lh); |
898 /* Don't warn for C++ random access iterators here, the | 895 /* Don't warn for C++ random access iterators here, the |
899 expression then involves the subtraction and always refers | 896 expression then involves the subtraction and always refers |
900 to the original value. The C++ FE needs to warn on those | 897 to the original value. The C++ FE needs to warn on those |
901 earlier. */ | 898 earlier. */ |
902 if (decl == TREE_VEC_ELT (declv, i)) | 899 if (decl == TREE_VEC_ELT (declv, i) |
900 || (TREE_CODE (TREE_VEC_ELT (declv, i)) == TREE_LIST | |
901 && decl == TREE_PURPOSE (TREE_VEC_ELT (declv, i)))) | |
903 { | 902 { |
904 data.expr_loc = EXPR_LOCATION (cond); | 903 data.expr_loc = EXPR_LOCATION (cond); |
905 data.kind = 1; | 904 data.kind = 1; |
906 walk_tree_1 (&TREE_OPERAND (cond, 1), | 905 walk_tree_1 (&TREE_OPERAND (cond, 1), |
907 c_omp_check_loop_iv_r, &data, &pset, lh); | 906 c_omp_check_loop_iv_r, &data, &pset, lh); |
1614 /* Variables with const-qualified type having no mutable member | 1613 /* Variables with const-qualified type having no mutable member |
1615 are predetermined shared. */ | 1614 are predetermined shared. */ |
1616 if (TREE_READONLY (decl)) | 1615 if (TREE_READONLY (decl)) |
1617 return OMP_CLAUSE_DEFAULT_SHARED; | 1616 return OMP_CLAUSE_DEFAULT_SHARED; |
1618 | 1617 |
1618 /* Predetermine artificial variables holding integral values, those | |
1619 are usually result of gimplify_one_sizepos or SAVE_EXPR | |
1620 gimplification. */ | |
1621 if (VAR_P (decl) | |
1622 && DECL_ARTIFICIAL (decl) | |
1623 && INTEGRAL_TYPE_P (TREE_TYPE (decl))) | |
1624 return OMP_CLAUSE_DEFAULT_SHARED; | |
1625 | |
1619 return OMP_CLAUSE_DEFAULT_UNSPECIFIED; | 1626 return OMP_CLAUSE_DEFAULT_UNSPECIFIED; |
1620 } | 1627 } |