#pragma directives are used within the source program to request certain kinds of special processing. #pragma directives are part of the C and C++ languages, but the meaning of any #pragma directive is defined by the implementation.
#pragma directives are expressed in the following form:
#pragma identifier [arguments]
Compiler directives can also be specified in the following form, which has the advantage in that it can appear inside macro definitions:
This form has the same effect as using the #pragma form, except that everything that appeared on the line following the #pragma must now appear inside the double quotation marks and parentheses. The expression inside the parentheses must be a single string literal, but it cannot be a macro that expands into a string literal. _Pragma is a SGI extension to the C and C++ standards.
The following is an example using the #pragma form:
#pragma ivdep #pragma parallel local(i, j, k) \ shared(a, b, c)
The following is the same example using the alternative form:
_Pragma("ivdep") _Pragma("parallel local(i, j, k) \ shared(a, b, c)")
Macro expansion occurs on the directive line after the directive name. (That is, macro expansion is applied only to arguments.) For example, if NUM_CHUNKS is a macro defined as the value 8, the original code is as follows:
#define NUM_CHUNKS 8 _Pragma("parallel numchunks(NUM_CHUNKS)")
Table 1-1, is an alphabetical list of SGI supported #pragma directives, with a short description of each and a link to the chapter where the directive is discussed.
aggressive inner loop fission
Fission inner loops into as many loops as possible.
Specifies alignment of user variables, typically at cache-line or page boundaries.
Sets the blocksize of the specified loop that is involved in a blocking for the primary (secondary) cache.
Indicates that the specified declaration can be instantiated in the current compilation, but need not be.
Tells the compiler to ignore assumed dependences in the following loop.
Tells the compiler that the function calls in the following loop are safe to execute in parallel.
Tells the compiler to parallelize the next loop, overriding any #pragma no concurrentize directive that may apply to that loop.
Copies the value from the master thread's version of an -Xlocal-linked global variable into the slave thread's version.
Protects access to critical statements.
Specifies data distribution.
Specifies data distribution with reshaping.
Prevents instantiation of the specific declaration in this compilation unit, even if that instance is used in the code.
Tells the compiler that the specified array may be redistributed in the program.
Indicates the point that all threads must clear before any threads are allowed to pass the corresponding #pragma exit gate.
Stops threads from passing this point until all threads have cleared the corresponding #pragma enter gate .
Tells the compiler to insert any necessary padding to ensure that the user variable does not share a cache-line with any other symbol.
Fission the enclosing specified levels of loops after this directive.
Disables validity testing.
Disables validity testing.
Fuse the following specified number of loops, which must be immediately adjacent.
Indicates the point at which the precompiled header mechanism snapshots the headers. If -pch is off, #pragma hdrstop is ignored.
Tells the compiler that the specified symbols are invisible to all executables or DSOs except the current one.
Adds a .comment section in the object file and puts the revision string inside the .comment section.
Tells the compiler to run an independent code section in parallel with the rest of the code in the parallel region.
Tells the compiler to inline the named functions. Keywords: here (next statement only), routine (rest of routine or until corresponding noinline is found), and global (entire file, or until corresponding noinline is found).
Causes a specified instance of a template declaration to be immediately instantiated at that spot.
Identifies the specified function name as a function whose type was int in a previous release of the compilation system, but whose type is unsigned int in the MIPSpro compiler release.
Tells the compiler that the specified symbols are not referenced outside the current executable or DSO.
Allows certain preselected functions from math.h, stdio.h, and string.h to be inlined at a callsite for execution efficiency.
Liberalizes dependence analysis. This applies only to inner loops. Given two memory references, where at least one is loop variant, ignore any loop-carried dependences between the two references.
Tells the compiler the names of all the variables that must be local to each thread.
Specifies the expected frequency of execution so the compiler can move exception code and initialization code into separate pages to minimize working set size.
Prevents the compiler from involving this loop in cache blocking.
Varies with placement. Tells the compiler to not parallelize any loops in a subroutine or file.
Inhibits deletion of functions that are never referenced.
Keeps the following loop from being fissioned. Its innermost loops, however, are allowed to be fissioned.
Keeps the following loop from being fused with other loops.
Prevents the compiler from involving the loop directly following this directive (or any loop nested within this loop) in an interchange.
no side effects
Tells the compiler to assume that all of the named functions are safe to execute concurrently.
Disables the precompiled header mechanism.
Tells the compiler not to inline the named functions. Keywords: here (next statement only), routine (rest of routine or until corresponding inline is found), and global (entire file, or until corresponding inline is found).
Ensures (in -n32 and -64 mode) that each include file is included at most one time in each compilation unit.
Causes next statement to be executed on only one processor.
Tells the linker that the specified symbols are optional. This is the basic mechanism used for adding extensions to a library that can then be queried.
Controls the layout of structure offsets, such that the strictest alignment for any structure member will be n bytes, where n is 0, 1, 2, 4, 8, or 16. When n is 0, the compiler returns to default alignment for any subsequent struct definitions.
Controls the placement of data on a DSM (distributed shared memory) machine.
The specified array is a permutation array.
Starts a parallel region.
Marks a for loop to run in parallel.
Tells the compiler to parallelize the following loop if it is safe.
Tells the compiler not to parallelize the following loop.
Controls prefetching for each level of the cache.
Specifies whether manual prefetches (through #pragma directives) should be respected or ignored.
Generates a prefetch and connects it to the specified reference (if possible).
Explicitly disables prefetching for the specified reference.
Tells the compiler that the specified symbols are not preemptible.
|Tells the compiler that a call to named functions has no side effects and its return value depends on the values of its arguments.|
Specifies dynamic data redistribution.
Resets listed warnings to the state specified in the command line.
Causes an object to be placed in a gp_relative section.
Keeps an object from being placed in a gp_relative section.
Forces the loop immediately following it to be serial, and restricts optimization by forcing all enclosing loops to be serial also.
Tells the compiler which values to use for chunksize.
Tells the compiler which values to use for numthreads.
Tells the compiler which values to use for schedtype.
Suppresses listed compiler warnings.
Tells the compiler the names of all the variables that the threads must share.
Stops threads until all threads reach this point. This directive is a classic barrier construct.
Indicates which procedures have a nonstandard control flow behavior.
Suggests to the compiler that n-1 copies of the loop body be added to the inner loop. If the loop following this directive is an inner loop, then it indicates standard unrolling (version 7.2 and later). If the loop following this directive is not innermost, then outer loop unrolling (unroll and jam) is performed (version 7.0 and later).
weak weak_symbol = strong_symbol
Sets weak_symbol to be an alias for the function or data object denoted by strong_symbol , unless a defining declaration for weak_symbol is encountered at static link time. If encountered, the defining declaration preempts the weak denotation.
Tells the link editor not to issue a warning if it does not find a defining declaration of weak_symbol . Also allows the overriding of a current definition by a non-weak definition.