<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://sdcc.sourceforge.net/mediawiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://sdcc.sourceforge.net/mediawiki/index.php?title=Flow&amp;feed=atom&amp;action=history</id>
		<title>Flow - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://sdcc.sourceforge.net/mediawiki/index.php?title=Flow&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://sdcc.sourceforge.net/mediawiki/index.php?title=Flow&amp;action=history"/>
		<updated>2013-06-19T21:57:42Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://sdcc.sourceforge.net/mediawiki/index.php?title=Flow&amp;diff=29&amp;oldid=prev</id>
		<title>Borutr: Created page with &quot;== Flow of compilation in SDCC ==  # SDCPP traditional C preprocessing (macro expansion, ...?) # compiling (after reaching the end of the source file, the initializers for...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sdcc.sourceforge.net/mediawiki/index.php?title=Flow&amp;diff=29&amp;oldid=prev"/>
				<updated>2012-12-04T10:41:04Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Flow of compilation in SDCC ==  # &lt;a href=&quot;/mediawiki/index.php/SDCPP_traditional_C_preprocessing&quot; title=&quot;SDCPP traditional C preprocessing&quot;&gt;SDCPP traditional C preprocessing&lt;/a&gt; (macro expansion, ...?) # compiling (after reaching the end of the source file, the initializers for...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Flow of compilation in SDCC ==&lt;br /&gt;
&lt;br /&gt;
# [[SDCPP traditional C preprocessing]] (macro expansion, ...?)&lt;br /&gt;
# compiling (after reaching the end of the source file, the initializers for any non-const global or static variables also go through these same steps)&lt;br /&gt;
## [[parsing]]: preprocessed code -&amp;gt; AST&lt;br /&gt;
## AST -&amp;gt; icode conversion&lt;br /&gt;
## target independent icode optimisation&lt;br /&gt;
## target dependent icode optimisation and register allocation&lt;br /&gt;
## assembly code generation: icode -&amp;gt; target-specific asm&lt;br /&gt;
## peephole optimisation&lt;br /&gt;
# assembling&lt;br /&gt;
# linking&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== some details on the &amp;quot;top level&amp;quot; ==&lt;br /&gt;
main = SDCC.EXE&lt;br /&gt;
&lt;br /&gt;
=== source ===&lt;br /&gt;
* sdcc/sdcc/src/SDCCmain.c&lt;br /&gt;
&lt;br /&gt;
=== what does it do ===&lt;br /&gt;
See the tree on top for links to pages with info on each step:&lt;br /&gt;
&lt;br /&gt;
* based on command line establishes which port is to be used&lt;br /&gt;
* initialises this port&lt;br /&gt;
* parses command line options&lt;br /&gt;
* passes the relevant options to the port&lt;br /&gt;
* calls the preprocessor SDCPP.EXE&lt;br /&gt;
* feeds the output into the parser &amp;quot;character by character&amp;quot;&lt;br /&gt;
** via a pipe - preprocessing is completely separate from other parts, there are no common data - it could be run standalone, output into a temporary file and feed that into the lexer part of compiler)&lt;br /&gt;
* parser calls the subsequent steps - function by function&lt;br /&gt;
** once the parser recognizes that a function is complete, createFunction() (in src/SDCCast.c) is called, which has the AST annotated (probably via decorateType()), has it turned it into iCode (iCodeFromAst() calling ast2iCode()), and lets the backend emit appropriate code (via eBBlockFromiCode() in port-&amp;gt;assignRegisters, which maps to, e.g.src/mcs51/ralloc.c, mcs51_assignRegisters())&lt;br /&gt;
** eBBlockFromiCode(): cseAllBlocks(), killDeadCode(), loopOptimizations(), all src/SDCCopt.c&lt;br /&gt;
* calls the assembler&lt;br /&gt;
* calls the linker&lt;br /&gt;
&lt;br /&gt;
Run SDCC with both &amp;quot;-V --verbose&amp;quot; to see some of these steps.&lt;/div&gt;</summary>
		<author><name>Borutr</name></author>	</entry>

	</feed>