1.1 About SDCC

SDCC (Small Device C Compiler) is free open source, retargettable, optimizing standard (ISO C90, ISO C99, ISO C11) C compiler suite by Sandeep Dutta designed for 8 bit Microprocessors. The current version targets Intel MCS51 based Microprocessors (8031, 8032, 8051, 8052, etc.), Dallas DS80C390 variants, Freescale (formerly Motorola) HC08 based (hc08, s08), Zilog Z80 based MCUs (Z80, Z180, gbz80, Rabbit 2000/3000, Rabbit 3000A ) and STMicroelectronics STM8 . It can be retargeted for other microprocessors, support for Microchip PIC and Toshiba TLCS-90 is under development. The entire source code for the compiler is distributed under GPL. SDCC uses a modified version of ASXXXX & ASLINK, free open source retargetable assembler & linker. SDCC has extensive language extensions suitable for utilizing various microcontrollers and underlying hardware effectively.
You might also want to have a look at the wiki http://sdcc.sourceforge.net/wiki/.

In addition to the MCU specific optimizations SDCC also does a host of standard optimizations like:

For the back-end SDCC uses a global register allocation scheme which should be well suited for other 8 bit MCUs.

The peep hole optimizer uses a rule based substitution mechanism which is MCU independent.

Supported data-types are:

type width default signed range
unsigned range
_Bool / bool 8 bits, 1 byte unsigned -
0, 1
char 8 bits, 1 byte unsigned -128, +127
0, +255
short 16 bits, 2 bytes signed -32.768, +32.767
0, +65.535
int 16 bits, 2 bytes signed -32.768, +32.767
0, +65.535
long 32 bits, 4 bytes signed -2.147.483.648, +2.147.483.647
0, +4.294.967.295
long longtypeset@protect @@footnote SF@gobble@opt Incomplete support in the ds390, ds400, pic14 and pic16 backends. 64 bits, 8 bytes signed  
float 4 bytes similar to IEEE 754 signed  
1.175494351E-38, 3.402823466E+38
pointer 1, 2, 3 or 4 bytes generic  
__bittypeset@protect @@footnote SF@gobble@opt Only supported in the mcs51, ds390, ds400 backends. 1 bit unsigned -
0, 1

The compiler also allows inline assembler code to be embedded anywhere in a function. In addition, routines developed in assembly can also be called.

SDCC also provides an option (--cyclomatic) to report the relative complexity of a function. These functions can then be further optimized, or hand coded in assembly if needed.

SDCC also comes with a companion source level debugger SDCDB. The debugger currently uses ucSim, a free open source simulator for 8051 and other micro-controllers.

The latest SDCC version can be downloaded from http://sdcc.sourceforge.net/snap.php. Please note: the compiler will probably always be some steps ahead of this documentationtypeset@protect @@footnote SF@gobble@opt Obviously this has pros and cons.