This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
omp_clause_num_ops
- From: Amittai Aviram <amittai dot aviram at yale dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 13 Feb 2012 23:07:56 -0500
- Subject: omp_clause_num_ops
Hi! The array omp_clause_num_ops, in gcc/gcc/tree.c, defines the number of "operands" for an AST node representing an OpenMP reduction clause to be 4:
/* Number of operands for each OpenMP clause. */
unsigned const char omp_clause_num_ops[] =
{
0, /* OMP_CLAUSE_ERROR */
1, /* OMP_CLAUSE_PRIVATE */
1, /* OMP_CLAUSE_SHARED */
1, /* OMP_CLAUSE_FIRSTPRIVATE */
2, /* OMP_CLAUSE_LASTPRIVATE */
4, /* OMP_CLAUSE_REDUCTION */
1, /* OMP_CLAUSE_COPYIN */
1, /* OMP_CLAUSE_COPYPRIVATE */
1, /* OMP_CLAUSE_IF */
1, /* OMP_CLAUSE_NUM_THREADS */
1, /* OMP_CLAUSE_SCHEDULE */
0, /* OMP_CLAUSE_NOWAIT */
0, /* OMP_CLAUSE_ORDERED */
0, /* OMP_CLAUSE_DEFAULT */
3, /* OMP_CLAUSE_COLLAPSE */
0 /* OMP_CLAUSE_UNTIED */
};
What does "operand" mean in this context, and why is it 4? A typical reduction clause would look like this:
reduction(+:x)
I would guess either one operand (x) or two for the binary operation +. So this code must imply some different interpretation of the word "operand." Thanks.
Amittai
Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@yale.edu
http://www.amittai.com