Thank you very much.
I have read all the code of PIC14, finally understand all the thing..

addpCode2pBlock() is the real man emitting the assembler.

:-)



2012/11/20 Erik Petrich <epetrich@ivorytower.norman.ok.us>


On Fri, 9 Nov 2012, feqin fan wrote:

I'm sorry to trouble you.
I'm reading the source code but only the part of PIC14 related.

In the file ./sdcc-src-3.2.0/sdcc/src/pic14/gen.c have two functions dealing
with instruction output -- va_emitcode() and addpCode2pBlock().
    the first one va_emitcode() add formatted instruction into the global
variable--genLine, and the second one add the pCode style instruction into
the static pb(static pBlock *pb).
Where is the source about real travel the two variable and output the
assembler code?
What's the different about the two variable--genLine and pb in the source
code? what are they doing? why need tow variables but seems doing  the same
thing?

My understanding of the pic14 code generator is very limited, but I haven't seen anyone answer your question so I will attempt to.

.../src/pic14/gen.c is based on .../src/mcs51/gen.c, which uses emitcode() for the assembler code. Although .../src/pic14/gen.c still contains some references to emitcode(), this assembler code is not used directly (in most cases it is not pic14 assembler code but instead mcs51) and is instead converted to assembler code comments.

The addpCode2pBlock() is what is actually used for code generation. The pCode is an intermediate representation of the assembler code.

  Erik

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
sdcc-devel mailing list
sdcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-devel




--
live long and prosper..