next up previous contents index
Next: Restrictions on Regions Up: Regions Previous: Derived Regions

Region Scope Rules

  With one exception, a statement that refers to a parallel array must have a region of the same rank that applies to it. The exception is a procedure call that completely defines the size and rank of its parallel parameters and explicitly specifies regions for its statement body. For example, the following invocation of procedure f does not require a region.

    procedure f (X : [R] integer);
    [R]
    begin
       . . .
    end;

    . . .

    f(A);                       -- This statement does not require a region

Since a compound statement (see Section 7.2) is considered to be a statement, applying a region to a compound statement is equivalent to applying the region to each individual statement in the compound statement. This propagation of regions applies to all nested compound statements as well. In the example below the region [R] applies to every statement.

    [R] begin
          A := B;
          count := f(A);
          if count>0 then
              B := C;
          end;
        end;

The body of a procedure need not specify a region for every statement. In this case, the region scope that exists at the procedure's call site is propagated into the body of the procedure and applied to individual statements as needed. An example is shown in Section 4.2.3. It is an error if no region scope of the proper rank is applied to the call site.

Regions do not affect control flow. Regions can be viewed as providing index sets for expressions that require them. Thus, applying a region to a statement that has no parallel variables has no effect. Furthermore, a statement may have multiple regions of different rank applied to it; this is needed for operations that involve operands of different rank (e.g. partial reductions; see Section 5.2) and is sometimes useful for compound statements.



Kay Nettle
Fri Feb 21 21:14:29 CST 1997