A loop is considered to be countable if it has any of the forms shown below, and:
The following are examples of countable loops.
for ([iv]; exit_cond; incr_expr) statement
for ([iv]; exit_cond; [expr] { [declaration_list] [statement_list] incr_expr; [statement_list] }
while (exit_cond) { [declaration_list] [statement_list] incr_expr; [statement_list] }
do { [declaration_list] [statement_list] incr_expr; [statement_list] } while (exit_cond)
The following definitions apply to the above examples:
exit_cond |
takes form: | iv <= ub iv < ub iv >= ub iv > ub |
incr_expr |
takes form: | ++iv iv++ --iv iv-- iv += incr iv -= incr iv = iv + incr iv = incr + iv iv = iv - incr |
iv |
Iteration variable. The iteration variable is a signed integer that has either automatic or register storage class, does not have its address taken, and is not modified anywhere in the loop except in incr_expr. |
incr |
Loop invariant signed integer expression. The value of the expression is known at run-time and is not 0. incr cannot reference extern or static variables, pointers or pointer expressions, function calls, or variables that have their address taken. |
ub |
Loop invariant signed integer expression. ub cannot reference extern or static variables, pointers or pointer expressions, function calls, or variables that have their address taken. |
Program Parallelization
Shared and Private Variables in a Parallel Environment
Reduction Operations in Parallelized Loops