164 lines
6 KiB
HTML
164 lines
6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
|
|
<!--Converted with LaTeX2HTML 99.1 release (March 30, 1999)
|
|
original version by: Nikos Drakos, CBLU, University of Leeds
|
|
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
|
|
* with significant contributions from:
|
|
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>6. Retargetting for other MCUs.</TITLE>
|
|
<META NAME="description" CONTENT="6. Retargetting for other MCUs.">
|
|
<META NAME="keywords" CONTENT="sdccman">
|
|
<META NAME="resource-type" CONTENT="document">
|
|
<META NAME="distribution" CONTENT="global">
|
|
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="Generator" CONTENT="LaTeX2HTML v99.1 release">
|
|
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
|
|
|
|
<LINK REL="STYLESHEET" HREF="sdccman.css">
|
|
|
|
<LINK REL="next" HREF="node49.html">
|
|
<LINK REL="previous" HREF="node46.html">
|
|
<LINK REL="up" HREF="sdccman.html">
|
|
<LINK REL="next" HREF="node49.html">
|
|
</HEAD>
|
|
|
|
<BODY >
|
|
<!--Navigation Panel-->
|
|
<A NAME="tex2html978"
|
|
HREF="node49.html">
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A>
|
|
<A NAME="tex2html972"
|
|
HREF="sdccman.html">
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A>
|
|
<A NAME="tex2html966"
|
|
HREF="node47.html">
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A>
|
|
<A NAME="tex2html974"
|
|
HREF="node1.html">
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A>
|
|
<A NAME="tex2html976"
|
|
HREF="node61.html">
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A>
|
|
<BR>
|
|
<B> Next:</B> <A NAME="tex2html979"
|
|
HREF="node49.html">7. SDCDB - Source</A>
|
|
<B> Up:</B> <A NAME="tex2html973"
|
|
HREF="sdccman.html">SDCC Compiler User Guide</A>
|
|
<B> Previous:</B> <A NAME="tex2html967"
|
|
HREF="node47.html">5.1 Notes on MCS51</A>
|
|
  <B> <A NAME="tex2html975"
|
|
HREF="node1.html">Contents</A></B>
|
|
  <B> <A NAME="tex2html977"
|
|
HREF="node61.html">Index</A></B>
|
|
<BR>
|
|
<BR>
|
|
<!--End of Navigation Panel-->
|
|
|
|
<H1><A NAME="SECTION00070000000000000000">
|
|
6. Retargetting for other MCUs.</A>
|
|
</H1>
|
|
|
|
<P>
|
|
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.
|
|
|
|
<P>
|
|
|
|
<UL>
|
|
<LI>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.</LI>
|
|
<LI>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 -dumpraw option.</LI>
|
|
<LI>This phase does the bulk of the standard optimizations and is also
|
|
MCU independent. This phase can be broken down into several sub-phases:
|
|
<BR>
|
|
|
|
<BR>
|
|
Break down intermediate code (iCode) into basic blocks.
|
|
<BR>
|
|
Do control flow & data flow analysis on the basic blocks.
|
|
<BR>
|
|
Do local common subexpression elimination, then global subexpression
|
|
elimination
|
|
<BR>
|
|
Dead code elimination
|
|
<BR>
|
|
Loop optimizations
|
|
<BR>
|
|
If loop optimizations caused any changes then do 'global subexpression
|
|
elimination' and 'dead code elimination' again.</LI>
|
|
<LI>This phase determines the live-ranges; by live range I mean those
|
|
iTemp variables defined by the compiler that still survive after all
|
|
the optimizations. Live range analysis is essential for register allocation,
|
|
since these computation determines which of these iTemps will be assigned
|
|
to registers, and for how long.</LI>
|
|
<LI>Phase five is register allocation. There are two parts to this process.
|
|
<BR>
|
|
|
|
<BR>
|
|
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.
|
|
<BR>
|
|
|
|
<BR>
|
|
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.</LI>
|
|
<LI>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.</LI>
|
|
<LI>As mentioned in the optimization section the peep-hole optimizer is
|
|
rule based system, which can reprogrammed for other MCUs.</LI>
|
|
</UL>
|
|
|
|
<P>
|
|
<HR>
|
|
<!--Navigation Panel-->
|
|
<A NAME="tex2html978"
|
|
HREF="node49.html">
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A>
|
|
<A NAME="tex2html972"
|
|
HREF="sdccman.html">
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A>
|
|
<A NAME="tex2html966"
|
|
HREF="node47.html">
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A>
|
|
<A NAME="tex2html974"
|
|
HREF="node1.html">
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A>
|
|
<A NAME="tex2html976"
|
|
HREF="node61.html">
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A>
|
|
<BR>
|
|
<B> Next:</B> <A NAME="tex2html979"
|
|
HREF="node49.html">7. SDCDB - Source</A>
|
|
<B> Up:</B> <A NAME="tex2html973"
|
|
HREF="sdccman.html">SDCC Compiler User Guide</A>
|
|
<B> Previous:</B> <A NAME="tex2html967"
|
|
HREF="node47.html">5.1 Notes on MCS51</A>
|
|
  <B> <A NAME="tex2html975"
|
|
HREF="node1.html">Contents</A></B>
|
|
  <B> <A NAME="tex2html977"
|
|
HREF="node61.html">Index</A></B>
|
|
<!--End of Navigation Panel-->
|
|
<ADDRESS>
|
|
<I>Johan Knol</I>
|
|
<BR><I>2001-07-13</I>
|
|
</ADDRESS>
|
|
</BODY>
|
|
</HTML>
|