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 <>

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

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.


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!
sdcc-devel mailing list

live long and prosper..