Re: Compiler for accumulator-based processor (Mike McCarty)
5 Dec 1997 01:02:57 -0500

          From comp.compilers

Related articles
Compiler for accumulator-based processor (Jean-Christophe Le Lann) (1997-11-20)
Re: Compiler for accumulator-based processor (Sergey Solyanik) (1997-11-23)
Re: Compiler for accumulator-based processor (Preston Gurd) (1997-11-23)
Re: Compiler for accumulator-based processor (Stephen S. Mitchell) (1997-11-29)
Re: Compiler for accumulator-based processor (1997-11-29)
Re: Compiler for accumulator-based processor (1997-12-05)
| List of all articles for this month |

From: (Mike McCarty)
Newsgroups: comp.compilers
Date: 5 Dec 1997 01:02:57 -0500
Organization: DSC Communications Corporation
References: 97-11-110 97-11-129 97-11-165
Keywords: code, architecture

Au contraire, it should be -very- easy to modify Small C to work with a
single accumulator. The secondary register just has to be put into a
memory location. It is necessary to be able to push and pop the
secondary register, but this can be implemented by having a second
memory cell set aside to save the accumulator while this is done.

mov SaveAcc,Acc
mov Acc,Secondary
push Acc
mov Acc,SaveAcc

type code could be generated. (Inefficient, but a post-processing
peephole optimizer could remove redundant loads of the accumulator, and
a smarter code generator could keep track of whether the accumulator
was actually in the register or in memory, and generate loads as

Now if you assume that you don't even have a separate address register,
then you're going to have problems generating code, because you have to
have an impasse on having to store both the data to be pushed, and the
new address to put it in.

The fact that the code used the "real" accumulator is really just a
fluke of making integers 16 bits on an 8 bit machine, and has nothing to
do with the compiler itself. But I believe that you didn't mean to imply
that. I'm just making sure that the point definitely gets made.

)Jean-Christophe Le Lann wrote:
)> >
)> > I don't know much about compilers but I'd like to build (or get) one
)> > to produce code for a very simple 8-bit microprocessor named Hercules
)> > (originally designed by Pr. N.Wirth for educationnal purpose).
)> >
)> > It is based on a single register ("accumulator").
)Sergey Solyanik wrote:
)> Try the Small C Compiler. <snip>

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.