Related articles |
---|
Advice on writing a C compiler fabcab@tcp.co.uk (1995-08-09) |
Re: Advice on writing a C compiler konfrbr@eua.ericsson.se (1995-08-11) |
Newsgroups: | comp.compilers |
From: | fabcab@tcp.co.uk (Nik Shaylor) |
Keywords: | C, question, architecture |
Organization: | Compilers Central |
Date: | Wed, 9 Aug 1995 00:33:42 GMT |
I need to write a C compiler for an embedded microprocessor that has
been developed where I work. I would be most grateful for any advice
about how I should go about this. I have extensive experience in
computing, and have written a few simple compilers, but nothing that
could do the register optimisation that I am looking for here, I do
need good compiler.
I have taken a look at the GNU C++ compiler, which might be a good
place to start, but I don't yet know it well enough to tell if it
would be appropriate for the machine architecture we have. I will
describe it a little here, but I cannot go into too much detail for
reasons of confidentially.
The microprocessor has a 32 bit address and data bus, a 16 bit ALU
and 12 general registers. Four of the registers are 32 bits wide, and
the other 8 are 16 bits, but can be used in pairs to form a single 32
bit register. Addresses are normally formed using a 32 bit register,
but the first 64K can also be addressed using a 16 bit register. This
might give pointer a "near" or "far" feel like the x86.
Normally only 32 bit and 16 bit values can be loaded or stored to
memory. Bytes can be accessed only through two of the 16 bit
registers which have a byte mode when loaded or stored. Loads and
stores can be indexed, or can auto increment/decrement the address
register before or after the operation. All loads and stores can only
be performed at an address that is aligned with their size.
Although the ALU is only 16 bits wide it can perform 32 bit
operations by taking an extra cycle, this happens transparently. For
this reason I feel that the C int should be 16 bits. All the normal
instructions are present plus a few extra ones.
All the instructions are either 16 or 32 bits long and they must
placed at even machine addresses. There are the normal 4 condition
codes and 16 branch types.
Thank you for your kind attention,
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.