next up previous contents index
Next: 4.3 <pending: this is Up: 4. SDCC Technical Data Previous: 4.1 Optimizations   Contents   Index

4.2 Pragmas

SDCC supports the following #pragma directives. This directives are applicable only at a function level.

The pragma's are intended to be used to turn-off certain optimizations which might cause the compiler to generate extra stack / data space to store compiler generated temporary variables. This usually happens in large functions. Pragma directives should be used as shown in the following example, they are used to control options & optimizations for a given function; pragmas should be placed before and/or after a function, placing pragma's inside a function body could have unpredictable results.

#pragma SAVE /* save the current settings */  
#pragma NOGCSE /* turnoff global subexpression elimination */  
#pragma NOINDUCTION /* turn off induction optimizations */  
int foo ()  
{  
    ...  
    /* large code */  
    ...  
}  
#pragma RESTORE /* turn the optimizations back on */

The compiler will generate a warning message when extra space is allocated. It is strongly recommended that the SAVE and RESTORE pragma's be used when changing options for a function.


next up previous contents index
Next: 4.3 <pending: this is Up: 4. SDCC Technical Data Previous: 4.1 Optimizations   Contents   Index
Johan Knol
2001-07-13