diff options
author | Cesar Philippidis <cesar@codesourcery.com> | 2016-05-02 11:49:15 -0700 |
---|---|---|
committer | Cesar Philippidis <cesar@gcc.gnu.org> | 2016-05-02 11:49:15 -0700 |
commit | 778864283e64809939a20aa70ee50c3d80fe10cf (patch) | |
tree | 8fa1fd05fa3252d1c4fa5970e67bc5debade2f19 /gcc/cp/semantics.c | |
parent | 474e0129ac2e906caa667eb7a9a7682afeec41aa (diff) | |
download | gcc-778864283e64809939a20aa70ee50c3d80fe10cf.zip gcc-778864283e64809939a20aa70ee50c3d80fe10cf.tar.gz gcc-778864283e64809939a20aa70ee50c3d80fe10cf.tar.bz2 |
c-common.h (enum c_omp_region_type): Define.
gcc/c-family/
* c-common.h (enum c_omp_region_type): Define.
gcc/c/
* c-parser.c (c_parser_oacc_all_clauses): Update call to
c_finish_omp_clauses.
(c_parser_omp_all_clauses): Likewise.
(c_parser_oacc_cache): Likewise.
(c_parser_oacc_loop): Likewise.
(omp_split_clauses): Likewise.
(c_parser_omp_declare_target): Likewise.
(c_parser_cilk_all_clauses): Likewise.
(c_parser_cilk_for): Likewise.
* c-typeck.c (c_finish_omp_clauses): Replace bool arguments
is_omp, declare_simd, and is_cilk with enum c_omp_region_type ort.
gcc/cp/
* cp-tree.h (finish_omp_clauses): Update prototype.
* parser.c (cp_parser_oacc_all_clauses): Update call to
finish_omp_clauses.
(cp_parser_omp_all_clauses): Likewise.
(cp_parser_omp_for_loop): Likewise.
(cp_omp_split_clauses): Likewise.
(cp_parser_oacc_cache): Likewise.
(cp_parser_oacc_loop): Likewise.
(cp_parser_omp_declare_target):
(cp_parser_cilk_simd_all_clauses): Likewise.
(cp_parser_cilk_for): Likewise.
* pt.c (tsubst_omp_clauses): Replace allow_fields and declare_simd
arguments with enum c_omp_region_type ort.
(tsubst_omp_clauses): Update calls to finish_omp_clauses.
(tsubst_omp_attribute): Update calls to tsubst_omp_clauses.
(tsubst_omp_for_iterator): Update calls to finish_omp_clauses.
(tsubst_expr): Update calls to tsubst_omp_clauses.
* semantics.c (finish_omp_clauses): Replace bool arguments
allow_fields, declare_simd, and is_cilk with bitmask ort.
(finish_omp_for): Update call to finish_omp_clauses.
From-SVN: r235780
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2365a73..fed7e88 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5793,8 +5793,7 @@ cp_finish_omp_clause_depend_sink (tree sink_clause) Remove any elements from the list that are invalid. */ tree -finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, - bool is_cilk) +finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { bitmap_head generic_head, firstprivate_head, lastprivate_head; bitmap_head aligned_head, map_head, map_field_head; @@ -5820,17 +5819,18 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, switch (OMP_CLAUSE_CODE (c)) { case OMP_CLAUSE_SHARED: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); goto check_dup_generic; case OMP_CLAUSE_PRIVATE: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); goto check_dup_generic; case OMP_CLAUSE_REDUCTION: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); t = OMP_CLAUSE_DECL (c); if (TREE_CODE (t) == TREE_LIST) { - if (handle_omp_array_sections (c, allow_fields)) + if (handle_omp_array_sections (c, ((ort & C_ORT_OMP_DECLARE_SIMD) + == C_ORT_OMP))) { remove = true; break; @@ -5858,14 +5858,14 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, goto check_dup_generic; case OMP_CLAUSE_COPYPRIVATE: copyprivate_seen = true; - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); goto check_dup_generic; case OMP_CLAUSE_COPYIN: goto check_dup_generic; case OMP_CLAUSE_LINEAR: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); t = OMP_CLAUSE_DECL (c); - if (!declare_simd + if (ort != C_ORT_OMP_DECLARE_SIMD && OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_DEFAULT) { error_at (OMP_CLAUSE_LOCATION (c), @@ -5890,7 +5890,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, } if (TREE_CODE (type) == REFERENCE_TYPE) type = TREE_TYPE (type); - if (is_cilk) + if (ort == C_ORT_CILK) { if (!INTEGRAL_TYPE_P (type) && !SCALAR_FLOAT_TYPE_P (type) @@ -5925,7 +5925,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, } else if (!type_dependent_expression_p (t) && !INTEGRAL_TYPE_P (TREE_TYPE (t)) - && (!declare_simd + && (ort != C_ORT_OMP_DECLARE_SIMD || TREE_CODE (t) != PARM_DECL || TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE || !INTEGRAL_TYPE_P (TREE_TYPE (TREE_TYPE (t))))) @@ -5937,7 +5937,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, else { t = mark_rvalue_use (t); - if (declare_simd && TREE_CODE (t) == PARM_DECL) + if (ort == C_ORT_OMP_DECLARE_SIMD && TREE_CODE (t) == PARM_DECL) { OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c) = 1; goto check_dup_generic; @@ -5946,7 +5946,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, && (VAR_P (OMP_CLAUSE_DECL (c)) || TREE_CODE (OMP_CLAUSE_DECL (c)) == PARM_DECL)) { - if (declare_simd) + if (ort == C_ORT_OMP_DECLARE_SIMD) { t = maybe_constant_value (t); if (TREE_CODE (t) != INTEGER_CST) @@ -5981,7 +5981,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, else if (TREE_CODE (type) == POINTER_TYPE /* Can't multiply the step yet if *this is still incomplete type. */ - && (!declare_simd + && (ort != C_ORT_OMP_DECLARE_SIMD || TREE_CODE (OMP_CLAUSE_DECL (c)) != PARM_DECL || !DECL_ARTIFICIAL (OMP_CLAUSE_DECL (c)) || DECL_NAME (OMP_CLAUSE_DECL (c)) @@ -6018,7 +6018,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, t = OMP_CLAUSE_DECL (c); check_dup_generic_t: if (t == current_class_ptr - && (!declare_simd + && (ort != C_ORT_OMP_DECLARE_SIMD || (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_LINEAR && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_UNIFORM))) { @@ -6084,7 +6084,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, break; } if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL - && (!allow_fields || TREE_CODE (t) != FIELD_DECL)) + && ((ort & C_ORT_OMP_DECLARE_SIMD) != C_ORT_OMP + || TREE_CODE (t) != FIELD_DECL)) { if (processing_template_decl) break; @@ -6123,7 +6124,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, break; } if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL - && (!allow_fields || TREE_CODE (t) != FIELD_DECL)) + && ((ort & C_ORT_OMP_DECLARE_SIMD) != C_ORT_OMP + || TREE_CODE (t) != FIELD_DECL)) { if (processing_template_decl) break; @@ -6466,7 +6468,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, case OMP_CLAUSE_ALIGNED: t = OMP_CLAUSE_DECL (c); - if (t == current_class_ptr && !declare_simd) + if (t == current_class_ptr && ort != C_ORT_OMP_DECLARE_SIMD) { error ("%<this%> allowed in OpenMP only in %<declare simd%>" " clauses"); @@ -6549,7 +6551,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, } if (TREE_CODE (t) == TREE_LIST) { - if (handle_omp_array_sections (c, allow_fields)) + if (handle_omp_array_sections (c, ((ort & C_ORT_OMP_DECLARE_SIMD) + == C_ORT_OMP))) remove = true; break; } @@ -6583,7 +6586,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, t = OMP_CLAUSE_DECL (c); if (TREE_CODE (t) == TREE_LIST) { - if (handle_omp_array_sections (c, allow_fields)) + if (handle_omp_array_sections (c, ((ort & C_ORT_OMP_DECLARE_SIMD) + == C_ORT_OMP))) remove = true; else { @@ -6638,7 +6642,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, OMP_CLAUSE_DECL (c) = t; } if (TREE_CODE (t) == COMPONENT_REF - && allow_fields + && (ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP && OMP_CLAUSE_CODE (c) != OMP_CLAUSE__CACHE_) { if (type_dependent_expression_p (t)) @@ -6778,7 +6782,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, handle_map_references: if (!remove && !processing_template_decl - && allow_fields + && (ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP && TREE_CODE (TREE_TYPE (OMP_CLAUSE_DECL (c))) == REFERENCE_TYPE) { t = OMP_CLAUSE_DECL (c); @@ -6972,7 +6976,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, case OMP_CLAUSE_IS_DEVICE_PTR: case OMP_CLAUSE_USE_DEVICE_PTR: - field_ok = allow_fields; + field_ok = (ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP; t = OMP_CLAUSE_DECL (c); if (!type_dependent_expression_p (t)) { @@ -7112,7 +7116,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, need_implicitly_determined = true; break; case OMP_CLAUSE_LINEAR: - if (!declare_simd) + if (ort != C_ORT_OMP_DECLARE_SIMD) need_implicitly_determined = true; else if (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c) && !bitmap_bit_p (&map_head, @@ -8342,7 +8346,7 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, OMP_CLAUSE_OPERAND (c, 0) = cilk_for_number_of_iterations (omp_for); OMP_CLAUSE_CHAIN (c) = clauses; - OMP_PARALLEL_CLAUSES (omp_par) = finish_omp_clauses (c, false); + OMP_PARALLEL_CLAUSES (omp_par) = finish_omp_clauses (c, C_ORT_CILK); add_stmt (omp_par); return omp_par; } |