Related articles |
---|
[5 earlier articles] |
Re: Mathematics skills for writing a compiler? napi@axiomsol.com (2004-09-14) |
Re: Mathematics skills for writing a compiler? vidar@hokstad.name (2004-09-14) |
Re: Mathematics skills for writing a compiler? joe@burgershack.com (Randy) (2004-09-21) |
Re: Mathematics skills for writing a compiler? kamalp@acm.org (2004-09-21) |
Re: Mathematics skills for writing a compiler? tommy.nordgren@chello.se (Tommy Nordgren) (2004-09-24) |
Re: Mathematics skills for writing a compiler? kamalp@acm.org (2004-09-25) |
Re: Mathematics skills for writing a compiler? firefly@diku.dk (Peter \Firefly\Lund) (2004-10-23) |
From: | "Peter \"Firefly\" Lund" <firefly@diku.dk> |
Newsgroups: | comp.compilers |
Date: | 23 Oct 2004 22:34:52 -0400 |
Organization: | Department of Computer Science, University of Copenhagen |
References: | 04-09-063 04-09-087 |
Keywords: | practice |
Posted-Date: | 23 Oct 2004 22:34:52 EDT |
On Mon, 13 Sep 2004, Torben Ęgidius Mogensen wrote:
> useful, but for a non-optimizing compiler you really only need
> colouring (for the register allocator).
You don't even need that.
1) Don't try to do register allocation across expressions.
2) Treat the CPU as a stack machine.
3) Once you want to get fancy you can use one or two registers for the top
of the stack.
It worked fantastically well for Anders Hejlsberg's Pascal compilers.
They used a pure stack model up through the 3.x series and only in
Turbo Pascal 4.0 did they start to use one register for the top of the
stack. Turbo/Borland Pascal 7.0 (and the first Delphi, I think) kept
the top two values or so in registers so expressions often didn't have
to touch the stack at all.
> the compiler and the generated code). A general knowledge of
> datastructures and algorithms (such as sorting, searching, hashtables,
> tree structures, etc.) will also be useful. But very little "hard
> math".
Very little of that seems to have been necessary for Turbo Pascal.
The hash tables for the symbol tables in the compiled object code
files had power of two sizes for easy "division" with an and mask.
The typical Computer Science recommendation is to use a prime size.
And yet, the Turbo Pascal series were some of the fastest compilers
ever for the PC.
-Peter
Return to the
comp.compilers page.
Search the
comp.compilers archives again.