+\begin_layout Itemize
+check and convert compiler specific extensions (interrupts, memory areas,
+ pragmas etc.).
+\end_layout
+
+\begin_layout Itemize
+check for differences in type promotion.
+ Especially check for math operations on
+\family typewriter
+char
+\family default
+ or
+\family typewriter
+unsigned char
+\family default
+ variables.
+ For the sake of C99 compatibility SDCC will probably promote these to
+\family typewriter
+int
+\family default
+ more often than other compilers.
+ Eventually insert explicit casts to
+\family typewriter
+(char)
+\family default
+ or
+\family typewriter
+(unsigned char)
+\family default
+.
+ Also check that the ~\InsetSpace ~
+operator
+\begin_inset LatexCommand index
+name "\\~\\/ Operator"
+
+\end_inset
+
+ is not used on
+\family typewriter
+bit
+\begin_inset LatexCommand index
+name "bit"
+
+\end_inset
+
+
+\family default
+ variables, use the !\InsetSpace ~
+operator instead.
+ See sections
+\begin_inset LatexCommand ref
+reference "type promotion"
+
+\end_inset
+
+ and
+\begin_inset LatexCommand ref
+reference "sec:Compatibility-with-previous"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Itemize
+check the assembly code generated for interrupt routines (f.e.
+ for calls to possibly non-reentrant library functions).
+\end_layout
+
+\begin_layout Itemize
+check whether timing loops result in proper timing (or preferably consider
+ a rewrite of the code with timer based delays instead).
+\end_layout
+
+\begin_layout Itemize
+check for differences in printf parameters (some compilers push (va_arg
+\begin_inset LatexCommand index
+name "vararg, va\\_arg"
+
+\end_inset
+
+) char variables as
+\family typewriter
+int
+\family default
+ others push them as
+\family typewriter
+char
+\family default
+.
+ See section
+\begin_inset LatexCommand ref
+reference "sec:Compatibility-with-previous"
+
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Itemize
+check the resulting memory map
+\begin_inset LatexCommand index
+name "Memory map"
+
+\end_inset
+
+.
+ Usage of different memory spaces: code, stack, data (for mcs51/ds390 additional
+ly idata, pdata, xdata).
+ Eventually check if unexpected library functions are included.
+\end_layout
+
+\begin_layout Section
+Tools
+\begin_inset LatexCommand index
+name "Tools"
+
+\end_inset
+
+ included in the distribution
+\end_layout
+
+\begin_layout Standard
+\align left
+\begin_inset Tabular
+<lyxtabular version="3" rows="12" columns="3">
+<features>
+<column alignment="left" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Name
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Purpose
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Directory
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+uCsim
+\begin_inset LatexCommand index
+name "uCsim"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Simulator for various architectures
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/sim/ucsim
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+keil2sdcc.pl
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+header file
+\begin_inset LatexCommand index
+name "Header files"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Include files"
+
+\end_inset
+
+ conversion
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/support/scripts
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+mh2h.c
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+header file conversion
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/support/scripts
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+as-gbz80
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Assembler
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+as-z80
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Assembler
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+asx8051
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Assembler
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+SDCDB
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Simulator
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+aslink
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Linker
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+link-z80
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Linker
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+link-gbz80
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Linker
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+packihx
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Intel Hex packer
+\begin_inset LatexCommand index
+name "packihx (tool)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/bin
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\newline
+
+\end_layout
+
+\begin_layout Section
+Documentation
+\begin_inset LatexCommand index
+name "Documentation"
+
+\end_inset
+
+ included in the distribution
+\end_layout
+
+\begin_layout Standard
+\align left
+\begin_inset Tabular
+<lyxtabular version="3" rows="10" columns="2">
+<features>
+<column alignment="block" valignment="top" leftline="true" width="40col%">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="60col%">
+<row topline="true" bottomline="true" endhead="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Subject / Title
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Filename / Where to get
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+SDCC Compiler User Guide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+You're reading it right now
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/sdccman.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Changelog of SDCC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/Changelog
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+ASXXXX
+\begin_inset LatexCommand index
+name "asXXXX (as-gbz80, as-hc08, asx8051, as-z80)"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Assembler documentation"
+
+\end_inset
+
+ Assemblers and
+\newline
+ASLINK
+\begin_inset LatexCommand index
+name "aslink"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Linker documentation"
+
+\end_inset
+
+ Relocating Linker
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/as/doc/asxhtm.html
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+SDCC regression test
+\begin_inset LatexCommand index
+name "Regression test"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/doc/test_suite_spec.pdf
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/test_suite_spec.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Various notes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/doc/*
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Notes on debugging with SDCDB
+\begin_inset LatexCommand index
+name "SDCDB (debugger)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/debugger/README
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at
+\emph default
+:
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+uCsim
+\begin_inset LatexCommand index
+name "uCsim"
+
+\end_inset
+
+ Software simulator for microcontrollers
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+sdcc/sim/ucsim/doc
+\family default
+\series default
+\shape default
+\size default
+\emph default
+\bar default
+\noun default
+/index.html
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Temporary notes on the pic16
+\begin_inset LatexCommand index
+name "PIC16"
+
+\end_inset
+
+ port
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/src/pic16/NOTES
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\newline
+
+\emph default
+
+\begin_inset LatexCommand url
+target "http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+SDCC internal documentation (debugging file format)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+sdcc/doc/
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+cdbfileformat.pd
+\family default
+\series default
+\shape default
+\size default
+\emph default
+\bar default
+\noun default
+f
+\emph on
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\hfill
+online at:
+\emph default
+
+\newline
+
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/cdbfileformat.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\newline
+
+\end_layout
+
+\begin_layout Section
+Related open source tools
+\begin_inset LatexCommand label
+name "sec:Related-open-source-tools"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Related tools"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\align left
+\begin_inset Tabular
+<lyxtabular version="3" rows="16" columns="3">
+<features>
+<column alignment="left" valignment="top" leftline="true" width="0pt">
+<column alignment="block" valignment="top" leftline="true" width="30line%">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="40col%">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Name
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Purpose
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Where to get
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+gpsim
+\begin_inset LatexCommand index
+name "gpsim (pic simulator)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+PIC simulator
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.dattalo.com/gnupic/gpsim.html"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+gputils
+\begin_inset LatexCommand index
+name "gputils (pic tools)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+GNU PIC utilities
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/gputils"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+flP5
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+PIC programmer
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://freshmeat.net/projects/flp5/"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+ec2drv/newcdb
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Tools for Silicon Laboratories JTAG debug adapter, partly based on SDCDB
+ (Unix only)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/ec2drv"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+indent
+\begin_inset LatexCommand index
+name "indent (source formatting tool)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Formats C source - Master of the white spaces
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://directory.fsf.org/GNU/indent.html"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+srecord
+\begin_inset LatexCommand index
+name "srecord (bin, hex, ... tool)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Object file conversion, checksumming, ...
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/srecord"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+objdump
+\begin_inset LatexCommand index
+name "objdump (tool)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Object file conversion, ...
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Part of binutils (should be there anyway)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+cmon51
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+8051 monitor (hex up-/download, single step, disassemble)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://sourceforge.net/projects/cmon51"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+doxygen
+\begin_inset LatexCommand index
+name "doxygen (source documentation tool)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Source code documentation system
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.doxygen.org"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+kdevelop
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+IDE (has anyone tried integrating SDCC & SDCDB? Unix only)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.kdevelop.org"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+paulmon
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+8051 monitor (hex up-/download, single step, disassemble)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.pjrc.com/tech/8051/paulmon2.html"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+splint
+\begin_inset LatexCommand index
+name "splint (syntax checking tool)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Statically checks c sources (see
+\begin_inset LatexCommand ref
+reference "lyx:more-pedantic-SPLINT"
+
+\end_inset
+
+)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.splint.org"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+ddd
+\begin_inset LatexCommand index
+name "DDD (debugger)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Debugger, serves nicely as GUI to SDCDB
+\begin_inset LatexCommand index
+name "SDCDB (debugger)"
+
+\end_inset
+
+ (Unix only)
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.gnu.org/software/ddd/"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+d52
+\begin_inset LatexCommand index
+name "d52"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "d52 (disassembler)"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Disassembler, can count instruction cycles
+\begin_inset LatexCommand index
+name "instruction cycles (count)"
+
+\end_inset
+
+, use with options -pnd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.8052.com/users/disasm/"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+cmake
+\begin_inset LatexCommand index
+name "cmake"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Cross platform build system, generates Makefiles
+\begin_inset LatexCommand index
+name "Makefile"
+
+\end_inset
+
+ and project workspaces
+\begin_inset LatexCommand index
+name "project workspace"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.cmake.org"
+
+\end_inset
+
+ \InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+and a dedicated wiki entry:
+\begin_inset LatexCommand url
+target "http://www.cmake.org/Wiki/CmakeSdcc"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\newline
+
+\end_layout
+
+\begin_layout Section
+Related documentation / recommended reading
+\end_layout
+
+\begin_layout Standard
+\align left
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="3">
+<features>
+<column alignment="left" valignment="top" leftline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Name
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Subject / Title
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Where to get
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+\series medium
+\shape up
+\size normal
+\emph off
+\bar no
+\noun off
+\color none
+c-refcard.pdf
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+C Reference Card
+\begin_inset LatexCommand index
+name "C Reference card"
+
+\end_inset
+
+, 2 pages
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://refcards.com/refcards/c/index.html"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+c-faq
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+C-FAQ
+\begin_inset LatexCommand index
+name "C FAQ"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset LatexCommand url
+target "http://www.c-faq.com"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+ISO/IEC 9899:TC2
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset Quotes sld
+\end_inset
+
+C-Standard
+\begin_inset Quotes srd
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+ISO/IEC DTR 18037
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+\begin_inset Quotes sld
+\end_inset
+
+Extensions for Embedded C
+\begin_inset Quotes srd
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1021.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Latest datasheet of target CPU
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+vendor
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Revision history of datasheet
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+vendor
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\newline
+
+\end_layout
+
+\begin_layout Section
+Application notes specifically for SDCC
+\end_layout
+
+\begin_layout Standard
+SDCC makes no claims about the completeness of this list and about up-to-datenes
+s or correctness of the application notes
+\begin_inset LatexCommand index
+name "Application notes"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+\align left
+
+\size footnotesize
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="3">
+<features>
+<column alignment="block" valignment="top" leftline="true" width="17col%">
+<column alignment="block" valignment="top" leftline="true" width="27col%">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="57col%">
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+\size footnotesize
+Vendor
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+\size footnotesize
+Subject / Title
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+\size footnotesize
+Where to get
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Maxim / Dallas
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Using the SDCC Compiler for the DS80C400
+\begin_inset LatexCommand index
+name "DS80C400"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://pdfserv.maxim-ic.com/en/an/AN3346.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Maxim / Dallas
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="left" valignment="top" topline="true" leftline="true" usebox="none" width="30line%">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Using the Free SDCC C Compiler to Develop Firmware for the DS89C420/430/440/450
+\begin_inset LatexCommand index
+name "DS89C4x0"
+
+\end_inset
+
+ Family of Microcontrollers
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://pdfserv.maxim-ic.com/en/an/AN3477.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Silicon Laboratories / Cygnal
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Integrating SDCC 8051 Tools Into The Silicon Labs IDE
+\begin_inset LatexCommand index
+name "IDE"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/en/an198.pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Ramtron / Goal Semiconductor
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Interfacing SDCC to Syn and Textpad
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Ramtron / Goal Semiconductor
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Installing and Configuring SDCC and Crimson Editor
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://www.ramtron.com/doc/Products/Microcontroller/Support_Tools.asp"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Texas Instruments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+MSC12xx Programming with SDCC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+\begin_inset LatexCommand url
+target "http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=sbaa109&fileType=pdf"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Some Questions
+\end_layout
+
+\begin_layout Standard
+Some questions answered, some pointers given - it might be time to in turn
+ ask
+\emph on
+you
+\emph default
+ some questions:
+\end_layout
+
+\begin_layout Itemize
+can you solve your project with the selected microcontroller? Would you
+ find out early or rather late that your target is too small/slow/whatever?
+ Can you switch to a slightly better device if it doesn't fit?
+\end_layout
+
+\begin_layout Itemize
+should you solve the problem with an 8 bit CPU? Or would a 16/32 bit CPU
+ and/or another programming language be more adequate? Would an operating
+ system on the target device help?
+\end_layout
+
+\begin_layout Itemize
+if you solved the problem, will the marketing department be happy?
+\end_layout
+
+\begin_layout Itemize
+if the marketing department is happy, will customers be happy?
+\end_layout
+
+\begin_layout Itemize
+if you're the project manager, marketing department and maybe even the customer
+ in one person, have you tried to see the project from the outside?
+\end_layout
+
+\begin_layout Itemize
+is the project done if you think it is done? Or is just that other interface/pro
+tocol/feature/configuration/option missing? How about website, manual(s),
+ internationali(z|s)ation, packaging, labels, 2nd source for components,
+ electromagnetic compatability/interference, documentation for production,
+ production test software, update mechanism, patent issues?
+\end_layout
+
+\begin_layout Itemize
+is your project adequately positioned in that magic triangle: fame, fortune,
+ fun?
+\end_layout
+
+\begin_layout Standard
+Maybe not all answers to these questions are known and some answers may
+ even be
+\emph on
+no
+\emph default
+, nevertheless knowing these questions may help you to avoid burnout
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+burnout is bad for electronic devices, programmers and motorcycle tyres
+\end_layout
+
+\end_inset
+
+.
+ Chances are you didn't want to hear some of them...
+\end_layout
+
+\begin_layout Chapter
+Support
+\begin_inset LatexCommand index
+name "Support"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+SDCC has grown to be a large project.
+ The compiler alone (without the preprocessor, assembler and linker) is
+ well over 150,000 lines of code (blank stripped).
+ The open source nature of this project is a key to its continued growth
+ and support.
+ You gain the benefit and support of many active software developers and
+ end users.
+ Is SDCC perfect? No, that's why we need your help.
+ The developers take pride in fixing reported bugs.
+ You can help by reporting the bugs and helping other SDCC users.
+ There are lots of ways to contribute, and we encourage you to take part
+ in making SDCC a great software package.
+
+\end_layout
+
+\begin_layout Standard
+The SDCC project is hosted on the SDCC sourceforge site at
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/projects/sdcc"
+
+\end_inset
+
+.
+ You'll find the complete set of mailing lists
+\begin_inset LatexCommand index
+name "Mailing list(s)"
+
+\end_inset
+
+, forums, bug reporting system, patch submission
+\begin_inset LatexCommand index
+name "Patch submission"
+
+\end_inset
+
+ system, download
+\begin_inset LatexCommand index
+name "download"
+
+\end_inset
+
+ area and Subversion code repository
+\begin_inset LatexCommand index
+name "Subversion code repository"
+
+\end_inset
+
+ there.
+\end_layout
+
+\begin_layout Section
+Reporting Bugs
+\begin_inset LatexCommand index
+name "Bug reporting"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Reporting bugs"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The recommended way of reporting bugs is using the infrastructure of the
+ sourceforge site.
+ You can follow the status of bug reports there and have an overview about
+ the known bugs.
+\end_layout
+
+\begin_layout Standard
+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
+ (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 -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand index
+name "-\\/-dumpall"
+
+\end_inset
+
+ option can sometimes be useful in locating optimization problems.
+ When reporting a bug please make sure you:
+\end_layout
+
+\begin_layout Enumerate
+Attach the code you are compiling with SDCC.
+
+\end_layout
+
+\begin_layout Enumerate
+Specify the exact command you use to run SDCC, or attach your Makefile.
+
+\end_layout
+
+\begin_layout Enumerate
+Specify the SDCC version (type "
+\family sans
+\series bold
+sdcc -v
+\family default
+\series default
+"), your platform, and operating system.
+
+\end_layout
+
+\begin_layout Enumerate
+Provide an exact copy of any error message or incorrect output.
+
+\end_layout
+
+\begin_layout Enumerate
+Put something meaningful in the subject of your message.
+\end_layout
+
+\begin_layout Standard
+Please attempt to include these 5 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!
+\end_layout
+
+\begin_layout Standard
+Please have a short check that you are using a recent version of SDCC and
+ the bug is not yet known.
+ This is the link for reporting bugs:
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/tracker/?group_id=599&atid=100599"
+
+\end_inset
+
+.
+ With SDCC on average having more than 200 downloads
+\begin_inset LatexCommand index
+name "download"
+
+\end_inset
+
+ on sourceforge per day
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+220 daily downloads on average Jan-Sept 2006 and about 150 daily downloads
+ between 2002 and 2005.
+ This does not include other methods of distribution.
+\end_layout
+
+\end_inset
+
+ there must be some users.
+ So it's not exactly easy to find a new bug.
+ If you find one we need it:
+\emph on
+reporting bugs is good
+\emph default
+.
+\end_layout
+
+\begin_layout Section
+Requesting Features
+\begin_inset LatexCommand label
+name "sub:Requesting-Features"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Feature request"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Requesting features"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Like bug reports feature requests are forwarded to the developer mailing
+ list.
+ This is the link for requesting features:
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/tracker/?group_id=599&atid=350599"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Section
+Submitting patches
+\end_layout
+
+\begin_layout Standard
+Like bug reports contributed patches are forwarded to the developer mailing
+ list.
+ This is the link for submitting patches
+\begin_inset LatexCommand index
+name "Patch submission"
+
+\end_inset
+
+:
+\begin_inset LatexCommand url
+target "http://sourceforge.net/tracker/?group_id=599&atid=300599"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+You need to specify some parameters to the
+\family typewriter
+diff
+\family default
+ command for the patches to be useful.
+ If you modified more than one file a patch created f.e.
+ with
+\family sans
+\series bold
+
+\begin_inset Quotes sld
+\end_inset
+
+diff -Naur unmodified_directory modified_directory >my_changes.patch
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+\series default
+ will be fine, otherwise
+\family sans
+\series bold
+
+\begin_inset Quotes sld
+\end_inset
+
+diff -u sourcefile.c.orig sourcefile.c >my_changes.patch
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+\series default
+ will do.
+\end_layout
+
+\begin_layout Section
+Getting Help
+\end_layout
+
+\begin_layout Standard
+These links should take you directly to the
+\begin_inset LatexCommand url
+name "Mailing lists"
+target "http://sourceforge.net/mail/?group_id=599"
+
+\end_inset
+
+
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
+ automated messages (mid 2003)
+\end_layout
+
+\end_inset
+
+ and the
+\begin_inset LatexCommand url
+name "Forums"
+target "http://sourceforge.net/forum/?group_id=599"
+
+\end_inset
+
+, lists
+\begin_inset LatexCommand index
+name "Mailing list(s)"
+
+\end_inset
+
+ and forums are archived and searchable so if you are lucky someone already
+ had a similar problem.
+ While mails to the lists themselves are delivered promptly their web front
+ end on sourceforge sometimes shows a severe time lag (up to several weeks),
+ if you're seriously using SDCC please consider subscribing to the lists.
+\end_layout
+
+\begin_layout Section
+ChangeLog
+\end_layout
+
+\begin_layout Standard
+You can follow the status of the Subversion version
+\begin_inset LatexCommand index
+name "version"
+
+\end_inset
+
+ of SDCC by watching the Changelog
+\begin_inset LatexCommand index
+name "Changelog"
+
+\end_inset
+
+ in the Subversion repository
+\size footnotesize
+
+\begin_inset LatexCommand htmlurl
+target "http://sdcc.svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Section
+Subversion Source Code Repository
+\end_layout
+
+\begin_layout Standard
+The output of
+\family sans
+\series bold
+sdcc -
+\family default
+
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\family sans
+-version
+\family default
+\series default
+ or the filenames of the snapshot versions of SDCC include date and its
+ Subversion
+\begin_inset LatexCommand index
+name "Subversion code repository"
+
+\end_inset
+
+ number.
+ Subversion allows to download the source of recent or previous versions
+
+\begin_inset LatexCommand url
+target "http://sourceforge.net/svn/?group_id=599"
+
+\end_inset
+
+ (by number or by date).
+ An on-line source code browser and detailled instructions are also available
+ there.
+ SDCC versions starting from 1999 up to now are available (currently the
+ versions prior to the conversion from cvs
+\begin_inset LatexCommand index
+name "cvs|see{Subversion}"
+
+\end_inset
+
+ to Subversion (April 2006) are either by accessible by Subversion or by
+ cvs).
+\end_layout
+
+\begin_layout Section
+Release policy
+\begin_inset LatexCommand index
+name "Release policy"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Historically there often were long delays between official releases and
+ the sourceforge download area tends to get not updated at all.
+ Excuses in the past might have referred to problems with live range analysis,
+ but as this was fixed a while ago, the current problem is that another
+ excuse has to be found.
+ Kidding aside, we have to get better there! On the other hand there are
+ daily snapshots available at
+\begin_inset LatexCommand htmlurl
+name "snap"
+target "http://sdcc.sourceforge.net/snap.php"
+
+\end_inset
+
+, and you can always build the very last version (hopefully with many bugs
+ fixed, and features added) from the source code available at
+\begin_inset LatexCommand htmlurl
+name "Source"
+target "http://sdcc.sourceforge.net/snap.php#Source"
+
+\end_inset
+
+.
+ The SDCC Wiki
+\begin_inset LatexCommand index
+name "wiki"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "SDCC Wiki"
+
+\end_inset
+
+ at
+\begin_inset LatexCommand url
+target "http://sdcc.wiki.sourceforge.net/"
+
+\end_inset
+
+ also holds some information about past and future releases.
+\end_layout
+
+\begin_layout Section
+Examples
+\begin_inset LatexCommand index
+name "Examples"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+You'll find some small examples in the directory
+\emph on
+sdcc/device/examples/.
+
+\emph default
+ More examples and libraries are available at
+\emph on
+The SDCC Open Knowledge Resource
+\begin_inset LatexCommand url
+target "http://sdccokr.dl9sec.de/"
+
+\end_inset
+
+
+\emph default
+ web site or at
+\begin_inset LatexCommand url
+target "http://www.pjrc.com/tech/8051/"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+I did insert a reference to Paul's web site here although it seems rather
+ dedicated to a specific 8032 board (I think it's okay because it f.e.
+ shows LCD/Harddisc interface and has a free 8051 monitor.
+ Independent 8032 board vendors face hard competition of heavily subsidized
+ development boards anyway).
+\end_layout
+
+\begin_layout Standard
+Maybe we should include some links to real world applications.
+ Preferably pointer to pointers (one for each architecture) so this stays
+ manageable here?
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Quality control
+\begin_inset LatexCommand label
+name "sec:Quality-control"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Quality control"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The compiler is passed through snaphot build compile and build checks.
+ The so called
+\shape italic
+regression tests
+\shape default
+
+\begin_inset LatexCommand index
+name "Regression test"
+
+\end_inset
+
+ check that SDCC itself compiles flawlessly on several host platforms (i386,
+ Opteron, 64 bit Alpha, ppc64, Mac OS X on ppc and i386, Solaris on Sparc)
+ and checks the quality of the code generated by SDCC by running the code
+ for several target platforms through simulators.
+ The regression test suite comprises more than 100 files which expand to
+ more than 500 test cases which include more than 4500 tests.
+ The results of these tests are published daily on SDCC's snapshot page
+ (click on the red or green symbols on the right side of
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/snap.php"
+
+\end_inset
+
+).
+\end_layout
+
+\begin_layout Standard
+There is a separate document
+\shape italic
+test_suite.pdf
+\begin_inset LatexCommand index
+name "Test suite"
+
+\end_inset
+
+
+\shape default
+
+\begin_inset LatexCommand url
+target "http://sdcc.sourceforge.net/doc/test_suite_spec.pdf"
+
+\end_inset
+
+ about the regression test suite.
+\end_layout
+
+\begin_layout Standard
+You'll find the test code in the directory
+\shape italic
+sdcc/support/regression
+\shape default
+.
+ You can run these tests manually by running
+\family sans
+make
+\family default
+ in this directory (or f.e.
+
+\family sans
+\series bold
+
+\begin_inset Quotes sld
+\end_inset
+
+make test-mcs51
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+\series default
+ if you don't want to run the complete tests).
+ The test code might also be interesting if you want to look for examples
+\begin_inset LatexCommand index
+name "Examples"
+
+\end_inset
+
+ checking corner cases of SDCC or if you plan to submit patches
+\begin_inset LatexCommand index
+name "Patch submission"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+The PIC14 port uses a different set of regression tests
+\begin_inset LatexCommand index
+name "Regression test (PIC14)"
+
+\end_inset
+
+, you'll find them in the directory
+\shape italic
+sdcc/src/regression
+\shape default
+.
+\end_layout
+
+\begin_layout Section
+Use of SDCC in Education
+\end_layout
+
+\begin_layout Standard
+In short:
+\emph on
+highly
+\emph default
+ encouraged
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+the phrase "use in education" might evoke the association "
+\emph on
+only
+\emph default
+ fit for use in education".
+ This connotation is not intended but nevertheless risked as the licensing
+ of SDCC makes it difficult to offer educational discounts
+\end_layout
+
+\end_inset
+
+.
+ If your rationales are to:
+\end_layout
+
+\begin_layout Enumerate
+give students a chance to understand the
+\emph on
+complete
+\emph default
+ steps of code generation
+\end_layout
+
+\begin_layout Enumerate
+have a curriculum that can be extended for years.
+ Then you could use an fpga board as target and your curriculum will seamlessly
+ extend from logic synthesis (
+\begin_inset LatexCommand url
+name "http://www.opencores.org"
+target "opencores.org"
+
+\end_inset
+
+,
+\begin_inset LatexCommand url
+name "Oregano"
+target "http://www.oregano.at/ip/ip01.htm"
+
+\end_inset
+
+), over assembly programming, to C to FPGA compilers (
+\begin_inset LatexCommand url
+name "FPGAC"
+target "http://sf.net/projects/fpgac"
+
+\end_inset
+
+) and to C.
+\end_layout
+
+\begin_layout Enumerate
+be able to insert excursions about skills like using a revision control
+ system, submitting/applying patches, using a type-setting (as opposed to
+ word-processing) engine LyX/LaTeX, using
+\begin_inset LatexCommand url
+name "SourceForge"
+target "http://www.sf.net"
+
+\end_inset
+
+, following some
+\begin_inset LatexCommand url
+name "netiquette"
+target "http://en.wikipedia.org/wiki/Netiquette"
+
+\end_inset
+
+, understanding BSD/LGPL/GPL/Proprietary licensing, growth models of Open
+ Source Software, CPU simulation, compiler regression tests
+\begin_inset LatexCommand index
+name "Regression test"
+
+\end_inset
+
+.
+
+\newline
+And if there should be a shortage of ideas then you can always point students
+ to the ever-growing feature request list
+\begin_inset LatexCommand htmlurl
+target "http://sourceforge.net/tracker/?group_id=599&atid=350599"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Enumerate
+not tie students to a specific host platform and instead allow them to use
+ a host platform of
+\emph on
+their
+\emph default
+ choice (among them Alpha, i386, i386_64, Mac OS X, Mips, Sparc, Windows
+ and eventually
+\begin_inset LatexCommand url
+name "OLPC"
+target "http://www.laptop.org"
+
+\end_inset
+
+)
+\end_layout
+
+\begin_layout Enumerate
+not encourage students to use illegal copies of educational software
+\end_layout
+
+\begin_layout Enumerate
+be immune to licensing/availability/price changes of the chosen tool chain
+\end_layout
+
+\begin_layout Enumerate
+be able to change to a new target platform without having to adopt a new
+ tool chain
+\end_layout
+
+\begin_layout Enumerate
+have complete control over and insight into the tool chain
+\end_layout
+
+\begin_layout Enumerate
+make your students aware about the pros and cons of open source software
+ development
+\end_layout
+
+\begin_layout Enumerate
+give back to the public as you are probably at least partially publicly
+ funded
+\end_layout
+
+\begin_layout Enumerate
+give students a chance to publicly prove their skills and to possibly see
+ a world wide impact
+\end_layout
+
+\begin_layout Standard
+then SDCC is probably among the first choices.
+ Well, probably SDCC might be the only choice.
+\newpage
+
+\end_layout
+
+\begin_layout Chapter
+SDCC Technical Data
+\end_layout
+
+\begin_layout Section
+Optimizations
+\begin_inset LatexCommand index
+name "Optimizations"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+SDCC performs a host of standard optimizations in addition to some MCU specific
+ optimizations.
+
+\end_layout
+
+\begin_layout Subsection
+Sub-expression Elimination
+\begin_inset LatexCommand index
+name "Subexpression elimination"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The compiler does local and
+\emph on
+g
+\emph default
+lobal
+\emph on
+c
+\emph default
+ommon
+\emph on
+s
+\emph default
+ubexpression
+\emph on
+e
+\emph default
+limination, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+i = x + y + 1;
+\newline
+j = x + y;
+\end_layout
+
+\begin_layout Standard
+will be translated to
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+iTemp = x + y;
+\newline
+i = iTemp + 1;
+\newline
+j = iTemp;
+\end_layout
+
+\begin_layout Standard
+Some subexpressions are not as obvious as the above example, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+a->b[i].c = 10;
+\newline
+a->b[i].d = 11;
+\end_layout
+
+\begin_layout Standard
+In this case the address arithmetic a->b[i] will be computed only once;
+ the equivalent code in C would be.
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+iTemp = a->b[i];
+\newline
+iTemp.c = 10;
+\newline
+iTemp.d = 11;
+\end_layout
+
+\begin_layout Standard
+The compiler will try to keep these temporary variables in registers.
+\end_layout
+
+\begin_layout Subsection
+Dead-Code Elimination
+\begin_inset LatexCommand index
+name "Dead-code elimination"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+int global;
+\newline
+
+\newline
+void f () {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+int i;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+i = 1; \InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+/* dead store */
+\newline
+\InsetSpace ~
+\InsetSpace ~
+global = 1;\InsetSpace ~
+/* dead
+ store */
+\newline
+\InsetSpace ~
+\InsetSpace ~
+global = 2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+return;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+global = 3;\InsetSpace ~
+/* unreachable */
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+will be changed to
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+int global;
+\newline
+
+\newline
+void f () {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+global = 2;
+\newline
+}
+\end_layout
+
+\begin_layout Subsection
+Copy-Propagation
+\begin_inset LatexCommand index
+name "Copy propagation"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+int f() {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+int i, j;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+i = 10;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+j = i;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+return j;
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+will be changed to
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+int f() {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+int i, j;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+i = 10;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+j = 10;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+return 10;
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+Note: the dead stores created by this copy propagation will be eliminated
+ by dead-code elimination.
+\end_layout
+
+\begin_layout Subsection
+Loop Optimizations
+\begin_inset LatexCommand index
+name "Loop optimization"
+
+\end_inset
+
+
+\begin_inset LatexCommand label
+name "sub:Loop-Optimizations"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Two types of loop optimizations are done by SDCC
+\emph on
+loop invariant
+\emph default
+ lifting and
+\emph on
+strength reduction
+\emph default
+ of loop induction variables.
+ In addition to the strength reduction the optimizer marks the induction
+ variables and the register allocator tries to keep the induction variables
+ in registers for the duration of the loop.
+ Because of this preference of the register allocator
+\begin_inset LatexCommand index
+name "Register allocation"
+
+\end_inset
+
+, loop induction optimization causes an increase in register pressure, which
+ may cause unwanted spilling of other temporary variables into the stack
+\begin_inset LatexCommand index
+name "stack"
+
+\end_inset
+
+ / data space.
+ The compiler will generate a warning message when it is forced to allocate
+ extra space either on the stack or data space.
+ If this extra space allocation is undesirable then induction optimization
+ can be eliminated either for the entire source file (with -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-noinduction option) or for a given function only using #pragma\InsetSpace ~
+noinduction
+\begin_inset LatexCommand index
+name "\\#pragma noinduction"
+
+\end_inset
+
+.
+\newline
+
+\newline
+Loop Invariant:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+for (i = 0 ; i < 100 ; i ++)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+f += k + l;
+\end_layout
+
+\begin_layout Standard
+changed to
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+itemp = k + l;
+\newline
+for (i = 0; i < 100; i++)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+f += itemp;
+\end_layout
+
+\begin_layout Standard
+As mentioned previously some loop invariants are not as apparent, all static
+ address computations are also moved out of the loop.
+\newline
+
+\newline
+Strength Reduction
+\begin_inset LatexCommand index
+name "Strength reduction"
+
+\end_inset
+
+, this optimization substitutes an expression by a cheaper expression:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+for (i=0;i < 100; i++)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ar[i*5] = i*3;
+\end_layout
+
+\begin_layout Standard
+changed to
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+itemp1 = 0;
+\newline
+itemp2 = 0;
+\newline
+for (i=0;i< 100;i++) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ar[itemp1] = itemp2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+itemp1
+ += 5;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+itemp2 += 3;
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+The more expensive multiplication
+\begin_inset LatexCommand index
+name "Multiplication"
+
+\end_inset
+
+ is changed to a less expensive addition.
+\end_layout
+
+\begin_layout Subsection
+Loop Reversing
+\begin_inset LatexCommand index
+name "Loop reversing"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This optimization is done to reduce the overhead of checking loop boundaries
+ for every iteration.
+ Some simple loops can be reversed and implemented using a
+\begin_inset Quotes eld
+\end_inset
+
+decrement and jump if not zero
+\begin_inset Quotes erd
+\end_inset
+
+ instruction.
+ SDCC checks for the following criterion to determine if a loop is reversible
+ (note: more sophisticated compilers use data-dependency analysis to make
+ this determination, SDCC uses a more simple minded analysis).
+\end_layout
+
+\begin_layout Itemize
+The 'for' loop is of the form
+\newline
+
+\newline
+
+\family typewriter
+for(<symbol> = <expression>; <sym> [< | <=] <expression>; [<sym>++ | <sym>
+ += 1])
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+<for body>
+\end_layout
+
+\begin_layout Itemize
+The <for body> does not contain
+\begin_inset Quotes eld
+\end_inset
+
+continue
+\begin_inset Quotes erd
+\end_inset
+
+ or 'break
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Itemize
+All goto's are contained within the loop.
+\end_layout
+
+\begin_layout Itemize
+No function calls within the loop.
+\end_layout
+
+\begin_layout Itemize
+The loop control variable <sym> is not assigned any value within the loop
+\end_layout
+
+\begin_layout Itemize
+The loop control variable does NOT participate in any arithmetic operation
+ within the loop.
+\end_layout
+
+\begin_layout Itemize
+There are NO switch statements in the loop.
+\end_layout
+
+\begin_layout Subsection
+Algebraic Simplifications
+\end_layout
+
+\begin_layout Standard
+SDCC does numerous algebraic simplifications, the following is a small sub-set
+ of these optimizations.
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+i = j + 0;\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ /* changed to: */\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ i = j;
+\newline
+i /= 2;\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ /* changed to: */\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ i >>= 1;
+\newline
+i
+ = j - j;\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ /* changed to: */\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ i = 0;
+\newline
+i = j / 1;\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ /* changed to: */\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ i = j;
+\end_layout
+
+\begin_layout Standard
+Note the subexpressions
+\begin_inset LatexCommand index
+name "Subexpression"
+
+\end_inset
+
+ given above are generally introduced by macro expansions or as a result
+ of copy/constant propagation.
+\end_layout
+
+\begin_layout Subsection
+'switch' Statements
+\begin_inset LatexCommand label
+name "sub:'switch'-Statements"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "switch statement"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+SDCC can optimize switch statements to jump tables
+\begin_inset LatexCommand index
+name "jump tables"
+
+\end_inset
+
+.
+ It makes the decision based on an estimate of the generated code size.
+ SDCC is quite liberal in the requirements for jump table generation:
+\end_layout
+
+\begin_layout Itemize
+The labels need not be in order, and the starting number need not be one
+ or zero, the case labels are in numerical sequence or not too many case
+ labels are missing.
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+switch(i) {\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+switch (i) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 4: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 0: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 5: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 1: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 3: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 6: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 3: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 7: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 4: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 8: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 5: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 9: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 6: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 10: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 7: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 11: ...\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+case 8: ...
+
+\newline
+}\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+}
+\end_layout
+
+\begin_layout Standard
+Both the above switch statements will be implemented using a jump-table.
+ The example to the right side is slightly more efficient as the check for
+ the lower boundary of the jump-table is not needed.
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+The number of case labels is not larger than supported by the target architectur
+e.
+\end_layout
+
+\begin_layout Itemize
+If the case labels are not in numerical sequence ('gaps' between cases)
+ SDCC checks whether a jump table with additionally inserted dummy cases
+ is still attractive.
+
+\end_layout
+
+\begin_layout Itemize
+If the starting number is not zero and a check for the lower boundary of
+ the jump-table can thus be eliminated SDCC might insert dummy cases 0,
+ ...
+ .
+\end_layout
+
+\begin_layout Standard
+Switch statements which have large gaps in the numeric sequence or those
+ that have too many case labels can be split into more than one switch statement
+ for efficient code generation, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+switch (i) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 1: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 2: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 3: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 4: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 5: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 6: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 7: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 101: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 102: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 103: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 104: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 105: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 106: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 107: ...
+
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+If the above switch statement is broken down into two switch statements
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+switch (i) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 1: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 2: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 3: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 4: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 5: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 6: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 7: ...
+
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+and
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+switch (i) {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 101: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 102: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 103: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 104: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 105: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 106: ...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+case 107: ...
+
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+then both the switch statements will be implemented using jump-tables whereas
+ the unmodified switch statement will not be.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Standard
+There might be reasons which SDCC cannot know about to either favour or
+ not favour jump tables.
+ If the target system has to be as quick for the last switch case as for
+ the first (pro jump table), or if the switch argument is known to be zero
+ in the majority of the cases (contra jump table).
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The pragma nojtbound
+\begin_inset LatexCommand index
+name "\\#pragma nojtbound"
+
+\end_inset
+
+ can be used to turn off checking the
+\emph on
+j
+\emph default
+ump
+\emph on
+t
+\emph default
+able
+\emph on
+bound
+\emph default
+aries.
+ It has no effect if a default label is supplied.
+ Use of this pragma is dangerous: if the switch
+\begin_inset LatexCommand index
+name "switch statement"
+
+\end_inset
+
+ argument is not matched by a case statement the processor will happily
+ jump into Nirvana.
+\end_layout
+
+\begin_layout Subsection
+Bit-shifting Operations
+\begin_inset LatexCommand index
+name "Bit shifting"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+Bit shifting is one of the most frequently used operation in embedded programmin
+g.
+ SDCC tries to implement bit-shift operations in the most efficient way
+ possible, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+unsigned char i;
+\newline
+...
+
+\newline
+i >>= 4;
+\newline
+...
+\end_layout
+
+\begin_layout Standard
+generates the following code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+mov\InsetSpace ~
+ a,_i
+\newline
+swap a
+\newline
+anl\InsetSpace ~
+ a,#0x0f
+\newline
+mov\InsetSpace ~
+ _i,a
+\end_layout
+
+\begin_layout Standard
+In general SDCC will never setup a loop if the shift count is known.
+ Another example:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+unsigned int i;
+\newline
+...
+
+\newline
+i >>= 9;
+\newline
+...
+\end_layout
+
+\begin_layout Standard
+will generate:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+mov\InsetSpace ~
+\InsetSpace ~
+a,(_i + 1)
+\newline
+mov\InsetSpace ~
+\InsetSpace ~
+(_i + 1),#0x00
+\newline
+clr\InsetSpace ~
+\InsetSpace ~
+c
+\newline
+rrc\InsetSpace ~
+\InsetSpace ~
+a
+\newline
+mov\InsetSpace ~
+\InsetSpace ~
+_i,a
+\end_layout
+
+\begin_layout Subsection
+Bit-rotation
+\begin_inset LatexCommand index
+name "Bit rotation"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+A special case of the bit-shift operation is bit rotation
+\begin_inset LatexCommand index
+name "rotating bits"
+
+\end_inset
+
+, SDCC recognizes the following expression to be a left bit-rotation:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+unsigned
+\series default
+\InsetSpace ~
+\InsetSpace ~
+char i;\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+/* unsigned is needed for rotation */
+\newline
+...
+
+\newline
+i = ((i << 1) | (i >> 7));
+\family default
+
+\newline
+
+\family typewriter
+...
+\end_layout
+
+\begin_layout Standard
+will generate the following code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+mov\InsetSpace ~
+\InsetSpace ~
+a,_i
+\newline
+rl\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+a
+\newline
+mov\InsetSpace ~
+\InsetSpace ~
+_i,a
+\end_layout
+
+\begin_layout Standard
+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.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+i = ((i >> 7) | (i << 1)); /* left-bit rotation */
+\end_layout
+
+\begin_layout Subsection
+Nibble and Byte Swapping
+\end_layout
+
+\begin_layout Standard
+Other special cases of the bit-shift operations are nibble or byte swapping
+\begin_inset LatexCommand index
+name "swapping nibbles/bytes"
+
+\end_inset
+
+, SDCC recognizes the following expressions:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\series bold
+unsigned
+\series default
+\InsetSpace ~
+\InsetSpace ~
+char i;
+\newline
+
+\series bold
+unsigned
+\series default
+\InsetSpace ~
+\InsetSpace ~
+int j;
+\newline
+...
+
+\newline
+i = ((i << 4) | (i >> 4));
+\family default
+
+\newline
+
+\family typewriter
+j = ((j << 8) | (j >> 8));
+\end_layout
+
+\begin_layout Standard
+and generates a swap instruction for the nibble swapping
+\begin_inset LatexCommand index
+name "Nibble swapping"
+
+\end_inset
+
+ or move instructions for the byte swapping
+\begin_inset LatexCommand index
+name "Byte swapping"
+
+\end_inset
+
+.
+ The
+\begin_inset Quotes sld
+\end_inset
+
+j
+\begin_inset Quotes srd
+\end_inset
+
+ example can be used to convert from little to big-endian or vice versa.
+ If you want to change the endianness of a
+\emph on
+signed
+\emph default
+ integer you have to cast to
+\family typewriter
+(unsigned int)
+\family default
+ first.
+\end_layout
+
+\begin_layout Standard
+Note that SDCC stores numbers in little-endian
+\begin_inset Foot
+status open
+
+\begin_layout Standard
+Usually 8-bit processors don't care much about endianness.
+ This is not the case for the standard 8051 which only has an instruction
+ to increment its
+\emph on
+dptr
+\emph default
+
+\begin_inset LatexCommand index
+name "DPTR"
+
+\end_inset
+
+-datapointer so little-endian is the more efficient byte order.
+\end_layout
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "little-endian"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Endianness"
+
+\end_inset
+
+ format (i.e.
+ lowest order first).
+\end_layout
+
+\begin_layout Subsection
+Highest Order Bit
+\begin_inset LatexCommand index
+name "Highest Order Bit"
+
+\end_inset
+
+ / Any Order Bit
+\begin_inset LatexCommand index
+name "Any Order Bit"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+It is frequently required to obtain the highest order bit of an integral
+ type (long, int, short or char types).
+ Also obtaining any other order bit is not uncommon.
+ SDCC recognizes the following expressions to yield the highest order bit
+ and generates optimized code for it, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+unsigned int gint;
+\newline
+
+\newline
+foo () {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+unsigned char hob1, aob1;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+bit hob2, hob3, aob2,
+ aob3;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+hob1 = (gint >> 15) & 1;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+hob2 = (gint >> 15) & 1;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+hob3 = gint & 0x8000;
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+aob1 = (gint >> 9) & 1;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+aob2 = (gint >> 8) & 1;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+aob3 = gint & 0x0800;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+..
+
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+will generate the following code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 61 ;\InsetSpace ~
+ hob.c 7
+\newline
+000A E5*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 62\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ a,(_gint + 1)
+\newline
+000C 23\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 63\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ rl\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ a
+\newline
+000D 54 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+ 64\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ anl\InsetSpace ~
+\InsetSpace ~
+ a,#0x01
+\newline
+000F F5*02\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 65\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_hob1_1_1,a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 66 ;\InsetSpace ~
+ hob.c 8
+\newline
+0011 E5*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+ 67\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ a,(_gint + 1)
+\newline
+0013 33\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 68\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ rlc\InsetSpace ~
+\InsetSpace ~
+ a
+\newline
+0014 92*00\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 69\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_hob2_1_1,c
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 66 ;\InsetSpace ~
+ hob.c 9
+\newline
+0016 E5*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 67\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ a,(_gint + 1)
+\newline
+0018 33\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 68\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ rlc\InsetSpace ~
+\InsetSpace ~
+ a
+\newline
+0019 92*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+ 69\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_hob3_1_1,c
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 70 ;\InsetSpace ~
+ hob.c 10
+\newline
+001B E5*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 71\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ a,(_gint + 1)
+\newline
+001D
+ 03\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 72\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ rr\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ a
+\newline
+001E 54 01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 73\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ anl\InsetSpace ~
+\InsetSpace ~
+ a,#0x01
+\newline
+0020 F5*03\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 74\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_aob1_1_1,a
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 75 ;\InsetSpace ~
+ hob.c 11
+\newline
+0022 E5*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 76\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ a,(_gint + 1)
+\newline
+0024 13\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 77\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ rrc\InsetSpace ~
+\InsetSpace ~
+ a
+\newline
+0025 92*02\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+ 78\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_aob2_1_1,c
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 79 ;\InsetSpace ~
+ hob.c 12
+\newline
+0027 E5*01\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 80\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ a,(_gint + 1)
+\newline
+0029
+ A2 E3\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 81\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ c,acc[3]
+\newline
+002B 92*03\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 82\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_aob3_1_1,c
+\end_layout
+
+\begin_layout Standard
+Other variations of these cases however will
+\emph on
+not
+\emph default
+ be recognized.
+ They are standard C expressions, so I heartily recommend these be the only
+ 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.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+xyz = gint + ((gint >> 15) & 1);
+\end_layout
+
+\begin_layout Standard
+will still be recognized.
+\end_layout
+
+\begin_layout Subsection
+Higher Order Byte
+\begin_inset LatexCommand index
+name "Higher Order Byte"
+
+\end_inset
+
+ / Higher Order Word
+\begin_inset LatexCommand index
+name "Higher Order Word"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+It is also frequently required to obtain a higher order byte or word of
+ a larger integral type (long, int or short types).
+ SDCC recognizes the following expressions to yield the higher order byte
+ or word and generates optimized code for it, e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+unsigned int gint;
+\newline
+unsigned long int glong;
+\newline
+
+\newline
+foo () {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+unsigned char hob1,
+ hob2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+unsigned int how1, how2;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+hob1 = (gint >> 8) & 0xFF;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+hob2 = glong >> 24;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+how1 = (glong >> 16) & 0xFFFF;
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+how2 = glong >> 8;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+..
+
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+will generate the following code:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 91 ;\InsetSpace ~
+ hob.c 15
+\newline
+0037 85*01*06\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 92\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_hob1_1_1,(_gint + 1)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 93 ;\InsetSpace ~
+ hob.c
+ 16
+\newline
+003A 85*05*07\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 94\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_hob2_1_1,(_glong + 3)
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 95 ;\InsetSpace ~
+ hob.c 17
+\newline
+003D 85*04*08\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+ 96\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_how1_1_1,(_glong + 2)
+\newline
+0040 85*05*09\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 97\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ (_foo_how1_1_1 +
+ 1),(_glong + 3)
+\newline
+0043 85*03*0A\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ 98\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ _foo_how2_1_1,(_glong + 1)
+\newline
+0046 85*04*0B\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+
+ 99\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+ mov\InsetSpace ~
+\InsetSpace ~
+ (_foo_how2_1_1 + 1),(_glong + 2)
+\end_layout
+
+\begin_layout Standard
+Again, variations of these cases may
+\emph on
+not
+\emph default
+ be recognized.
+ They are standard C expressions, so I heartily recommend these be the only
+ way to get the higher order byte/word, (it is portable).
+ Of course it will be recognized even if it is embedded in other expressions,
+ e.g.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+xyz = gint + ((gint >> 8) & 0xFF);
+\end_layout
+
+\begin_layout Standard
+will still be recognized.
+\end_layout
+
+\begin_layout Subsection
+Peephole Optimizer
+\begin_inset LatexCommand label
+name "sub:Peephole-Optimizer"
+
+\end_inset
+
+
+\begin_inset LatexCommand index
+name "Peephole optimizer"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The compiler uses a rule based, pattern matching and re-writing mechanism
+ for peep-hole optimization.
+ It is inspired by
+\emph on
+copt
+\emph default
+ a peep-hole optimizer by Christopher W.
+ Fraser (cwfraser\InsetSpace ~
+@\InsetSpace ~
+microsoft.com).
+ A default set of rules are compiled into the compiler, additional rules
+ may be added with the
+\emph on
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-peep-file
+\begin_inset LatexCommand index
+name "-\\/-peep-file"
+
+\end_inset
+
+ <filename>
+\emph default
+ option.
+ The rule language is best illustrated with examples.
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+replace {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+mov %1,a
+\newline
+\InsetSpace ~
+\InsetSpace ~
+mov a,%1
+\newline
+} by {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+mov %1,a
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+The above rule will change the following assembly
+\begin_inset LatexCommand index
+name "Assembler routines"
+
+\end_inset
+
+ sequence:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+mov r1,a
+\newline
+mov a,r1
+\end_layout
+
+\begin_layout Standard
+to
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+mov r1,a
+\end_layout
+
+\begin_layout Standard
+Note: All occurrences of a
+\emph on
+%n
+\emph default
+ (pattern variable) must denote the same string.
+ With the above rule, the assembly sequence:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+mov r1,a
+\newline
+mov a,r2
+\end_layout
+
+\begin_layout Standard
+will remain unmodified.
+\newline
+
+\newline
+Other special case optimizations may be added by the
+ user (via
+\emph on
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-peep-file option
+\emph default
+).
+ E.g.
+ some variants of the 8051 MCU
+\begin_inset LatexCommand index
+name "MCS51 variants"
+
+\end_inset
+
+ allow only
+\family typewriter
+ajmp
+\family default
+ and
+\family typewriter
+acall
+\family default
+.
+ The following two rules will change all
+\family typewriter
+ljmp
+\family default
+ and
+\family typewriter
+lcall
+\family default
+ to
+\family typewriter
+ajmp
+\family default
+ and
+\family typewriter
+acall
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+replace { lcall %1 } by { acall %1 }
+\newline
+replace { ljmp %1 } by { ajmp %1 }
+\end_layout
+
+\begin_layout Standard
+(NOTE: from version 2.7.3 on, you can use option -
+\emph on
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+
+\emph default
+-acall-ajmp
+\begin_inset LatexCommand index
+name "-\\/-acall-ajmp"
+
+\end_inset
+
+, which also takes care of aligning the interrupt vectors properly.)
+\newline
+
+\end_layout
+
+\begin_layout Standard
+The
+\emph on
+inline-assembler code
+\emph default
+ is also passed through the peep hole optimizer, thus the peephole optimizer
+ can also be used as an assembly level macro expander.
+ The rules themselves are MCU dependent whereas the rule language infra-structur
+e is MCU independent.
+ Peephole optimization rules for other MCU can be easily programmed using
+ the rule language.
+\newline
+
+\newline
+The syntax for a rule is as follows:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+rule := replace [ restart ] '{' <assembly sequence> '
+\backslash
+n'
+\newline
+\InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ '}' by '{' '
+\backslash
+n'
+\newline
+\InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ <assembly sequence> '
+\backslash
+n'
+\newline
+\InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ '}' [if <functionName> ] '
+\backslash
+n'
+\end_layout
+
+\begin_layout Standard
+<assembly sequence> := assembly instruction (each instruction including
+ labels must be on a separate line).
+\newline
+
+\newline
+The optimizer will apply to the rules
+ one by one from the top in the sequence of their appearance, it will terminate
+ when all rules are exhausted.
+ If the 'restart' option is specified, then the optimizer will start matching
+ the rules again from the top, this option for a rule is expensive (performance)
+, it is intended to be used in situations where a transformation will trigger
+ the same rule again.
+ An example of this (not a good one, it has side effects) is the following
+ rule:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+replace restart {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+pop %1
+\newline
+\InsetSpace ~
+\InsetSpace ~
+push %1 } by {
+\newline
+\InsetSpace ~
+\InsetSpace ~
+; nop
+\newline
+}
+\end_layout
+
+\begin_layout Standard
+Note that the replace pattern cannot be a blank, but can be a comment line.
+ Without the 'restart' option only the innermost 'pop' 'push' pair would
+ be eliminated, i.e.:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+pop ar1
+\newline
+pop ar2
+\newline
+push ar2
+\newline
+push ar1
+\end_layout
+
+\begin_layout Standard
+would result in:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+pop ar1
+\newline
+; nop
+\newline
+push ar1
+\end_layout
+
+\begin_layout Standard
+
+\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:
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+; nop
+\newline
+; nop
+\end_layout
+
+\begin_layout Standard
+A conditional function can be attached to a rule.
+ Attaching rules are somewhat more involved, let me illustrate this with
+ an example.
+\end_layout
+
+\begin_layout Verse
+
+\family typewriter
+replace {
+\newline
+\InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+ljmp %5
+\newline
+%2:
+\newline
+} by {
+\newline
+\InsetSpace ~
+ \InsetSpace ~
+ \InsetSpace ~
+sjmp %5
+\newline
+%2:
+\newline
+} if labelInRange
+\end_layout
+
+\begin_layout Standard
+The optimizer does a look-up of a function name table defined in function
+
+\emph on
+callFuncByName
+\emph default
+ in the source file SDCCpeeph.c, with the name
+\emph on
+labelInRange
+\emph default
+.
+ If it finds a corresponding entry the function is called.
+ Note there can be no parameters specified for these functions, in this
+ case the use of
+\emph on
+%5
+\emph default
+ is crucial, since the function
+\emph on
+labelInRange
+\emph default
+ expects to find the label in that particular variable (the hash table containin
+g the variable bindings is passed as a parameter).
+ If you want to code more such functions, take a close look at the function
+ labelInRange and the calling mechanism in source file SDCCpeeph.c.
+ Currently implemented are
+\emph on
+labelInRange, labelRefCount, labelIsReturnOnly, operandsNotSame, xramMovcOption,
+ 24bitMode, portIsDS390, 24bitModeAndPortDS390
+\emph default
+ and
+\emph on
+notVolatile
+\emph default
+.
+\end_layout
+
+\begin_layout Standard
+I know this whole thing is a little kludgey, but maybe some day we will
+ have some better means.
+ If you are looking at this file, you will see the default rules that are
+ compiled into the compiler, you can add your own rules in the default set
+ there if you get tired of specifying the -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-peep-file option.
+\end_layout
+
+\begin_layout Section
+ANSI-Compliance
+\begin_inset LatexCommand index
+name "ANSI-compliance"
+
+\end_inset
+
+
+\begin_inset LatexCommand label
+name "sub:ANSI-Compliance"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The latest publicly available version of the standard
+\emph on
+ISO/IEC 9899 - Programming languages - C
+\emph default
+ should be available at:
+\begin_inset LatexCommand url
+target "http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899"
+
+\end_inset
+
+.
+\newline
+
+\end_layout
+
+\begin_layout Standard
+Deviations from the compliance:
+\end_layout
+
+\begin_layout Itemize
+functions are not reentrant
+\begin_inset LatexCommand index
+name "reentrant"
+
+\end_inset
+
+ unless explicitly declared as such or the
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand index
+name "-\\/-stack-auto"
+
+\end_inset
+
+
+\series default
+ command line option is specified.
+\end_layout
+
+\begin_layout Itemize
+structures
+\begin_inset LatexCommand index
+name "struct"
+
+\end_inset
+
+ and unions
+\begin_inset LatexCommand index
+name "union"
+
+\end_inset
+
+ cannot be assigned values directly, cannot be passed as function parameters
+ or assigned to each other and cannot be a return value
+\begin_inset LatexCommand index
+name "return value"
+
+\end_inset
+
+ from a function, e.g.:
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+struct s { ...
+ };
+\newline
+struct s s1, s2;
+\newline
+foo()
+\newline
+{
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+s1 = s2 ; /* is invalid in SDCC although allowed in ANSI */
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+...
+
+\newline
+}
+\newline
+
+\series bold
+struct
+\family default
+\series default
+
+\family typewriter
+s foo1 (
+\series bold
+struct
+\family default
+\series default
+
+\family typewriter
+s parms) /* invalid in SDCC although allowed in ANSI */
+\newline
+{
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+struct s rets;
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+...
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+return rets; /* is invalid in SDCC although allowed in ANSI */
+\newline
+}
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+initialization of structure arrays must be fully braced.
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+struct s { char x } a[] = {1, 2};\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+/* invalid in SDCC */
+\newline
+struct s { char x
+ } a[] = {{1}, {2}}; /* OK */
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+'long long
+\begin_inset LatexCommand index
+name "long long (not supported)"
+
+\end_inset
+
+' (64 bit integers
+\begin_inset LatexCommand index
+name "int (64 bit) (not supported)"
+
+\end_inset
+
+) not supported.
+\end_layout
+
+\begin_layout Itemize
+'double
+\begin_inset LatexCommand index
+name "double (not supported)"
+
+\end_inset
+
+' precision floating point
+\begin_inset LatexCommand index
+name "Floating point support"
+
+\end_inset
+
+not supported.
+\end_layout
+
+\begin_layout Itemize
+Old K&R style
+\begin_inset LatexCommand index
+name "K\\&R style"
+
+\end_inset
+
+ function declarations are NOT allowed.
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+foo(i,j) /* this old style of function declarations */
+\newline
+int i,j; /* is valid
+ in ANSI but not valid in SDCC */
+\newline
+{
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+...
+
+\newline
+}
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+Most enhancements in C99 are not supported, e.g.:
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+for (
+\series bold
+int
+\family default
+\series default
+
+\family typewriter
+i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+But some have been added recently in SDCC 2.7.0.
+ They must be considered alpha quality however.
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+\series bold
+inline
+\begin_inset LatexCommand index
+name "inline (not supported)"
+
+\end_inset
+
+
+\family default
+\series default
+
+\family typewriter
+int increment (int a) { return a+1; } /* inlines the increment without function
+ call overhead */
+\newline
+int *
+\family default
+
+\family typewriter
+\series bold
+restrict
+\begin_inset LatexCommand index
+name "inline (not supported)"
+
+\end_inset
+
+
+\family default
+\series default
+
+\family typewriter
+p; /* accepted but ignored */
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+Certain words that are valid identifiers in the standard may be reserved
+ words in SDCC unless the
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c89
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
+
+\end_inset
+
+
+\series default
+ or
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c99
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
+
+\end_inset
+
+
+\series default
+ command line options are used.
+ These may include (depending on the selected processor): 'at', 'banked',
+ 'bit', 'code', 'critical', 'data', 'eeprom', 'far', 'flash', 'idata', 'interrup
+t', 'near', 'nonbanked', 'pdata', 'reentrant', 'sbit', 'sfr', 'shadowregs',
+ 'sram', 'using', 'wparam', 'xdata', '_overlay', '_asm', '_endasm', and
+ '_naked'.
+ Compliant equivalents of these keywords are always available in a form
+ that begin with two underscores
+\begin_inset LatexCommand index
+name "\\_\\_ (prefix for extended keywords)"
+
+\end_inset
+
+, f.e.
+ '__data' instead of 'data'.
+\end_layout
+
+\begin_layout Itemize
+Integer promotion of variable arguments is not performed if the argument
+ is explicitly taypecasted unless the
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c89
+\begin_inset LatexCommand index
+name "-\\/-std-c89"
+
+\end_inset
+
+
+\series default
+ or
+\series bold
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-std-c99
+\begin_inset LatexCommand index
+name "-\\/-std-c99"
+
+\end_inset
+
+
+\series default
+ command line options are used.
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+void vararg_func (char *str, ...) { str; }
+\newline
+
+\newline
+void main (void)
+\newline
+{
+\newline
+\InsetSpace ~
+\InsetSpace ~
+char c = 10;
+\newline
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+/* argument
+ u is promoted to int before
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+* passing to function */
+\newline
+\InsetSpace ~
+\InsetSpace ~
+vararg_func ("%c", c);
+\newline
+
+\newline
+\InsetSpace ~
+\InsetSpace ~
+/*
+ argument u is not promoted to int,
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+* it is passed as char to function
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+* if
+ --std-cXX is not defined;
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+* is promoted to int before passing
+\newline
+\InsetSpace ~
+\InsetSpace ~
+\InsetSpace ~
+* to function
+ if --std-cXX is defined */
+\newline
+\InsetSpace ~
+\InsetSpace ~
+vararg_func ("%bc", (char)u);
+\newline
+}
+\end_layout
+
+\end_deeper
+\begin_layout Section
+Cyclomatic Complexity
+\begin_inset LatexCommand index
+name "Cyclomatic complexity"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Cyclomatic complexity of a function is defined as the number of independent
+ paths the program can take during execution of the function.
+ This is an important number since it defines the number test cases you
+ have to generate to validate the function.
+ The accepted industry standard for complexity number is 10, if the cyclomatic
+ complexity reported by SDCC exceeds 10 you should think about simplification
+ of the function logic.
+ Note that the complexity level is not related to the number of lines of
+ code in a function.
+ Large functions can have low complexity, and small functions can have large
+ complexity levels.
+
+\newline
+
+\newline
+SDCC uses the following formula to compute the complexity:
+\newline
+
+\end_layout
+
+\begin_layout Standard
+complexity = (number of edges in control flow graph) - (number of nodes
+ in control flow graph) + 2;
+\newline
+
+\newline
+Having said that the industry standard is 10,
+ you should be aware that in some cases it be may unavoidable to have a
+ complexity level of less than 10.
+ For example if you have switch statement with more than 10 case labels,
+ each case label adds one to the complexity level.
+ The complexity level is by no means an absolute measure of the algorithmic
+ complexity of the function, it does however provide a good starting point
+ for which functions you might look at for further optimization.
+\end_layout
+
+\begin_layout Section
+Retargetting for other Processors
+\end_layout
+
+\begin_layout Standard
+The issues for retargetting the compiler are far too numerous to be covered
+ by this document.
+ What follows is a brief description of each of the seven phases of the
+ compiler and its MCU dependency.
+\end_layout
+
+\begin_layout Itemize
+Parsing the source and building the annotated parse tree.
+ This phase is largely MCU independent (except for the language extensions).
+ Syntax & semantic checks are also done in this phase, along with some initial
+ optimizations like back patching labels and the pattern matching optimizations
+ like bit-rotation etc.
+\end_layout
+
+\begin_layout Itemize
+The second phase involves generating an intermediate code which can be easy
+ manipulated during the later phases.
+ This phase is entirely MCU independent.
+ The intermediate code generation assumes the target machine has unlimited
+ number of registers, and designates them with the name iTemp.
+ The compiler can be made to dump a human readable form of the code generated
+ by using the -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-dumpraw option.
+\end_layout
+
+\begin_layout Itemize
+This phase does the bulk of the standard optimizations and is also MCU independe
+nt.
+ This phase can be broken down into several sub-phases:
+\newline
+
+\newline
+Break down intermediate
+ code (iCode) into basic blocks.
+\newline
+Do control flow & data flow analysis on the
+ basic blocks.
+\newline
+Do local common subexpression elimination, then global subexpressio
+n elimination
+\newline
+Dead code elimination
+\newline
+Loop optimizations
+\newline
+If loop optimizations
+ caused any changes then do 'global subexpression elimination' and 'dead
+ code elimination' again.
+\end_layout
+
+\begin_layout Itemize
+This phase determines the live-ranges; by live range I mean those iTemp
+ variables defined by the compiler that still survive after all the optimization
+s.
+ Live range analysis
+\begin_inset LatexCommand index
+name "Live range analysis"
+
+\end_inset
+
+ is essential for register allocation, since these computation determines
+ which of these iTemps will be assigned to registers, and for how long.
+\end_layout
+
+\begin_layout Itemize
+Phase five is register allocation.
+ There are two parts to this process.
+\newline
+
+\newline
+The first part I call 'register packing'
+ (for lack of a better term).
+ In this case several MCU specific expression folding is done to reduce
+ register pressure.
+\newline
+
+\newline
+The second part is more MCU independent and deals with
+ allocating registers to the remaining live ranges.
+ A lot of MCU specific code does creep into this phase because of the limited
+ number of index registers available in the 8051.
+\end_layout
+
+\begin_layout Itemize
+The Code generation phase is (unhappily), entirely MCU dependent and very
+ little (if any at all) of this code can be reused for other MCU.
+ However the scheme for allocating a homogenized assembler operand for each
+ iCode operand may be reused.
+\end_layout
+
+\begin_layout Itemize
+As mentioned in the optimization section the peep-hole optimizer is rule
+ based system, which can reprogrammed for other MCUs.
+\end_layout
+
+\begin_layout Standard
+More information is available on SDCC Wiki
+\begin_inset LatexCommand index
+name "wiki"
+
+\end_inset
+
+ (preliminary link
+\begin_inset LatexCommand url
+target "http://sdcc.wiki.sourceforge.net/SDCC+internals+and+porting"
+
+\end_inset
+
+) and in the thread
+\begin_inset LatexCommand url
+target "http://sf.net/mailarchive/message.php?msg_id=13954144"
+
+\end_inset
+
+ .
+\end_layout
+
+\begin_layout Chapter
+Compiler internals
+\begin_inset LatexCommand index
+name "Compiler internals"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+The anatomy of the compiler
+\begin_inset LatexCommand label
+name "sub:The-anatomy-of"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\shape italic
+This is an excerpt from an article published in Circuit Cellar Magazine
+ in
+\shape default
+
+\series bold
+\shape italic
+August 2000
+\series default
+.
+ 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.
+\shape default
+
+\newline
+
+\newline
+The current version of SDCC can generate code for Intel 8051 and Z80 MCU.
+ It is fairly easy to retarget for other 8-bit MCU.
+ Here we take a look at some of the internals of the compiler.
+
+\end_layout
+
+\begin_layout Paragraph*
+Parsing
+\begin_inset LatexCommand index
+name "Parsing"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Parsing the input source file and creating an AST (Annotated Syntax Tree
+\begin_inset LatexCommand index
+name "Annotated syntax tree"
+
+\end_inset
+
+).
+ This phase also involves propagating types (annotating each node of the
+ parse tree with type information) and semantic analysis.
+ There are some MCU specific parsing rules.
+ For example the storage classes, the extended storage classes are MCU specific
+ while there may be a xdata storage class for 8051 there is no such storage
+ class for z80 or Atmel AVR.
+ SDCC allows MCU specific storage class extensions, i.e.
+ xdata will be treated as a storage class specifier when parsing 8051 C
+ code but will be treated as a C identifier when parsing z80 or ATMEL AVR
+ C code.
+\end_layout
+
+\begin_layout Paragraph*
+Generating iCode
+\begin_inset LatexCommand index
+name "iCode"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Intermediate code generation.
+ In this phase the AST is broken down into three-operand form (iCode).
+ These three operand forms are represented as doubly linked lists.
+ ICode is the term given to the intermediate form generated by the compiler.
+ ICode example section shows some examples of iCode generated for some simple
+ C source functions.
+\end_layout
+
+\begin_layout Paragraph*
+Optimizations
+\begin_inset LatexCommand index
+name "Optimizations"
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+Bulk of the target independent optimizations is performed in this phase.
+ The optimizations include constant propagation, common sub-expression eliminati
+on, loop invariant code movement, strength reduction of loop induction variables
+ and dead-code elimination.
+\end_layout
+
+\begin_layout Paragraph*
+Live range analysis
+\begin_inset LatexCommand index
+name "Live range analysis"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+During intermediate code generation phase, the compiler assumes the target
+ machine has infinite number of registers and generates a lot of temporary
+ variables.
+ The live range computation determines the lifetime of each of these compiler-ge
+nerated temporaries.
+ A picture speaks a thousand words.
+ ICode example sections show the live range annotations for each of the
+ operand.
+ It is important to note here, each iCode is assigned a number in the order
+ of its execution in the function.
+ The live ranges are computed in terms of these numbers.
+ The from number is the number of the iCode which first defines the operand
+ and the to number signifies the iCode which uses this operand last.
+\end_layout
+
+\begin_layout Paragraph*
+Register Allocation
+\begin_inset LatexCommand index
+name "Register allocation"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The register allocation determines the type and number of registers needed
+ by each operand.
+ In most MCUs only a few registers can be used for indirect addressing.
+ In case of 8051 for example the registers R0 & R1 can be used to indirectly
+ address the internal ram and DPTR to indirectly address the external ram.
+ The compiler will try to allocate the appropriate register to pointer variables
+ if it can.
+ ICode example section shows the operands annotated with the registers assigned
+ to them.
+ The compiler will try to keep operands in registers as much as possible;
+ there are several schemes the compiler uses to do achieve this.
+ When the compiler runs out of registers the compiler will check to see
+ if there are any live operands which is not used or defined in the current
+ basic block being processed, if there are any found then it will push that
+ operand and use the registers in this block, the operand will then be popped
+ at the end of the basic block.
+
+\end_layout
+
+\begin_layout Standard
+There are other MCU specific considerations in this phase.
+ Some MCUs have an accumulator; very short-lived operands could be assigned
+ to the accumulator instead of a general-purpose register.
+\end_layout
+
+\begin_layout Paragraph*
+Code generation
+\end_layout
+
+\begin_layout Standard
+Figure II gives a table of iCode
+\begin_inset LatexCommand index
+name "iCode"
+
+\end_inset
+
+ operations supported by the compiler.
+ The code generation involves translating these operations into corresponding
+ assembly code for the processor.
+ This sounds overly simple but that is the essence of code generation.
+ Some of the iCode operations are generated on a MCU specific manner for
+ example, the z80 port does not use registers to pass parameters so the
+ SEND and RECV iCode operations will not be generated, and it also does
+ not support JUMPTABLES.
+
+\newline
+
+\end_layout
+
+\begin_layout Standard
+
+\size footnotesize
+Figure II
+\begin_inset Tabular
+<lyxtabular version="3" rows="39" columns="4">
+<features islongtable="true" headBottomDL="true">
+<column alignment="block" valignment="top" leftline="true" width="13col%">
+<column alignment="left" valignment="top" leftline="true" width="13col%">
+<column alignment="block" valignment="top" leftline="true" width="22col%">
+<column alignment="block" valignment="top" leftline="true" rightline="true" width="40col%">
+<row topline="true" bottomline="true" endhead="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+iCode
+\series default
+
+\begin_inset LatexCommand index
+name "iCode"
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Operands
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+Description
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\series bold
+C Equivalent
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'!'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+NOT operation
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = ! IC_LEFT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'~'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Bitwise complement of
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = ~IC_LEFT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+RRC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Rotate right with carry
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = (IC_LEFT << 1) | (IC_LEFT >> (sizeof(IC_LEFT)*8-1));
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+RLC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Rotate left with carry
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = (IC_LEFT << (sizeof(LC_LEFT)*8-1) ) | (IC_LEFT >> 1);
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+GETHBIT
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Get the highest order bit of IC_LEFT
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = (IC_LEFT >> (sizeof(IC_LEFT)*8 -1));
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+UNARYMINUS
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Unary minus
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = - IC_LEFT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IPUSH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Push the operand into stack
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+NONE
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IPOP
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Pop the operand from the stack
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+NONE
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+CALL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Call the function represented by IC_LEFT
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = IC_LEFT();
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+PCALL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Call via function pointer
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = (*IC_LEFT)();
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+RETURN
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Return the value in operand IC_LEFT
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+return IC_LEFT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+LABEL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LABEL()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Label
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LABEL:
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+GOTO
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LABEL()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Goto label
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+goto IC_LABEL();
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'+'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Addition
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = IC_LEFT + IC_RIGHT
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'-'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Subtraction
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = IC_LEFT - IC_RIGHT
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'*'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Multiplication
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = IC_LEFT * IC_RIGHT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'/'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Division
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = IC_LEFT / IC_RIGHT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+'%'
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_LEFT() IC_RIGHT() IC_RESULT()
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+Modulus
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\size footnotesize
+IC_RESULT = IC_LEFT % IC_RIGHT;
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text