suppress

Date:

02-06-2023

NAME

suppress - suppresses scalar optimization for variables by directing variables to be stored in local memory.

SYNOPSIS

Global scope suppress directive C/C++:

#pragma _CRI suppress func...
func

The specified function, for which all associated variables will be written to local memory before that function is called.

Local scope suppress directive C/C++:

#pragma _CRI suppress [var] ...
var

Variable that is to be stored to memory.If more than one variable is specified, use a comma to separate vars.

Suppress directive in Fortran:

!DIR$ SUPPRESS [var[var]]...
var

Variable that is to be stored to memory. If more than one variable is specified, use a comma to separate vars. If no variables are listed when using the Fortran directive, all variables in the program unit are stored to memory.

DESCRIPTION: C/C++

Scope: Local and Global

The suppress directive suppresses optimization in two ways, determined by its use with either global or local scope.

The global scope suppress directive specifies that all associated local variables are to be written to memory before a call to the specified function. This ensures that the value of the variables will always be current.

The local scope suppress directive stores current values of the specified variables in memory. If the directive lists no variables, all variables are stored to memory. This directive causes the values of these variables to be reloaded from memory at the first reference following the directive.

The net effect of the local suppress directive is similar to declaring the affected variables to be volatile except that the volatile qualifier affects the entire program, whereas the local suppress directive affects only the block of code in which it resides.

DESCRIPTION: Fortran

Scope: Local and Global

The SUPPRESS directive suppresses scalar optimization for all variables or only for those specified at the point where the directive appears. This often prevents or adversely affects vectorization of any loop that contains SUPPRESS.

At the point at which !DIR$ SUPPRESS appears in the source code, variables in registers are stored to memory (to be read out at their next reference), and expressions containing any of the affected variables are recomputed at their next reference after !DIR$ SUPPRESS. The effect on optimization is equivalent to that of an external subroutine call with an argument list that includes the variables specified by !DIR$ SUPPRESS (or, if no variable list is included, all variables in the program unit).

Example 1: SUPPRESS directive

Below is an example of the SUPPRESS directive used with an IF statement. The directive takes effect only if it is on an execution path. Optimization proceeds normally if the directive path is not executed because of a GOTO or IF. In this example, optimization replaces the reference to A in the PRINT statement with the constant 1.0, even though !DIR$ SUPPRESS appears between A=1.0 and the PRINT statement. The IF statement can cause the execution path to bypass !DIR$ SUPPRESS. If SUPPRESS appears before the IF statement, A in PRINT * is not replaced by the constant 1.0.

SUBROUTINE SUB (L)
   LOGICAL L
   A = 1.0 ! A is local
   IF (L) THEN
!DIR$ SUPPRESS ! Has no effect if L is false
      CALL ROUTINE()
   ELSE
      PRINT *, A
   END IF
END

SEE ALSO

intro_directives(7)