dead code elimination
\layout Itemize
-jumptables for
+jump tables for
\emph on
switch
\emph default
(8 bits) which is not ANSI compliant
\layout Itemize
-the default directory for gcc-builds where include, library and documention
+the default directory for gcc-builds where include, library and documentation
files are stored is now in /usr/local/share
\layout Itemize
The install paths, search paths and other options are defined when running
'configure'.
- The defaults can be overriden by:
+ The defaults can be overridden by:
\layout List
\labelwidthstring 00.00.0000
/
\end_inset
--prefix see tabel below
+-prefix see table below
\layout List
\labelwidthstring 00.00.0000
/
\end_inset
--exec_prefix see tabel below
+-exec_prefix see table below
\layout List
\labelwidthstring 00.00.0000
/
\end_inset
--bindir see tabel below
+-bindir see table below
\layout List
\labelwidthstring 00.00.0000
/
\end_inset
--datadir see tabel below
+-datadir see table below
\layout List
\labelwidthstring 00.00.0000
-docdir environment variable, see tabel below
+docdir environment variable, see table below
\layout List
\labelwidthstring 00.00.0000
-include_dir_suffix environment variable, see tabel below
+include_dir_suffix environment variable, see table below
\layout List
\labelwidthstring 00.00.0000
-lib_dir_suffix environment variable, see tabel below
+lib_dir_suffix environment variable, see table below
\layout List
\labelwidthstring 00.00.0000
\layout LyX-Code
./configure
-\layout LyX-Code
+\newline
+./configure -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
-./configure --prefix=
+-prefix=
\begin_inset Quotes srd
\end_inset
\begin_inset Quotes srd
\end_inset
- --datadir=
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-datadir=
\begin_inset Quotes srd
\end_inset
\end_inset
-\layout LyX-Code
+\newline
+./configure -
+\begin_inset ERT
+status Collapsed
-./configure --disable-avr-port --disable-xa51-port
\layout Standard
-To crosscompile on linux for Mingw32 (see also 'sdcc/support/scripts/sdcc_mingw3
-2'):
-\layout LyX-Code
+\backslash
+/
+\end_inset
+
+-disable-avr-port -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
-./configure
\backslash
+/
+\end_inset
+-disable-xa51-port
+\layout Standard
+
+To cross compile on linux for Mingw32 (see also 'sdcc/support/scripts/sdcc_mingw
+32'):
\layout LyX-Code
- CC=
+./configure
+\backslash
+
+\newline
+CC=
\begin_inset Quotes srd
\end_inset
\backslash
-
-\layout LyX-Code
-
- RANLIB=
+
+\newline
+RANLIB=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- STRIP=
+\newline
+STRIP=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --prefix=
+-prefix=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --datadir=
+-datadir=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- docdir=
+\newline
+docdir=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- include_dir_suffix=
+\newline
+include_dir_suffix=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- lib_dir_suffix=
+\newline
+lib_dir_suffix=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- sdccconf_h_dir_separator=
+\newline
+sdccconf_h_dir_separator=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --disable-device-lib-build
+-disable-device-lib-build
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --disable-ucsim
+-disable-ucsim
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-host=i586-mingw32msvc -
+\begin_inset ERT
+status Collapsed
- --host=i586-mingw32msvc --build=unknown-unknown-linux-gnu
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-build=unknown-unknown-linux-gnu
\layout Standard
To
./configure -C
\backslash
-\layout LyX-Code
-
- CFLAGS=
+\newline
+CFLAGS=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- LDFLAGS=
+\newline
+LDFLAGS=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --prefix=
+-prefix=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --datadir=
+-datadir=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- docdir=
+\newline
+docdir=
\begin_inset Quotes srd
\end_inset
\backslash
-
-\layout LyX-Code
-
- include_dir_suffix=
+
+\newline
+include_dir_suffix=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- lib_dir_suffix=
+\newline
+lib_dir_suffix=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
-
- sdccconf_h_dir_separator=
+\newline
+sdccconf_h_dir_separator=
\begin_inset Quotes srd
\end_inset
\backslash
-\layout LyX-Code
+\newline
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
- --disable-ucsim
+-disable-ucsim
\layout Standard
'configure' is quite slow on Cygwin (at least on windows before Win2000/XP).
./configure CC=gcc2 CXX=g++2
\layout Subsubsection
-Crosscompiling SDCC on Linux for Windows
+Cross compiling SDCC on Linux for Windows
\layout Standard
-With the Mingw32 gcc crosscompiler it's easy to compile SDCC for Win32.
+With the Mingw32 gcc cross compiler it's easy to compile SDCC for Win32.
See section 'Configure Options'.
\layout Subsubsection
Replace in your cygwin.bat the line
\layout LyX-Code
-bash --login -i
+bash -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-login -i
\layout Standard
with (one line):
rxvt -sl 1000 -fn "Lucida Console-12" -sr -cr red
\layout LyX-Code
- -bg black -fg white -geometry 100x65 -e bash --login
+ -bg black -fg white -geometry 100x65 -e bash -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-login
\layout Standard
Text selected with the mouse is automatically copied to the clipboard, pasting
\backslash
bin_vc to sdcc
\backslash
-bin before runing SDCC.
+bin before running SDCC.
\newline
sdcdb.exe (which currently doesn't build under Borland C++).
\layout Enumerate
-If you modify any source files and need to rebuild, be aware that the dependanci
+If you modify any source files and need to rebuild, be aware that the dependenci
es may not be correctly calculated.
The safest option is to delete all .obj files and run the build again.
- From a Cygwin BASH prompt, this can easily be done with the commmand:
+ From a Cygwin BASH prompt, this can easily be done with the command:
\newline
\newline
\newline
\newline
-or on Windows NT/2000/XP from the command prompt with the commmand:
+or on Windows NT/2000/XP from the command prompt with the command:
\newline
\family sans
Make sure the compiler works on a very simple example.
Type in the following test.c program using your favorite
\series default
-ascii
+ASCII
\series medium
editor:
-\series default
+\layout Verse
-\newline
\family typewriter
-
-\newline
char test;
\newline
test=0;
\newline
}
-\family default
-
-\newline
-
-\emph on
+\layout Standard
-\newline
\series medium
-\emph default
Compile this using the following command:
\family sans
\series bold
\series medium
header files and libraries.
Edit test.c and change it to the following:
-\series default
-
-\newline
+\layout Verse
-\newline
\family typewriter
#include <string.h>
strcpy(str1, "testing");
\newline
}
-\newline
+\layout Standard
-\newline
-\family default
\series medium
Compile this by typing
\family sans
\series medium
(see the Install trouble-shooting section for suggestions).
+
+\series default
+ To find exactly where SDCC is looking for the include files try compiling
+ using
+\family sans
+\series bold
+-
+\family default
+\series default
+V
+\begin_inset LatexCommand \index{-V}
+
+\end_inset
+
+.
\layout Subsection
Install Trouble-shooting
.
\newline
-On most systems you will need super-user privilages to do this.
+On most systems you will need super-user privileges to do this.
\layout Subsection
Components of SDCC
).
The simulator is built as part of the build process.
- For more information visit Daniel's website at:
+ For more information visit Daniel's web site at:
\begin_inset LatexCommand \url{http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51}
\end_inset
.
- It currently support the core mcs51, the Dallas DS80C390 and the Philips
+ It currently support the core mcs51, the Dallas DS80C390 and the Phillips
XA51 family.
\layout Subsubsection
\noun default
file specified in the command line, since the linkage editor processes
file in the order they are presented to it.
+ The linker is invoked from sdcc using a script file with extension .lnk
+\begin_inset LatexCommand \index{.lnk}
+
+\end_inset
+
+.
+ You can view this file to troubleshoot linking problems such as those arising
+ from missing libraries.
\layout Subsubsection
Projects with Additional Libraries
\newline
\newline
-The most efficient way to use libraries is to keep seperate modules in seperate
+The most efficient way to use libraries is to keep separate modules in separate
source files.
- The lib file now should name all the modules.rel files.
+ The lib file now should name all the modules.rel
+\begin_inset LatexCommand \index{rel}
+
+\end_inset
+
+ files.
For an example see the standard library file
\emph on
libsdcc.lib
\series default
- Generate code for the Philips XA51
+ Generate code for the Phillips XA51
\begin_inset LatexCommand \index{XA51}
\end_inset
\series default
The compiler by default uses a caller saves convention for register saving
- across function calls, however this can cause unneccessary register pushing
+ across function calls, however this can cause unnecessary register pushing
& popping when calling small functions from larger functions.
This option can be used to switch the register saving convention for the
function names specified.
code will be generated at the entry & exit for these functions to save
& restore the registers used by these functions, this can SUBSTANTIALLY
reduce code & improve run time performance of the generated code.
- In the future the compiler (with interprocedural analysis) will be able
+ In the future the compiler (with inter procedural analysis) will be able
to determine the appropriate scheme to use for each function call.
DO NOT use this option for built-in functions such as _mulint..., if this
option is used for a library function the appropriate library function
\series default
Include i-codes in the asm file.
- Sounds like noise but is most helpfull for debugging the compiler itself.
+ Sounds like noise but is most helpful for debugging the compiler itself.
\layout List
\labelwidthstring 00.00.0000
\series default
Display the directories in the compiler's search path
-\layout Subsubsection
-
-Intermediate Dump Options
-\begin_inset LatexCommand \index{Options intermediate dump}
+\layout List
+\labelwidthstring 00.00.0000
-\end_inset
+\series bold
+-
+\begin_inset ERT
+status Collapsed
-\begin_inset LatexCommand \index{Intermediate dump options}
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-vc
+\begin_inset LatexCommand \index{-\/-print-search-dirs}
+
+\end_inset
+
+
+\series default
+ Display the errors and warnings using MSVC style, so you can use SDCC with
+ visual studio
+\layout Subsubsection
+
+Intermediate Dump Options
+\begin_inset LatexCommand \index{Options intermediate dump}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Intermediate dump options}
\end_inset
There are some more environment variables recognized by SDCC, but these
are solely used for debugging purposes.
- They can change or disappear very quickly, and will never be documentated.
+ They can change or disappear very quickly, and will never be documented.
\layout Subsection
MCS51/DS390 Storage Class
default
\series default
storage class for Large Memory model, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
xdata unsigned char xduc;
storage class for Small Memory model.
Variables declared with this storage class will be allocated in the internal
RAM, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
data int iramdata;
Variables declared with this storage class will be allocated into the indirectly
addressable portion of the internal ram of a 8051, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
idata int idi;
This is a data-type and a storage class specifier.
When a variable is declared as a bit, it is allocated into the bit addressable
memory of 8051, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
bit iFlag;
\emph default
signifies both a data-type and storage class, they are used to describe
the special function registers and special bit variables of a 8051, eg:
-\newline
+\layout Verse
-\newline
\family typewriter
sfr at 0x80 P0; /* special function register P0 at location 0x80 */
\newline
Pointer declaration examples:
-\newline
-
-\size small
+\layout Verse
-\newline
\family typewriter
-\size default
/* pointer physically in xternal ram pointing to object in internal ram
*/
\newline
\newline
\newline
-/* the folowing is a generic pointer physically located in xdata space */
+/* the following is a generic pointer physically located in xdata space
+ */
\newline
char * xdata p;
-\family default
-\size small
-
-\newline
-
-\newline
+\layout Standard
-\size default
Well you get the idea.
\newline
\emph default
keyword in the function declaration, e.g.:
-\newline
-
-\size small
+\layout Verse
-\newline
\family typewriter
-\size default
unsigned char foo(char i) reentrant
\newline
{
\newline
}
-\newline
-
-\family default
+\layout Standard
-\newline
Since stack space on 8051 is limited, the
\emph on
reentrant
\end_inset
addresses, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
unsigned char foo() {
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-data at 0x31 unsiged char j;
+data at 0x31 unsigned char j;
\newline
\SpecialChar ~
\SpecialChar ~
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
In the above example the variable
\emph on
i
will NOT be overlayed since these are implemented using external functions,
e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
#pragma SAVE
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
In the above example the parameter
\emph on
errcd
SDCC allows interrupt service routines to be coded in C, with some extended
keywords.
-\newline
+\layout Verse
-\newline
\family typewriter
void timer_isr (void) interrupt 2 using 1
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
The number following the
\emph on
interrupt
SDCC will generate code to disable all interrupts upon entry to a critical
function and enable them back before returning.
Note that nesting critical functions may cause unpredictable results.
-\newline
-
-\size small
+\layout Verse
-\newline
\family typewriter
-\size default
int foo () critical
\newline
{
\newline
}
-\newline
-
-\family default
+\layout Standard
-\newline
The critical attribute maybe used with other attributes like
\emph on
reentrant.
This is particularly useful for interrupt functions, which can have a large
(and often unnecessary) prologue/epilogue.
For example, compare the code generated by these two functions:
-\newline
+\layout Verse
-\newline
\family typewriter
data unsigned char counter;
;
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
For an 8051 target, the generated simpleInterrupt looks like:
-\newline
+\layout Verse
-\newline
\family typewriter
_simpleIterrupt:
\SpecialChar ~
\SpecialChar ~
reti
-\family default
-
-\newline
+\layout Standard
-\newline
whereas nakedInterrupt looks like:
-\newline
+\layout Verse
-\newline
\family typewriter
_nakedInterrupt:
\SpecialChar ~
\SpecialChar ~
; MUST explicitly include ret(i) in _naked function.
-\family default
-
-\newline
+\layout Standard
-\newline
While there is nothing preventing you from writing C code inside a _naked
function, there are many ways to shoot yourself in the foot doing this,
and it is recommended that you stick to inline assembler.
\emph default
function (but may occasionally be useful anyway
\begin_inset Foot
-collapsed true
+collapsed false
\layout Standard
/*This is a variable, let the linker allocate this one*/
\layout Standard
-and you can use the same hardware dependant routine without changes, as
+and you can use the same hardware dependent routine without changes, as
for example in a library.
This is somehow similar to sbit, but only one absolute address has to be
specified in the whole project.
.
This might cause some unexpected changes in the inline assembler code.
- Please go throught the peephole optimizer rules defined in file
+ Please go through the peephole optimizer rules defined in file
\emph on
SDCCpeeph.def
\emph default
carefully before using this option.
-\newline
+\layout Verse
-\newline
\family typewriter
_asm
\end_inset
;
-\family default
-\size small
-
-\newline
-
-\newline
+\layout Standard
-\size default
The inline assembler code can contain any valid code understood by the assembler
, this includes any assembler directives and comment lines.
The compiler does not do any validation of the code within the
\end_inset
defined by the inline assembler, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
foo() {
/* some more c code */
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
In other words inline assembly code can access labels defined in inline
- assembly within the scope of the funtion.
+ assembly within the scope of the function.
The same goes the other way, ie.
labels defines in inline assembly CANNOT be accessed by C statements.
\layout Subsection
For signed & unsigned int (16 bit) and long (32 bit) variables, division,
multiplication and modulus operations are implemented by support routines.
These support routines are all developed in ANSI-C to facilitate porting
- to other MCUs, although some model specific assembler optimations are used.
+ to other MCUs, although some model specific assembler optimizations are
+ used.
The following files contain the described routine, all of them can be found
in <installdir>/share/sdcc/lib.
\newline
\layout Standard
-SDCC supports IEEE (single precision 4bytes) floating point numbers.The floating
- point support routines are derived from gcc's floatlib.c and consists of
- the following routines:
+SDCC supports IEEE (single precision 4 bytes) floating point numbers.The
+ floating point support routines are derived from gcc's floatlib.c and consists
+ of the following routines:
\newline
\newline
be combined together or the results would be unpredictable.
The library routines supplied with the compiler are compiled as both small
and large.
- The compiled library modules are contained in seperate directories as small
+ The compiled library modules are contained in separate directories as small
and large so that you can link to either set.
\layout Standard
and the 'reentrant' function type will yield much more efficient code,
than using the large model.
Several optimizations are disabled when the program is compiled using the
- large model, it is therefore strongly recommdended that the small model
+ large model, it is therefore strongly recommended that the small model
be used unless absolutely required.
\layout Subsection
-mds390
\emph default
is used
-\layout Section
-\pagebreak_top
-SDCC Technical Data
\layout Subsection
-Optimizations
-\begin_inset LatexCommand \index{Optimizations}
+Redirecting output on Windows Shells
+\layout Standard
+SDCC writes it's error messages to
+\begin_inset Quotes sld
\end_inset
+standard error
+\begin_inset Quotes srd
+\end_inset
+.
+ The windows 95/98/me shell (command or cmd) can't redirect it to a file.
+ The solution is to use a reasonable shell or a helper program like redir.exe:
\layout Standard
-SDCC performs a host of standard optimizations in addition to some MCU specific
- optimizations.
-
-\layout Subsubsection
-Sub-expression Elimination
-\begin_inset LatexCommand \index{Subexpression elimination}
+\begin_inset LatexCommand \url{http://www.cygwin.com/ml/cygwin/1999-02/msg00603.html}
\end_inset
\layout Standard
-The compiler does local and global common subexpression elimination, e.g.:
-
-\newline
-\newline
+\begin_inset LatexCommand \url{ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/misc/redir.zip}
-\family typewriter
-i = x + y + 1;
-\newline
-j = x + y;
-\family default
+\end_inset
-\newline
-\newline
-will be translated to
-\newline
+\layout Standard
-\newline
-\family typewriter
-iTemp = x + y
-\newline
-i = iTemp + 1
-\newline
-j = iTemp
-\newline
+\begin_inset LatexCommand \url{ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/misc/README.redir}
-\family default
+\end_inset
-\newline
-Some subexpressions are not as obvious as the above example, e.g.:
-\newline
\newline
-\family typewriter
-a->b[i].c = 10;
\newline
-a->b[i].d = 11;
-\family default
+If you are using a windows NT/2K/XP shell, you can redirect the
+\begin_inset Quotes sld
+\end_inset
-\newline
+standard error
+\begin_inset Quotes srd
+\end_inset
-\newline
-In this case the address arithmetic a->b[i] will be computed only once;
- the equivalent code in C would be.
-\newline
+ output to a file using
+\begin_inset Quotes sld
+\end_inset
+2>
+\begin_inset Quotes srd
+\end_inset
+
+.
+ For example:
\newline
-\family typewriter
-iTemp = a->b[i];
+\series bold
+
\newline
-iTemp.c = 10;
+sdcc -c foo.c 2> foo.err
\newline
-iTemp.d = 11;
-\family default
\newline
-\newline
-The compiler will try to keep these temporary variables in registers.
-\layout Subsubsection
+\series default
+To append the
+\begin_inset Quotes sld
+\end_inset
-Dead-Code Elimination
-\begin_inset LatexCommand \index{Dead-code elimination}
+standard error
+\begin_inset Quotes srd
+\end_inset
+
+ output of SDCC to a file you can use
+\begin_inset Quotes sld
+\end_inset
+2>>
+\begin_inset Quotes srd
\end_inset
+.
+ I you happen to have visual studio installed in your windows machine, you
+ can use it to compile your sources using a custom build and the SDCC -
+\emph on
+
+\begin_inset ERT
+status Collapsed
\layout Standard
+\backslash
+/
+\end_inset
-\family typewriter
-int global;
-\newline
-void f () {
-\newline
-\SpecialChar ~
-\SpecialChar ~
-int i;
-\newline
-\SpecialChar ~
-\SpecialChar ~
-i = 1; \SpecialChar ~
-/* dead store */
-\newline
-\SpecialChar ~
-\SpecialChar ~
-global = 1;\SpecialChar ~
-/* dead store */
+
+\emph default
+-vc option.
+ Something like this should work:
\newline
-\SpecialChar ~
-\SpecialChar ~
-global = 2;
+
\newline
-\SpecialChar ~
-\SpecialChar ~
-return;
+
+\series bold
+c:
+\backslash
+sdcc
+\backslash
+bin
+\backslash
+sdcc.exe -
+\series default
+\emph on
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\series bold
+\emph default
+-vc -
+\series default
+\emph on
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\series bold
+\emph default
+-model-large -c $(InputPath)
+\layout Section
+\pagebreak_top
+SDCC Technical Data
+\layout Subsection
+
+Optimizations
+\begin_inset LatexCommand \index{Optimizations}
+
+\end_inset
+
+
+\layout Standard
+
+SDCC performs a host of standard optimizations in addition to some MCU specific
+ optimizations.
+
+\layout Subsubsection
+
+Sub-expression Elimination
+\begin_inset LatexCommand \index{Subexpression elimination}
+
+\end_inset
+
+
+\layout Standard
+
+The compiler does local and global common subexpression elimination, e.g.:
+
+\layout Verse
+
+
+\family typewriter
+i = x + y + 1;
+\newline
+j = x + y;
+\layout Standard
+
+will be translated to
+\layout Verse
+
+
+\family typewriter
+iTemp = x + y
+\newline
+i = iTemp + 1
+\newline
+j = iTemp
+\layout Standard
+
+Some subexpressions are not as obvious as the above example, e.g.:
+\layout Verse
+
+
+\family typewriter
+a->b[i].c = 10;
+\newline
+a->b[i].d = 11;
+\layout Standard
+
+In this case the address arithmetic a->b[i] will be computed only once;
+ the equivalent code in C would be.
+\layout Verse
+
+
+\family typewriter
+iTemp = a->b[i];
+\newline
+iTemp.c = 10;
+\newline
+iTemp.d = 11;
+\layout Standard
+
+The compiler will try to keep these temporary variables in registers.
+\layout Subsubsection
+
+Dead-Code Elimination
+\begin_inset LatexCommand \index{Dead-code elimination}
+
+\end_inset
+
+
+\layout Verse
+
+
+\family typewriter
+int global;
+\newline
+void f () {
+\newline
+\SpecialChar ~
+\SpecialChar ~
+int i;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+i = 1; \SpecialChar ~
+/* dead store */
+\newline
+\SpecialChar ~
+\SpecialChar ~
+global = 1;\SpecialChar ~
+/* dead store */
+\newline
+\SpecialChar ~
+\SpecialChar ~
+global = 2;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+return;
\newline
\SpecialChar ~
\SpecialChar ~
/* unreachable */
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
will be changed to
-\newline
+\layout Verse
-\newline
\family typewriter
int global; void f ()
\end_inset
-\layout Standard
+\layout Verse
\family typewriter
return j;
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
will be changed to
-\newline
+\layout Verse
-\newline
\family typewriter
int f() {
return 10;
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
Note: the dead stores created by this copy propagation will be eliminated
by dead-code elimination.
\layout Subsubsection
\newline
Loop Invariant:
-\newline
+\layout Verse
-\newline
\family typewriter
for (i = 0 ; i < 100 ; i ++)
\SpecialChar ~
\SpecialChar ~
f += k + l;
-\family default
-
-\newline
+\layout Standard
-\newline
changed to
-\newline
+\layout Verse
-\newline
\family typewriter
itemp = k + l;
\SpecialChar ~
\SpecialChar ~
f += itemp;
-\family default
-
-\newline
+\layout Standard
-\newline
As mentioned previously some loop invariants are not as apparent, all static
address computations are also moved out of the loop.
\newline
\end_inset
, this optimization substitutes an expression by a cheaper expression:
-\newline
+\layout Verse
-\newline
\family typewriter
for (i=0;i < 100; i++)
\SpecialChar ~
\SpecialChar ~
ar[i*5] = i*3;
-\family default
-
-\newline
+\layout Standard
-\newline
changed to
-\newline
+\layout Verse
-\newline
\family typewriter
itemp1 = 0;
itemp2 += 3;
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
The more expensive multiplication
\begin_inset LatexCommand \index{Multiplication}
\newline
\family typewriter
-for (<symbol> = <expression> ; <sym> [< | <=] <expression> ; [<sym>++ |
- <sym> += 1])
+for(<symbol> = <expression>; <sym> [< | <=] <expression>; [<sym>++ | <sym>
+ += 1])
\newline
\SpecialChar ~
\SpecialChar ~
SDCC does numerous algebraic simplifications, the following is a small sub-set
of these optimizations.
-\newline
+\layout Verse
-\newline
\family typewriter
i = j + 0 ; /* changed to */ i = j;
i = j - j ; /* changed to */ i = 0;
\newline
i = j / 1 ; /* changed to */ i = j;
-\family default
-
-\newline
+\layout Standard
-\newline
Note the subexpressions
\begin_inset LatexCommand \index{Subexpression}
The case labels are in numerical sequence, the labels need not be in order,
and the starting number need not be one or zero.
-\newline
+\begin_deeper
+\layout Verse
-\newline
\family typewriter
switch(i) {\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
}
-\newline
-
-\newline
+\layout Standard
-\family default
Both the above switch statements will be implemented using a jump-table.
+\end_deeper
\layout Itemize
The number of case labels is at least three, since it takes two conditional
Switch statements which have gaps in the numeric sequence or those that
have more that 84 case labels can be split into more than one switch statement
for efficient code generation, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
switch (i) {
\newline
+\SpecialChar ~
+\SpecialChar ~
case 1: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 2: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 3: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 4: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 9: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 10: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 11: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 12: ...
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
If the above switch statement is broken down into two switch statements
-\newline
+\layout Verse
-\newline
\family typewriter
switch (i) {
\newline
+\SpecialChar ~
+\SpecialChar ~
case 1: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 2: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 3: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 4: ...
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
and
-\family typewriter
+\layout Verse
-\newline
-\newline
+\family typewriter
switch (i) {
\newline
+\SpecialChar ~
+\SpecialChar ~
case 9: \SpecialChar ~
...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 10: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 11: ...
\newline
+\SpecialChar ~
+\SpecialChar ~
case 12:\SpecialChar ~
...
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
then both the switch statements will be implemented using jump-tables whereas
the unmodified switch statement will not be.
\layout Subsubsection
g.
SDCC tries to implement bit-shift operations in the most efficient way
possible, e.g.:
-\newline
+\layout Verse
-\family typewriter
-\newline
+\family typewriter
unsigned char i;
\newline
...
i>>= 4;
\newline
...
-\newline
-
-\family default
+\layout Standard
-\newline
generates the following code:
-\newline
+\layout Verse
-\family typewriter
-\newline
+\family typewriter
mov a,_i
\newline
swap a
anl a,#0x0f
\newline
mov _i,a
-\family default
-
-\newline
+\layout Standard
-\newline
In general SDCC will never setup a loop if the shift count is known.
Another example:
-\newline
+\layout Verse
-\newline
\family typewriter
unsigned int i;
i >>= 9;
\newline
...
-\family default
-
-\newline
+\layout Standard
-\newline
will generate:
-\newline
+\layout Verse
-\newline
\family typewriter
mov a,(_i + 1)
rrc a
\newline
mov _i,a
-\family default
-
-\newline
+\layout Standard
-\newline
Note that SDCC stores numbers in little-endian format (i.e.
lowest order first).
\layout Subsubsection
A special case of the bit-shift operation is bit rotation, SDCC recognizes
the following expression to be a left bit-rotation:
-\newline
+\layout Verse
-\newline
\family typewriter
unsigned char i;
\family default
\newline
+
+\family typewriter
...
-\newline
+\layout Standard
-\newline
will generate the following code:
-\newline
+\layout Verse
-\newline
\family typewriter
mov a,_i
rl a
\newline
mov _i,a
-\family default
-
-\newline
+\layout Standard
-\newline
SDCC uses pattern matching on the parse tree to determine this operation.Variatio
ns of this case will also be recognized as bit-rotation, i.e.:
-\newline
+\layout Verse
-\newline
\family typewriter
i = ((i >> 7) | (i << 1)); /* left-bit rotation */
type (long, int, short or char types).
SDCC recognizes the following expression to yield the highest order bit
and generates optimized code for it, e.g.:
-\newline
+\layout Verse
+
-\newline
-
\family typewriter
unsigned int gint;
\newline
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
will generate the following code:
-\newline
+\layout Verse
-\family typewriter
-\newline
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
+\family typewriter
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
61 ;\SpecialChar ~
hob.c 7
\newline
-\SpecialChar ~
-\SpecialChar ~
- 000A E5*01\SpecialChar ~
+000A E5*01\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
mov\SpecialChar ~
a,(_gint + 1)
\newline
-\SpecialChar ~
-\SpecialChar ~
- 000C 33\SpecialChar ~
+000C 33\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
rlc\SpecialChar ~
a
\newline
-\SpecialChar ~
-\SpecialChar ~
- 000D E4\SpecialChar ~
+000D E4\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
clr\SpecialChar ~
a
\newline
-\SpecialChar ~
-\SpecialChar ~
- 000E 13\SpecialChar ~
+000E 13\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
rrc\SpecialChar ~
a
\newline
-\SpecialChar ~
-\SpecialChar ~
- 000F F5*02\SpecialChar ~
+000F F5*02\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
mov\SpecialChar ~
_foo_hob_1_1,a
-\newline
-
-\newline
+\layout Standard
-\family default
Variations of this case however will
\emph on
not
way to get the highest order bit, (it is portable).
Of course it will be recognized even if it is embedded in other expressions,
e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
xyz = gint + ((gint >> 15) & 1);
-\family default
-
-\newline
+\layout Standard
-\newline
will still be recognized.
\layout Subsubsection
\emph default
option.
The rule language is best illustrated with examples.
-\newline
+\layout Verse
-\newline
\family typewriter
replace {
mov %1,a
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
The above rule will change the following assembly
\begin_inset LatexCommand \index{Assembler routines}
\end_inset
sequence:
-\newline
+\layout Verse
-\newline
\family typewriter
-\SpecialChar ~
-\SpecialChar ~
mov r1,a
\newline
-\SpecialChar ~
-\SpecialChar ~
mov a,r1
-\family default
-
-\newline
+\layout Standard
-\newline
to
-\newline
+\layout Verse
-\newline
\family typewriter
mov r1,a
-\family default
-
-\newline
+\layout Standard
-\newline
Note: All occurrences of a
\emph on
%n
\emph default
(pattern variable) must denote the same string.
With the above rule, the assembly sequence:
-\newline
+\layout Verse
-\newline
\family typewriter
-\SpecialChar ~
-\SpecialChar ~
mov r1,a
\newline
-\SpecialChar ~
-\SpecialChar ~
mov a,r2
-\family default
-
-\newline
+\layout Standard
-\newline
will remain unmodified.
\newline
and
\family typewriter
acall
-\family default
-
-\newline
+\layout Verse
-\newline
\family typewriter
replace { lcall %1 } by { acall %1 }
\newline
replace { ljmp %1 } by { ajmp %1 }
-\family default
-
-\newline
+\layout Standard
-\newline
The
\emph on
inline-assembler code
\newline
The syntax for a rule is as follows:
-\newline
+\layout Verse
-\newline
\family typewriter
rule := replace [ restart ] '{' <assembly sequence> '
'}' [if <functionName> ] '
\backslash
n'
-\newline
-
-\family default
+\layout Standard
-\newline
<assembly sequence> := assembly instruction (each instruction including
labels must be on a separate line).
\newline
the same rule again.
An example of this (not a good one, it has side effects) is the following
rule:
-\newline
+\layout Verse
-\newline
\family typewriter
replace restart {
; nop
\newline
}
-\family default
-
-\newline
+\layout Standard
-\newline
Note that the replace pattern cannot be a blank, but can be a comment line.
Without the 'restart' option only the inner most 'pop' 'push' pair would
be eliminated, i.e.:
-\newline
+\layout Verse
-\newline
\family typewriter
-\SpecialChar ~
-\SpecialChar ~
pop ar1
\newline
-\SpecialChar ~
-\SpecialChar ~
pop ar2
\newline
-\SpecialChar ~
-\SpecialChar ~
push ar2
\newline
-\SpecialChar ~
-\SpecialChar ~
push ar1
-\family default
-
-\newline
+\layout Standard
-\newline
would result in:
-\newline
+\layout Verse
-\newline
\family typewriter
-\SpecialChar ~
-\SpecialChar ~
pop ar1
\newline
-\SpecialChar ~
-\SpecialChar ~
; nop
\newline
-\SpecialChar ~
-\SpecialChar ~
push ar1
-\family default
-
-\newline
+\layout Standard
-\newline
\emph on
with
\emph default
the restart option the rule will be applied again to the resulting code
and then all the pop-push pairs will be eliminated to yield:
-\newline
+\layout Verse
-\newline
\family typewriter
-\SpecialChar ~
-\SpecialChar ~
; nop
\newline
-\SpecialChar ~
-\SpecialChar ~
; nop
-\family default
-
-\newline
+\layout Standard
-\newline
A conditional function can be attached to a rule.
Attaching rules are somewhat more involved, let me illustrate this with
an example.
-\newline
+\layout Verse
-\newline
\family typewriter
replace {
%2:
\newline
} if labelInRange
-\family default
-
-\newline
+\layout Standard
-\newline
The optimizer does a look-up of a function name table defined in function
\emph on
function1[,function2[,function3...]] - The compiler by default uses a caller
saves convention for register saving across function calls, however this
- can cause unneccessary register pushing & popping when calling small functions
+ can cause unnecessary register pushing & popping when calling small functions
from larger functions.
This option can be used to switch off the register saving convention for
the function names specified.
code need to be manually inserted at the entry & exit for these functions
to save & restore the registers used by these functions, this can SUBSTANTIALLY
reduce code & improve run time performance of the generated code.
- In the future the compiler (with interprocedural analysis) may be able
+ In the future the compiler (with inter procedural analysis) may be able
to determine the appropriate scheme to use for each function call.
If -
\begin_inset ERT
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.
-\newline
+\layout Verse
-\newline
\family typewriter
#pragma SAVE
\end_inset
/* turn the optimizations back on */
-\family default
-
-\newline
+\layout Standard
-\newline
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.
\layout Standard
-In the following example the function cfunc calls an assembler routine asm_func,
- which takes two parameters.
-\newline
+In the following example the function c_func calls an assembler routine
+ asm_func, which takes two parameters.
+\layout Verse
-\newline
\family typewriter
extern int asm_func(unsigned char, unsigned char);
return c_func(10,9);
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
The corresponding assembler function is:
-\newline
+\layout Verse
-\newline
\family typewriter
.globl _asm_func_PARM_2
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-mov dpl,a
+mov dpl,a
\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-mov dpl
+mov\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+dpl
\begin_inset LatexCommand \index{DPTR, DPH, DPL}
\end_inset
\SpecialChar ~
\SpecialChar ~
ret
-\newline
-
-\newline
+\layout Standard
-\family default
Note here that the return values are placed in 'dpl' - One byte return value,
'dpl' LSB & 'dph' MSB for two byte values.
'dpl', 'dph' and 'b' for three byte values (generic pointers) and 'dpl','dph','
\begin_inset Quotes erd
\end_inset
- for four bytes, the varible name for the second parameter will be _<function_na
-me>_PARM_2.
+ for four bytes, the variable name for the second parameter will be _<function_n
+ame>_PARM_2.
\newline
\newline
parameters are pushed from right to left i.e.
after the call the left most parameter will be on the top of the stack.
Here is an example:
-\newline
+\layout Verse
-\newline
\family typewriter
extern int asm_func(unsigned char, unsigned char);
return c_func(10,9);
\newline
}
-\newline
-
-\family default
+\layout Standard
-\newline
The corresponding assembler routine is:
-\newline
+\layout Verse
-\newline
\family typewriter
.globl _asm_func
\SpecialChar ~
\SpecialChar ~
ret
-\newline
-
-\newline
+\layout Standard
-\family default
The compiling and linking procedure remains the same, however note the extra
entry & exit linkage required for the assembler code, _bp is the stack
frame pointer and is used to compute the offset into the stack for parameters
\layout Standard
-Deviations from the compliancy.
+Deviations from the compliance:
\layout Itemize
functions are not always reentrant.
structures cannot be assigned values directly, cannot be passed as function
parameters or assigned to each other and cannot be a return value from
a function, e.g.:
-\family typewriter
+\begin_deeper
+\layout Verse
-\newline
-\newline
+\family typewriter
struct s { ...
};
\newline
\newline
}
\newline
-struct s foo1 (struct s parms) /* is invalid in SDCC although allowed in
- ANSI */
+struct s foo1 (struct s parms) /* invalid in SDCC although allowed in ANSI
+ */
\newline
{
\newline
return rets;/* is invalid in SDCC although allowed in ANSI */
\newline
}
+\end_deeper
\layout Itemize
'long long
\end_inset
function declarations are NOT allowed.
-\newline
+\begin_deeper
+\layout Verse
-\family typewriter
-\newline
+\family typewriter
foo(i,j) /* this old style of function declarations */
\newline
int i,j; /* are valid in ANSI but not valid in SDCC */
\newline
}
+\end_deeper
\layout Itemize
functions declared as pointers must be dereferenced during the call.
-\newline
+\begin_deeper
+\layout Verse
-\family typewriter
-\newline
+\family typewriter
int (*foo)();
\newline
...
\newline
/* has to be called like this */
\newline
-(*foo)(); /* ansi standard allows calls to be made like 'foo()' */
+(*foo)(); /* ANSI standard allows calls to be made like 'foo()' */
+\end_deeper
\layout Subsection
Cyclomatic Complexity
Reducing the size of division, multiplication & modulus operations can reduce
code size substantially.
Take the following code for example.
-\family typewriter
+\begin_deeper
+\layout Verse
-\newline
-\newline
+\family typewriter
foobar(unsigned int p1, unsigned char ch)
\newline
{
\newline
- unsigned char ch1 = p1 % ch ;
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+unsigned char ch1 = p1 % ch ;
\newline
- ....
-
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+....
\newline
}
-\newline
-
-\family default
+\layout Standard
-\newline
For the modulus operation the variable ch will be promoted to unsigned int
first then the modulus operation will be performed (this will lead to a
call to support routine _moduint()), and the result will be casted to a
char.
If the code is changed to
-\newline
+\layout Verse
-\family typewriter
-\newline
+\family typewriter
foobar(unsigned int p1, unsigned char ch)
\newline
{
\newline
- unsigned char ch1 = (unsigned char)p1 % ch ;
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+unsigned char ch1 = (unsigned char)p1 % ch ;
\newline
- ....
-
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+....
\newline
}
-\newline
-
-\family default
+\layout Standard
-\newline
It would substantially reduce the code generated (future versions of the
- compiler will be smart enough to detect such optimization oppurtunities).
+ compiler will be smart enough to detect such optimization opportunities).
+\end_deeper
\layout Subsection
Notes on MCS51 memory
\layout Standard
-Adittionally some members of the MCS51 family may have up to 128 bytes of
+Additionally some members of the MCS51 family may have up to 128 bytes of
additional, indirectly addressable, internal RAM memory (
\emph on
idata
\emph default
).
- Furtermore, some chips may have some built in external memory (
+ Furthermore, some chips may have some built in external memory (
\emph on
xdata
\emph default
-) which should not be confused with the internal, direclty addressable RAM
+) which should not be confused with the internal, directly addressable RAM
memory (
\emph on
data
allows you to specify the start of the stack, i.e.
you could start it after any data in the general purpose area.
- If your microcontroller has aditional indirectly addressable internal RAM
- (
+ If your microcontroller has additional indirectly addressable internal
+ RAM (
\emph on
idata
\emph default
.
If in doubt, don't specify any options and see if the resulting memory
- layout is appropiate, then you can twik it.
+ layout is appropriate, then you can adjust it.
\layout Standard
The 8051 linker generates two files with memory allocation information.
foo.cdb - the debugger symbol information file.
\layout Itemize
-foo.ihx - the intel hex format
+foo.ihx - the Intel hex format
\begin_inset LatexCommand \index{Intel hex format}
\end_inset
SDCC can target both the Zilog Z80 and the Nintendo Gameboy's Z80-like gbz80.
The port is incomplete - long support is incomplete (mul, div and mod are
- unimplimented), and both float and bitfield support is missing.
+ unimplemented), and both float and bitfield support is missing.
Apart from that the code generated is correct.
\layout Standard
As always, the code is the authoritave reference - see z80/ralloc.c and z80/gen.c.
The stack frame is similar to that generated by the IAR Z80 compiler.
IX is used as the base pointer, HL is used as a temporary register, and
- BC and DE are available for holding varibles.
- IY is currently unusued.
+ BC and DE are available for holding variables.
+ IY is currently unused.
Return values are stored in HL.
One bad side effect of using IX as the base pointer is that a functions
stack frame is limited to 127 bytes - this will be fixed in a later version.
Bug reports are automatically forwarded to the developer mailing list and
will be fixed ASAP.
When reporting a bug, it is very useful to include a small test program
- which reproduces the problem.
+ (the smaller the better) which reproduces the problem.
If you can isolate the problem by looking at the generated assembly code,
this can be very helpful.
Compiling your program with the -
\end_inset
option can sometimes be useful in locating optimization problems.
+ When reporting a bug please maker sure you:
+\layout Enumerate
+
+Attach the code you are compiling with SDCC.
+
+\layout Enumerate
+
+Specify the exact command you use to run SDCC, or attach your Makefile.
+
+\layout Enumerate
+
+Specify the SDCC version (type "sdcc -v"), your platform, and operating
+ system.
+
+\layout Enumerate
+
+Provide an exact copy of any error message or incorrect output.
+
+\layout Standard
+
+Please attempt to include these 4 important parts, as applicable, in all
+ requests for support or when reporting any problems or bugs with SDCC.
+ Though this will make your message lengthy, it will greatly improve your
+ chance that SDCC users and developers will be able to help you.
+ Some SDCC developers are frustrated by bug reports without code provided
+ that they can use to reproduce and ultimately fix the problem, so please
+ be sure to provide sample code if you are reporting a bug!
\layout Standard
Please have a short check that you are using a recent version of SDCC and
\begin_inset Foot
-collapsed false
+collapsed true
\layout Standard
a similar problem.
\layout Subsection
-Changelog
+ChangeLog
\begin_inset LatexCommand \index{Changelog}
\end_inset
Current excuses might refer to problems with live range analysis, but if
this is fixed, the next problem rising is that another excuse will have
to be found.
- Kidding aside, we have to get better there!
+ Kidding aside, we have to get better there! On the other hand there are
+ daily snapshots available at
+\begin_inset LatexCommand \htmlurl[snap]{http://sdcc.sourceforge.net/snap.php}
+
+\end_inset
+
+, and you can always built the very last version (hopefully with many bugs
+ fixed, and features added) from the source code available at
+\begin_inset LatexCommand \htmlurl[Source]{http://sdcc.sourceforge.net/snap.php#Source}
+
+\end_inset
+
+.
\layout Subsection
Examples
\layout Comment
Maybe we should include some links to real world applications.
- Preferrably pointer to pointers (one for each architecture) so this stays
+ Preferably pointer to pointers (one for each architecture) so this stays
manageable here?
\layout Subsection
\shape italic
-This is an excerpt from an atricle published in Circuit Cellar MagaZine
+This is an excerpt from an article published in Circuit Cellar Magazine
in august 2000.
It's a little outdated (the compiler is much more efficient now and user/develo
per friendly), but pretty well exposes the guts of it all.
This section shows some details of iCode.
The example C code does not do anything useful; it is used as an example
to illustrate the intermediate code generated by the compiler.
-\newline
+\layout Verse
-\newline
\family typewriter
1.\SpecialChar ~
\newline
15.\SpecialChar ~
\SpecialChar ~
-for (i = 0, j = 10 ; i < 10 ; i++, j--) {
+for (i = 0, j = 10 ; i < 10 ; i++, j
+\family default
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-
+\family typewriter
+) {
\newline
16.\SpecialChar ~
\SpecialChar ~
\newline
21.\SpecialChar ~
}
-\newline
-
-\newline
+\layout Standard
-\family default
In addition to the operands each iCode contains information about the filename
and line it corresponds to in the source file.
The first field in the listing should be interpreted as follows: