From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 1B60D3857411; Wed, 1 Sep 2021 15:48:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B60D3857411 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3293] Simplify 'gcc/tree.c:walk_tree_1' handling of 'OMP_CLAUSE' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: 1cef3039b880a21fbdf4153e6fc42026619fd4ad X-Git-Newrev: 424e46015762920b37e23670b7c518d9891348ed Message-Id: <20210901154841.1B60D3857411@sourceware.org> Date: Wed, 1 Sep 2021 15:48:41 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2021 15:48:41 -0000 https://gcc.gnu.org/g:424e46015762920b37e23670b7c518d9891348ed commit r12-3293-g424e46015762920b37e23670b7c518d9891348ed Author: Thomas Schwinge Date: Fri Aug 27 07:49:55 2021 +0200 Simplify 'gcc/tree.c:walk_tree_1' handling of 'OMP_CLAUSE' No behavioral change, other than that for a few clauses, operands are now walked in a different order, and 'OMP_CLAUSE_ERROR' now no longer runs into 'default: gcc_unreachable ();' here (but instead will at some later stage). Follow-up for r110243 (commit aaf46ef9792bbc562175b606bd1c3f225ea56924) "Fix PR 25886. Convert OMP_CLAUSE_* into sub-codes". gcc/ * tree.c (walk_tree_1) : Simplify. Diff: --- gcc/tree.c | 134 ++++--------------------------------------------------------- 1 file changed, 8 insertions(+), 126 deletions(-) diff --git a/gcc/tree.c b/gcc/tree.c index 03a424a663a..a89d50a30ad 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -275,7 +275,7 @@ struct int_n_trees_t int_n_trees [NUM_INT_N_ENTS]; bool tree_contains_struct[MAX_TREE_CODES][64]; -/* Number of operands for each OpenMP clause. */ +/* Number of operands for each OMP clause. */ unsigned const char omp_clause_num_ops[] = { 0, /* OMP_CLAUSE_ERROR */ @@ -10289,7 +10289,7 @@ build_empty_stmt (location_t loc) } -/* Build an OpenMP clause with code CODE. LOC is the location of the +/* Build an OMP clause with code CODE. LOC is the location of the clause. */ tree @@ -11091,130 +11091,12 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data, break; case OMP_CLAUSE: - switch (OMP_CLAUSE_CODE (*tp)) - { - case OMP_CLAUSE_GANG: - WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, 1)); - /* FALLTHRU */ - - case OMP_CLAUSE_AFFINITY: - case OMP_CLAUSE_ASYNC: - case OMP_CLAUSE_WAIT: - case OMP_CLAUSE_WORKER: - case OMP_CLAUSE_VECTOR: - case OMP_CLAUSE_NUM_GANGS: - case OMP_CLAUSE_NUM_WORKERS: - case OMP_CLAUSE_VECTOR_LENGTH: - case OMP_CLAUSE_PRIVATE: - case OMP_CLAUSE_SHARED: - case OMP_CLAUSE_FIRSTPRIVATE: - case OMP_CLAUSE_COPYIN: - case OMP_CLAUSE_COPYPRIVATE: - case OMP_CLAUSE_FINAL: - case OMP_CLAUSE_IF: - case OMP_CLAUSE_NUM_THREADS: - case OMP_CLAUSE_SCHEDULE: - case OMP_CLAUSE_UNIFORM: - case OMP_CLAUSE_DEPEND: - case OMP_CLAUSE_NONTEMPORAL: - case OMP_CLAUSE_NUM_TEAMS: - case OMP_CLAUSE_THREAD_LIMIT: - case OMP_CLAUSE_DEVICE: - case OMP_CLAUSE_DIST_SCHEDULE: - case OMP_CLAUSE_SAFELEN: - case OMP_CLAUSE_SIMDLEN: - case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_PRIORITY: - case OMP_CLAUSE_GRAINSIZE: - case OMP_CLAUSE_NUM_TASKS: - case OMP_CLAUSE_HINT: - case OMP_CLAUSE_FILTER: - case OMP_CLAUSE_TO_DECLARE: - case OMP_CLAUSE_LINK: - case OMP_CLAUSE_DETACH: - case OMP_CLAUSE_USE_DEVICE_PTR: - case OMP_CLAUSE_USE_DEVICE_ADDR: - case OMP_CLAUSE_IS_DEVICE_PTR: - case OMP_CLAUSE_INCLUSIVE: - case OMP_CLAUSE_EXCLUSIVE: - case OMP_CLAUSE__LOOPTEMP_: - case OMP_CLAUSE__REDUCTEMP_: - case OMP_CLAUSE__CONDTEMP_: - case OMP_CLAUSE__SCANTEMP_: - case OMP_CLAUSE__SIMDUID_: - WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, 0)); - /* FALLTHRU */ - - case OMP_CLAUSE_INDEPENDENT: - case OMP_CLAUSE_NOWAIT: - case OMP_CLAUSE_DEFAULT: - case OMP_CLAUSE_UNTIED: - case OMP_CLAUSE_MERGEABLE: - case OMP_CLAUSE_PROC_BIND: - case OMP_CLAUSE_DEVICE_TYPE: - case OMP_CLAUSE_INBRANCH: - case OMP_CLAUSE_NOTINBRANCH: - case OMP_CLAUSE_FOR: - case OMP_CLAUSE_PARALLEL: - case OMP_CLAUSE_SECTIONS: - case OMP_CLAUSE_TASKGROUP: - case OMP_CLAUSE_NOGROUP: - case OMP_CLAUSE_THREADS: - case OMP_CLAUSE_SIMD: - case OMP_CLAUSE_DEFAULTMAP: - case OMP_CLAUSE_ORDER: - case OMP_CLAUSE_BIND: - case OMP_CLAUSE_AUTO: - case OMP_CLAUSE_SEQ: - case OMP_CLAUSE__SIMT_: - case OMP_CLAUSE_IF_PRESENT: - case OMP_CLAUSE_FINALIZE: - case OMP_CLAUSE_NOHOST: - WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); - - case OMP_CLAUSE_LASTPRIVATE: - WALK_SUBTREE (OMP_CLAUSE_DECL (*tp)); - WALK_SUBTREE (OMP_CLAUSE_LASTPRIVATE_STMT (*tp)); - WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); - - case OMP_CLAUSE_COLLAPSE: - case OMP_CLAUSE_TILE: - { - int i; - for (i = 0; i < 3; i++) - WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, i)); - WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); - } - - case OMP_CLAUSE_LINEAR: - WALK_SUBTREE (OMP_CLAUSE_DECL (*tp)); - WALK_SUBTREE (OMP_CLAUSE_LINEAR_STEP (*tp)); - WALK_SUBTREE (OMP_CLAUSE_LINEAR_STMT (*tp)); - WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); - - case OMP_CLAUSE_ALIGNED: - case OMP_CLAUSE_ALLOCATE: - case OMP_CLAUSE_FROM: - case OMP_CLAUSE_TO: - case OMP_CLAUSE_MAP: - case OMP_CLAUSE__CACHE_: - WALK_SUBTREE (OMP_CLAUSE_DECL (*tp)); - WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, 1)); - WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); - - case OMP_CLAUSE_REDUCTION: - case OMP_CLAUSE_TASK_REDUCTION: - case OMP_CLAUSE_IN_REDUCTION: - { - int i; - for (i = 0; i < 5; i++) - WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, i)); - WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); - } - - default: - gcc_unreachable (); - } + { + int len = omp_clause_num_ops[OMP_CLAUSE_CODE (*tp)]; + for (int i = 0; i < len; i++) + WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, i)); + WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp)); + } break; case TARGET_EXPR: