Re: Modern compilers for ye olde architectures

David Brown <david.brown@hesbynett.no>
Tue, 5 Oct 2021 19:59:50 +0200

          From comp.compilers

Related articles
Modern compilers for ye olde architectures laguest@archeia.com (Luke A. Guest) (2021-10-05)
Re: Modern compilers for ye olde architectures david.brown@hesbynett.no (David Brown) (2021-10-05)
Re: Modern compilers for ye olde architectures DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2021-10-05)
Re: Modern compilers for ye olde architectures derek@NOSPAM-knosof.co.uk (Derek Jones) (2021-10-06)
Re: Modern compilers for ye olde architectures laguest@archeia.com (Luke A. Guest) (2021-10-06)
Re: Modern compilers for ye olde architectures anton@mips.complang.tuwien.ac.at (2021-10-06)
Re: Modern compilers for ye olde architectures theom+news@chiark.greenend.org.uk (Theo) (2021-10-06)
Re: Modern compilers for ye olde architectures laguest@archeia.com (Luke A. Guest) (2021-10-06)
[8 later articles]
| List of all articles for this month |

From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.compilers
Date: Tue, 5 Oct 2021 19:59:50 +0200
Organization: A noiseless patient Spider
References: 21-10-007
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="40144"; mail-complaints-to="abuse@iecc.com"
Keywords: architecture, tools
Posted-Date: 05 Oct 2021 14:07:14 EDT
In-Reply-To: 21-10-007
Content-Language: en-GB

On 05/10/2021 14:22, Luke A. Guest wrote:
> I have a Z80 project in mind and would like to build a compiler for a
> Z80.  I was wondering if modern backend techniques can be applied
> successfully for these old CPU's, i.e. SSA.
>
> I know GCC has backends for some older architectures, but these do weird
> gymnastics such as implementing a virtual cpu in rtl and then lowering
> further.
>


Certainly modern techniques /can/ be applied to a Z80 compiler. And the
Z80 is a lot more powerful than many 8-bit CISC microcontrollers.


As far as I know, the only 8-bit target for gcc (in the mainline at
least) is the AVR. This is a RISC processor, with 32 8-bit registers,
and a much more orthogonal architecture. gcc does do some "weird
gymnastics", however - it allocates registers in pairs so that it can
pretend to be 16-bit, and then code gets simplified in peephole passes.


gcc also supports some 16-bit CISC devices.


For the Z80, however, there are a number of compiler options. There are
some commercial toolchains, such as HiSoft (IIRC), and there is the
"Rabbit" microcontroller which is a derivative of the Z80. It is
supported by a compiler for a somewhat extended version of C. Such
compilers are probably quite old, however, and might not be easily
available.


Your best bet is probably SDCC. This is a multi-target open source
compiler that is in regular development, and aimed specifically for
small CISC microcontroller cores. The Z80 is one of its targets.


Post a followup to this message

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