omp_clause_num_ops

Amittai Aviram amittai.aviram@yale.edu
Tue Feb 14 04:08:00 GMT 2012


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



More information about the Gcc-help mailing list