Go to single file .html
[fw/sdcc] / doc / SDCCUdoc-4.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.7">
5  <TITLE>SDCC Compiler User Guide: Command Line options</TITLE>
6  <LINK HREF="SDCCUdoc-5.html" REL=next>
7  <LINK HREF="SDCCUdoc-3.html" REL=previous>
8  <LINK HREF="SDCCUdoc.html#toc4" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="SDCCUdoc-5.html">Next</A>
12 <A HREF="SDCCUdoc-3.html">Previous</A>
13 <A HREF="SDCCUdoc.html#toc4">Contents</A>
14 <HR>
15 <H2><A NAME="Command Line Options"></A> <A NAME="s4">4. Command Line options</A> </H2>
16
17 <P>
18 <UL>
19 <LI><B>--model-large
20 <A NAME="--model-large"></A> </B> Generate code for Large model programs see section Memory
21 Models for more details. If this option is used all source files in the project
22 should be compiled with this option. In addition the standard library routines
23 are compiled with small model , they will need to be recompiled.</LI>
24 <LI><B>--model-small</B> 
25 <A NAME="--model-small"></A> Generate code for Small Model programs see section Memory
26 Models for more details. This is the default model.</LI>
27 <LI><B>--model-flat24</B> 
28 <A HREF="SDCCUdoc-17.html#--model-flat24">--model-flat24</A>Generate code for Small Model programs see section Memory
29 Models for more details. This is the default model.</LI>
30 <LI><B>--stack-auto</B> 
31 <A NAME="--stack-auto"></A> All functions in the source file will be compiled as reentrant,
32 i.e. the parameters and local variables will be allocated on the stack. see
33 section Parameters and Local Variables for more details. If this option is
34 used all source files in the project should be compiled with this option. </LI>
35 <LI><B>--xstack</B>
36 <A NAME="--xstack"></A>  Uses a pseudo stack in the first 256 bytes in the external ram
37 for allocating variables and passing parameters. See section on external stack
38 for more details.</LI>
39 <LI><B>--nogcse</B>
40 <A NAME="--nogcse"></A>  Will not do global subexpression elimination, this option may
41 be used when the compiler creates undesirably large stack/data spaces to store
42 compiler temporaries. A warning message will be generated when this happens
43 and the compiler will indicate the number of extra bytes it allocated. It recommended
44 that this option NOT be used , #pragma NOGCSE can be used to turn off global
45 subexpression elimination for a given function only.</LI>
46 <LI><B>--noinvariant</B>
47 <A NAME="--noinvariant"></A>  Will not do loop invariant optimizations, this may be turned
48 off for reasons explained for the previous option . For more details of loop
49 optimizations performed see section Loop Invariants.It recommended that this
50 option NOT be used , #pragma NOINVARIANT can be used to turn off invariant
51 optimizations for a given function only.</LI>
52 <LI><B>--noinduction</B>
53 <A NAME="--noinduction"></A>  Will not do loop induction optimizations, see section Strength
54 reduction for more details.It recommended that this option NOT be used , #pragma
55 NOINDUCTION can be used to turn off induction optimizations for given function
56 only.</LI>
57 <LI><B>--nojtbound </B>
58 <A NAME="--nojtbound"></A>  Will not generate boundary condition check when switch statements
59 are implemented using jump-tables. See section Switch Statements for more details.It
60 recommended that this option NOT be used , #pragma NOJTBOUND can be used
61 to turn off boundary checking for jump tables for a given function only.</LI>
62 <LI><B>--noloopreverse</B> 
63 <A NAME="--noloopreverse"></A> Will not do loop reversal optimization</LI>
64 <LI><B>--noregparms</B>
65 <A NAME="--noregparms"></A>  By default the first parameter is passed using global registers
66 (DPL,DPH,B,ACC). This option will disable parameter passing using registers.
67 NOTE: if your program uses the 16/32 bit support routines (for multiplication/division)
68 these library routines will need to be recompiled with the --noregparms option
69 as well.</LI>
70 <LI><B>--callee-saves function1[,function2][,function3]....</B>
71 <A NAME="--callee-saves"></A> The compiler by default uses a caller saves convention for register saving
72 across function calls, however this can cause unneccessary register pushing
73 &amp; popping when calling small functions from larger functions. This option
74 can be used to switch the register saving convention for the function names
75 specified. The compiler will not save registers when calling these functions,
76 extra code will be generated at the entry &amp; exit for these functions to
77 save &amp; restore the registers used by these functions, this can SUBSTANTIALLY
78 reduce code &amp; improve run time performance of the generated code. In future
79 the compiler (with interprocedural analysis) will be able to determine the
80 appropriate scheme to use for each function call. DO NOT use this option for
81 built-in functions such as _muluint..., if this option is used for a library
82 function the appropriate library function needs to be recompiled with the same
83 option. If the project consists of multiple source files then all the source
84 file should be compiled with the same --callee-saves option string. Also see
85 Pragma Directive
86 <A HREF="SDCCUdoc-19.html#Pragmaa"></A> CALLEE-SAVES.
87 <A HREF="SDCCUdoc-19.html#pragma callee-saves"></A> .</LI>
88 <LI><B>--debug </B>
89 <A NAME="--debug"></A> When this option is used the compiler will generate debug information
90 , that can be used with the SDCDB. The debug information is collected in a
91 file with .cdb extension. For more information see documentation for SDCDB.</LI>
92 <LI><B>--regextend </B>
93 <A NAME="--regextend"></A>  This option will cause the compiler to define pseudo registers
94 , if this option is used, all source files in the project should be compiled
95 with this option. See section Register Extension for more details.</LI>
96 <LI><B>--compile-only</B>(-c) 
97 <A NAME="--compile-only"></A>  will compile and assemble the source only, will not
98 call the linkage editor.</LI>
99 <LI><B>--xram-loc </B>
100 <A NAME="--xram-loc"></A> &lt;Value&gt; The start location of the external ram, default
101 value is 0. The value entered can be in Hexadecimal or Decimal format .eg.
102 --xram-loc 0x8000 or --xram-loc 32768.</LI>
103 <LI><B>--code-loc </B>
104 <A NAME="--code-loc"></A> &lt;Value&gt; The start location of the code segment , default
105 value 0. Note when this option is used the interrupt vector table is also relocated
106 to the given address. The value entered can be in Hexadecimal or Decimal format
107 .eg. --code-loc 0x8000 or --code-loc 32768.</LI>
108 <LI><B>--stack-loc</B>
109 <A NAME="--stack-loc"></A> &lt;Value&gt; The initial value of the stack pointer. The default
110 value of the stack pointer is 0x07 if only register bank 0 is used, if other
111 register banks are used then the stack pointer is initialized to the location
112 above the highest register bank used. eg. if register banks 1 &amp; 2 are used
113 the stack pointer will default to location 0x18. The value entered can be in
114 Hexadecimal or Decimal format .eg. --stack-loc 0x20 or --stack-loc 32. If all
115 four register banks are used the stack will be placed after the data segment
116 (equivalent to --stack-after-data)</LI>
117 <LI><B>--stack-after-data</B>
118 <A NAME="--stack-after-data"></A> This option will cause the stack to be located in the
119 internal ram after the data segment.</LI>
120 <LI><B>--data-loc</B> 
121 <A NAME="--data-loc"></A> &lt;Value&gt; The start location of the internal ram data segment,
122 the default value is 0x30.The value entered can be in Hexadecimal or Decimal
123 format .eg. --data-loc 0x20 or --data-loc 32.</LI>
124 <LI><B>--idata-loc</B>
125 <A NAME="--idata-loc"></A> &lt;Value&gt; The start location of the indirectly addressable
126 internal ram, default value is 0x80. The value entered can be in Hexadecimal
127 or Decimal format .eg. --idata-loc 0x88 or --idata-loc 136.</LI>
128 <LI><B>--peep-file
129 <A NAME="--peep-file"></A>  </B>&lt;filename&gt; This option can be used to use additional
130 rules to be used by the peep hole optimizer. See section Peep Hole optimizations
131 for details on how to write these rules.</LI>
132 <LI><B>--lib-path (-L) </B>
133 <A NAME="--lib-path"></A> &lt;absolute path to additional libraries&gt; This option
134 is passed to the linkage editor, additional libraries search path. The path
135 name must be absolute. Additional library files may be specified in the command
136 line . See section Compiling programs for more details.</LI>
137 <LI><B>-I &lt;path&gt;
138 <A NAME="-I"></A> </B> The additional location where the pre processor will look
139 for &lt;..h&gt; or "..h" files.</LI>
140 <LI><B>-D&lt;macro[=value]&gt;</B> 
141 <A NAME="-D"></A> Command line definition of macros. Passed
142 to the pre processor.</LI>
143 <LI><B>-E</B>
144 <A NAME="-E"></A>  Run only the C preprocessor. Preprocess all the C source files specified
145 and output the results to standard output.</LI>
146 <LI><B>-M
147 <A NAME="-M"></A> </B> Tell the preprocessor to output a rule suitable for make describing
148 the dependencies of each object file. For each source file, the preprocessor
149 outputs one make-rule whose target is the object file name for that source
150 file and whose dependencies are all the files `#include'd in it. This rule
151 may be a single line or may be continued with `\'-newline if it is long.
152 The list of rules is printed on standard output instead of the preprocessed
153 C program. `-M' implies `-E'.</LI>
154 <LI><B>-C</B> 
155 <A NAME="-C"></A> Tell the preprocessor not to discard comments. Used with the `-E' option.</LI>
156 <LI><B>-MM </B>
157 <A NAME="-MM"></A> Like `-M' but the output mentions only the user header files included
158 with `#include file&quot;'. System header files included with `#include
159 &lt;file&gt;' are omitted.</LI>
160 <LI><B>-Aquestion(answer)</B>
161 <A NAME="-Aquestion(answer)"></A>  Assert the answer answer for question, in case it is
162 tested with a preprocessor conditional such as `#if #question(answer)'.
163 `-A-' disables the standard asser- tions that normally describe the target
164 machine.</LI>
165 <LI><B>-Aquestion</B>
166 <A NAME="-Aquestion"></A>  (answer) Assert the answer answer for question, in case it is
167 tested with a preprocessor conditional such as `#if #question(answer)'.
168 `-A-' disables the standard assertions that normally describe the target machine.</LI>
169 <LI><B>-Umacro</B>
170 <A NAME="-Umacro"></A>  Undefine macro macro. `-U' options are evaluated after all `-D'
171 options, but before any `-include' and `-imac- ros' options.</LI>
172 <LI><B>-dM</B>
173 <A NAME="-dM"></A>  Tell the preprocessor to output only a list of the mac- ro definitions
174 that are in effect at the end of prepro- cessing. Used with the `-E' option.</LI>
175 <LI><B>-dD</B> 
176 <A NAME="-dD"></A> Tell the preprocessor to pass all macro definitions into the output,
177 in their proper sequence in the rest of the output.</LI>
178 <LI><B>-dN </B>
179 <A NAME="-dN"></A> Like `-dD' except that the macro arguments and contents are omitted.
180 Only `#define name' is included in the output.</LI>
181 <LI><B>-S </B>
182 <A NAME="-S"></A> Stop after the stage of compilation proper; do not as- semble. The output
183 is an assembler code file for the input file specified.</LI>
184 <LI><B>-Wa asmOption[,asmOption]</B>... Pass the asmOption to the assembler</LI>
185 <LI><B>-Wl linkOption[,linkOption]</B> .. Pass the linkOption to the linker.</LI>
186 <LI><B>--int-long-reent</B> 
187 <A NAME="--int-long-rent"></A>  Integer (16 bit) and long (32 bit) libraries have been
188 compiled as reentrant. Note by default these libraries are compiled as non-reentrant.
189 See section Installation for more details.</LI>
190 <LI><B>--cyclomatic </B>
191 <A NAME="--cyclomatic"></A> This option will cause the compiler to generate an information
192 message for each function in the source file. The message contains some important
193 information about the function. The number of edges and nodes the compiler
194 detected in the control flow graph of the function, and most importantly the
195 cyclomatic complexity see section on Cyclomatic Complexity for more details.</LI>
196 <LI><B>--float-reent </B>
197 <A NAME="--float-reent"></A>  Floating point library is compiled as reentrant.See section
198 Installation for more details.</LI>
199 <LI><B>--out-fmt-ihx
200 <A NAME="--out-fmt-ihx"></A>  </B>The linker output (final object code) is in Intel Hex format.
201 (This is the default option).</LI>
202 <LI><B>--out-fmt-s19 </B>
203 <A NAME="--out-fmt-s19"></A> The linker output (final object code) is in Motorola S19
204 format.</LI>
205 <LI><B>--nooverlay</B> 
206 <A NAME="--nooverlay"></A>  The compiler will not overlay parameters and local variables
207 of any function, see section Parameters and local variables for more details.</LI>
208 <LI><B>--main-return</B>
209 <A NAME="--main-return"></A>  This option can be used when the code generated is called
210 by a monitor program. The compiler will generate a 'ret' upon return from the
211 'main' function. The default option is to lock up i.e. generate a 'ljmp .'
212 .</LI>
213 <LI><B>--no-peep</B> 
214 <A NAME="--no-peep"></A>  Disable peep-hole optimization.</LI>
215 <LI><B>--peep-asm</B> 
216 <A NAME="--peep-asm"></A>  Pass the inline assembler code through the peep hole optimizer.
217 Can cause unexpected changes to inline assembler code , please go through the
218 peephole optimizer rules defnied in file 'SDCCpeeph.def' before using this
219 option.</LI>
220 <LI><B>--iram-size</B>
221 <A NAME="--iram-size"></A>  &lt;Value&gt; Causes the linker to check if the interal ram
222 usage is within limits of the given value.</LI>
223 </UL>
224 <P>The following options are provided for the purpose of retargetting and
225 debugging the compiler . These provided a means to dump the intermediate code
226 (iCode) generated by the compiler in human readable form at various stages
227 of the compilation process. 
228 <P>
229 <UL>
230 <LI><B>--dumpraw </B>
231 <A NAME="--dumpraw"></A> . This option will cause the compiler to dump the intermediate
232 code into a file of named &lt;source filename&gt;.dumpraw just after the intermediate
233 code has been generated for a function , i.e. before any optimizations are
234 done. The basic blocks at this stage ordered in the depth first number, so
235 they may not be in sequence of execution.</LI>
236 <LI><B>--dumpgcse</B>.
237 <A NAME="--dumpgcse"></A>  Will create a dump if iCode, after global subexpression elimination,
238 into a file named &lt;source filename&gt;.dumpgcse.</LI>
239 <LI><B>--dumpdeadcode </B>
240 <A NAME="--dumpdeadcode"></A> .Will create a dump if iCode, after deadcode elimination,
241 into a file named &lt;source filename&gt;.dumpdeadcode.</LI>
242 <LI><B>--dumploop.</B> 
243 <A NAME="--dumploop"></A> Will create a dump if iCode, after loop optimizations, into
244 a file named &lt;source filename&gt;.dumploop.</LI>
245 <LI><B>--dumprange.</B> 
246 <A NAME="--dump-range"></A> Will create a dump if iCode, after live range analysis, into
247 a file named &lt;source filename&gt;.dumprange.</LI>
248 <LI><B>--dumpregassign. </B>
249 <A NAME="--dumpregassign"></A> Will create a dump if iCode, after register assignment
250 , into a file named &lt;source filename&gt;.dumprassgn.</LI>
251 <LI><B>--dumpall. </B>
252 <A NAME="--dumpall"></A> Will cause all the above mentioned dumps to be created.</LI>
253 </UL>
254 <P>Note that the files created for the dump are appended to each time. So
255 the files should be deleted manually , before each dump is created. 
256 <P>When reporting bugs, it will be very helpful if you could include these
257 dumps along with the portion of the code that is causing the problem.
258 <HR>
259 <A HREF="SDCCUdoc-5.html">Next</A>
260 <A HREF="SDCCUdoc-3.html">Previous</A>
261 <A HREF="SDCCUdoc.html#toc4">Contents</A>
262 </BODY>
263 </HTML>