EasyManua.ls Logo

Intel i960 - Pragma Pure

Intel i960
347 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Language Implementation
7-37
7
#pragma pure
Specifies that a function has no effects other than returning a computed
value and that it does so based solely on its input parameters.
#pragma [no]pure [ (
function
[,... ] ) ]
function
identifies the specific function to which the
pragma applies. If
function
is missing, the
effect of the pragma is applied to all functions
called in the compilation module following the
pragma. If a function name is specified, the
pragma must be placed before the function
definition.
Default
The compiler assumes functions are not pure and does not perform
optimizations possible with pure functions.
Discussion
pragma pure informs the compiler that a named function has no effects
other than returning a computed value and that it does so based solely on
its input parameters. Specifically, the compiler assumes the following
about the function:
No I/O is performed.
No global variables or memory locations are read or modified.
No modifications of registers occur, except those explicitly defined by
the calling sequence.
This knowledge enables the compiler to perform optimizations around
function calls, optimizations it could not perform without this knowledge.
If a function is “pure”, then the compiler can perform (around that
function call) constant propagation, common subexpression elimination,
global-variable migration, and dead-code elimination.

Table of Contents

Related product manuals