This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 8-bit processors back-end optimizations


	  - Are there a lot of ports of GCC to 8-bit back-ends and where can I find them?

No.  They are rare.  There are a handful of ports to 16 bit or mixed 8/16 bit
machines (e.g. h8300, mn10200, pdp11) in the gcc sources.  I can only recall
one port to a pure 8 bit machine, the 6811, unfortunately, that port will
never make it into gcc because we can't get copyright assignments from the
authors.  You might be able to find it on the net somewhere though.

The main problem with 8 bit targets is the lack of registers.  If you don't
have 8 registers or so, then you won't be able to get gcc working without
resorting to tricks.  The 6811 port for instance pretended that it had
registers in zero page memory.  This gave inefficient code in some cases, but
it apparently did work.

	There is at least one area for which I'll try to come up with a specific optimization,
	provided it's not been done already: namely size extension.  As you probably know,
	ANSI C specifies that the char (usually 8-bit) type be extended to int before being
	used to do computations. 

There is code in the C front end to handle this.  If the operator would give
the same result in the smaller mode, then the C front end will try to generate
RTL that uses the smaller mode.  See the `shorten' code in build_binary_op
in c-typeck.c.  There are however quite a few cases that can't be shortened
because this may generate different results for some inputs.

The combine pass may also optimize away some of this stuff, if it can figure
out that the extra bits in the result are not needed.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]