Pascal compiler (was: Layout floating point numbers)

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-10-07 07:25:11

On Sun, Oct 06, 2002 at 10:31:07PM +0200, Anders Carlsson wrote:
> > is it just me or does that sound like grabbing cc65, deleting
> > everything related to C, and adding the missing bits for pascal
>
> How is cc65 designed; with a front and back end similar to how GCC
> is written?

cc65 has the same logical structure, but backend and frontend are not
separated into different programs (and cc65 is of course a lot simpler than
gcc). In addition to that, some parts of cc65 were not designed but have
evolved - which means that the code and interface separation is not always as
good as it should be. So while reusing parts of the compiler proper would be
worthwile (the 6502 code optimizer is quite ok for exmaple), I don't think it
would be feasible without a lot of restructuring.

Things that could be reused without much problems are

  * the assembler, linker and the remainder of the tool chain. They support
    modules, libraries, a simple form of debug info, and the linker can even
    generate relocatable o65 executables, which can be used for example as
    overlays.

  * much of the runtime library. Since the 6502 has no 16 and 32 bit registers
    and no stack that can be used for parameters, all of this must be emulated
    in software, which means that a lot of small assembler procedures are
    needed. cc65 for example comes with more than 180 of them. Since cc65 uses
    a stack based approach (similar to what the simple pascal compilers use),
    I think that most of these routines could be used unchanged.

  * some parts of the C library. cc65 uses pascal calling conventions (since
    this generates smaller code), so calling functions written in/for C is not
    a problem. Reusable functions that come to mind are those for the heap for
    example. cc65 has a complete malloc/free/realloc/...

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.4.