Description
The #pragma isolated_call directive lists functions that do not alter data objects visible at the time of the function call. The pragma isolated_call can be enabled or disabled using the opt(pragmaisolatedcall, ...) option in the configuration file.
Syntax
where function is a primary expression that can be an identifier, operator function, conversion function, or qualified name. Identifiers must be of type function or a typedef of function. If a name refers to an overloaded function, all variants of that function are marked as isolated calls.
The pragma informs the compiler that none of the functions listed has side effects. Functions are considered to have side effects if they:
Essentially, any change in the state of the runtime environment is considered a side effect. Passing function arguments by reference is one side effect that is allowed, but in general, functions with side effects can give incorrect results when listed in #pragma isolated_call directives.
Marking a function as isolated indicates to the optimizer that external and static variables cannot be changed by the called function and that references to storage can be deleted from the calling function where appropriate. Instructions can be reordered with more freedom, resulting in fewer pipeline delays and faster execution in the processor.
Functions specified in the identifier list are permitted to examine external objects and return results that depend on the state of the runtime environment. The functions can also modify the storage pointed to by any pointer arguments passed to the function, that is, calls by reference. Do not specify a function that calls itself or relies on local static storage. Listing such functions in the #pragma isolated_call directive can give unpredictable results.
Example using #pragma isolated_call,
int a, this_function(int); // Assumed to have no side effects
#pragma isolated_call(this_function)
that_function()
{
a = 6;
this_function(7); // Call does not change the value of "a"
other_function(a); // Argument "a" has the value 6
}
![]()
Preprocessor Directives - An
Overview
Preprocessor Directive -
#pragma
![]()
isolated call
optimization option - opt(pragmaisolatedcall)
Example of #pragma
isolated_call
