Reshaped doc's
[fw/sdcc] / doc / sdccman.html / node40.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2
3 <!--Converted with LaTeX2HTML 99.1 release (March 30, 1999)
4 original version by:  Nikos Drakos, CBLU, University of Leeds
5 * revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
6 * with significant contributions from:
7   Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8 <HTML>
9 <HEAD>
10 <TITLE>4.2 Pragmas</TITLE>
11 <META NAME="description" CONTENT="4.2 Pragmas">
12 <META NAME="keywords" CONTENT="sdccman">
13 <META NAME="resource-type" CONTENT="document">
14 <META NAME="distribution" CONTENT="global">
15
16 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
17 <META NAME="Generator" CONTENT="LaTeX2HTML v99.1 release">
18 <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
19
20 <LINK REL="STYLESHEET" HREF="sdccman.css">
21
22 <LINK REL="next" HREF="node41.html">
23 <LINK REL="previous" HREF="node39.html">
24 <LINK REL="up" HREF="node38.html">
25 <LINK REL="next" HREF="node41.html">
26 </HEAD>
27
28 <BODY >
29 <!--Navigation Panel-->
30 <A NAME="tex2html866"
31  HREF="node41.html">
32 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
33 <A NAME="tex2html860"
34  HREF="node38.html">
35 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
36 <A NAME="tex2html854"
37  HREF="node39.html">
38 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> 
39 <A NAME="tex2html862"
40  HREF="node1.html">
41 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A> 
42 <A NAME="tex2html864"
43  HREF="node61.html">
44 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A> 
45 <BR>
46 <B> Next:</B> <A NAME="tex2html867"
47  HREF="node41.html">4.3 &lt;pending: this is</A>
48 <B> Up:</B> <A NAME="tex2html861"
49  HREF="node38.html">4. SDCC Technical Data</A>
50 <B> Previous:</B> <A NAME="tex2html855"
51  HREF="node39.html">4.1 Optimizations</A>
52  &nbsp <B>  <A NAME="tex2html863"
53  HREF="node1.html">Contents</A></B> 
54  &nbsp <B>  <A NAME="tex2html865"
55  HREF="node61.html">Index</A></B> 
56 <BR>
57 <BR>
58 <!--End of Navigation Panel-->
59
60 <H2><A NAME="SECTION00052000000000000000">
61 4.2 Pragmas</A>
62 </H2>
63
64 <P>
65 SDCC supports the following #pragma directives. This directives are
66 applicable only at a function level.
67
68 <P>
69
70 <UL>
71 <LI>SAVE - this will save all the current options.</LI>
72 <LI>RESTORE - will restore the saved options from the last save. Note
73 that SAVES &amp; RESTOREs cannot be nested. SDCC uses the same buffer
74 to save the options each time a SAVE is called.</LI>
75 <LI>NOGCSE - will stop global subexpression elimination.</LI>
76 <LI>NOINDUCTION - will stop loop induction optimizations.</LI>
77 <LI>NOJTBOUND - will not generate code for boundary value checking, when
78 switch statements are turned into jump-tables.</LI>
79 <LI>NOOVERLAY - the compiler will not overlay the parameters and local
80 variables of a function.</LI>
81 <LI>NOLOOPREVERSE - Will not do loop reversal optimization</LI>
82 <LI>EXCLUDE NONE | {acc[,b[,dpl[,dph]]] - The exclude pragma
83 disables generation of pair of push/pop instruction in ISR function
84 (using interrupt keyword). The directive should be placed immediately
85 before the ISR function definition and it affects ALL ISR functions
86 following it. To enable the normal register saving for ISR functions
87 use #pragma&nbsp;EXCLUDE&nbsp;none.</LI>
88 <LI>CALLEE-SAVES function1[,function2[,function3...]] - The compiler
89 by default uses a caller saves convention for register saving across
90 function calls, however this can cause unneccessary register pushing
91 &amp; popping when calling small functions from larger functions. This
92 option can be used to switch the register saving convention for the
93 function names specified. The compiler will not save registers when
94 calling these functions, extra code will be generated at the entry
95 &amp; exit for these functions to save &amp; restore the registers used
96 by these functions, this can SUBSTANTIALLY reduce code &amp; improve
97 run time performance of the generated code. In future the compiler
98 (with interprocedural analysis) will be able to determine the appropriate
99 scheme to use for each function call. If -callee-saves command line
100 option is used, the function names specified in #pragma&nbsp;CALLEE-SAVES
101 is appended to the list of functions specified inthe command line.</LI>
102 </UL>
103 The pragma's are intended to be used to turn-off certain optimizations
104 which might cause the compiler to generate extra stack / data space
105 to store compiler generated temporary variables. This usually happens
106 in large functions. Pragma directives should be used as shown in the
107 following example, they are used to control options &amp; optimizations
108 for a given function; pragmas should be placed before and/or after
109 a function, placing pragma's inside a function body could have unpredictable
110 results.
111 <BR>
112
113 <BR>
114 <TT>#pragma SAVE /* save the current settings */ </TT>&nbsp;
115 <BR>
116 <TT>#pragma NOGCSE /* turnoff global subexpression elimination
117 */ </TT>&nbsp;
118 <BR>
119 <TT>#pragma NOINDUCTION /* turn off induction optimizations
120 */ </TT>&nbsp;
121 <BR>
122 <TT>int foo () </TT>&nbsp;
123 <BR>
124 <TT>{ </TT>&nbsp;
125 <BR>
126 <TT>&nbsp; &nbsp; ... </TT>&nbsp;
127 <BR>
128 <TT>&nbsp; &nbsp; /* large code */ </TT>&nbsp;
129 <BR>
130 <TT>&nbsp; &nbsp; ... </TT>&nbsp;
131 <BR>
132 <TT>} </TT>&nbsp;
133 <BR>
134 <TT>#pragma RESTORE /* turn the optimizations back on */</TT>
135 <BR>
136
137 <BR>
138 The compiler will generate a warning message when extra space is allocated.
139 It is strongly recommended that the SAVE and RESTORE pragma's be used
140 when changing options for a function.
141
142 <P>
143 <HR>
144 <!--Navigation Panel-->
145 <A NAME="tex2html866"
146  HREF="node41.html">
147 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
148 <A NAME="tex2html860"
149  HREF="node38.html">
150 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
151 <A NAME="tex2html854"
152  HREF="node39.html">
153 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> 
154 <A NAME="tex2html862"
155  HREF="node1.html">
156 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A> 
157 <A NAME="tex2html864"
158  HREF="node61.html">
159 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A> 
160 <BR>
161 <B> Next:</B> <A NAME="tex2html867"
162  HREF="node41.html">4.3 &lt;pending: this is</A>
163 <B> Up:</B> <A NAME="tex2html861"
164  HREF="node38.html">4. SDCC Technical Data</A>
165 <B> Previous:</B> <A NAME="tex2html855"
166  HREF="node39.html">4.1 Optimizations</A>
167  &nbsp <B>  <A NAME="tex2html863"
168  HREF="node1.html">Contents</A></B> 
169  &nbsp <B>  <A NAME="tex2html865"
170  HREF="node61.html">Index</A></B> 
171 <!--End of Navigation Panel-->
172 <ADDRESS>
173 <I>Johan Knol</I>
174 <BR><I>2001-07-13</I>
175 </ADDRESS>
176 </BODY>
177 </HTML>