Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-08

FPC compiler architecture documentation

9 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I found this old PDF documenting the FPC compiler architecture. I remember in recent years others attempted to do a similar thing. I don't know how accurate this PDF still is, considering it is based on FPC v1.x, but maybe others could bring it up to date again (if they are so inclined). It seems extensive, coming it at 118 pages.

ftp://193.224.143.39/pub/fpc/docs-pdf/comparch.pdf

Anyway, I just thought I would share the link.

Regards,
- Graeme -

Reply by email

Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

I found this old PDF documenting the FPC compiler architecture. I remember in recent years others attempted to do a similar thing. I don't know how accurate this PDF still is, considering it is based on FPC v1.x,

Not really I think.

I converted it from the original word document to latex/pdf. The source is in fpcdocs/internal directory
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/internal/?root=docs

Still waiting for sb to actualize it.

Reply by email

Florian Klaempfl
to Marco van de Voort
Marco van de Voort wrote 13 lines
In our previous episode, Graeme Geldenhuys said: > I found this old PDF documenting the FPC compiler architecture. I > remember in recent years others attempted to do a similar thing. I don't > know how accurate this PDF still is, considering it is based on FPC > v1.x, Not really I think. I converted it from the original word document to latex/pdf. The source is in fpcdocs/internal directory http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/internal/?root=docs Still waiting for sb to actualize it.

While it still might an interesting reading for somebody not involved in the compiler development I doubt it's usefulness. It requires a lot of work of some of the compiler developers but I doubt that a good developer needs such a document to get into the compiler so updating the document is wasted time in the sense of bringing the compiler forward.

Reply by email

Mark Morgan Lloyd
to Florian Klaempfl
Florian Klaempfl wrote 20 lines
Am 30.08.2012 13:42, schrieb Marco van de Voort: > In our previous episode, Graeme Geldenhuys said: >> I found this old PDF documenting the FPC compiler architecture. I >> remember in recent years others attempted to do a similar thing. I don't >> know how accurate this PDF still is, considering it is based on FPC >> v1.x, > > Not really I think. > > I converted it from the original word document to latex/pdf. The source > is in fpcdocs/internal directory > http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/internal/?root=docs > > Still waiting for sb to actualize it. While it still might an interesting reading for somebody not involved in the compiler development I doubt it's usefulness. It requires a lot of work of some of the compiler developers but I doubt that a good developer needs such a document to get into the compiler so updating the document is wasted time in the sense of bringing the compiler forward.

Define "good developer". I've exchanged pleasantries with- for example- experienced IBM mainframe developers who don't understand the extent to which FPC is self-hosted, i.e. you start a port with a cross-compiler on a PC rather than by using a different compiler (e.g. P5) on the target system.

Right now there's adequate documentation for how to build the compiler, but no introductory text for the interested outsider.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Michael Schnell
to Florian Klaempfl: While it still might an interesting reading for somebody not involved in the compiler…
Florian Klaempfl wrote
I doubt that a good developer needs such a document to get into the compiler...

Hmmm.

I once thought about trying to do an fpc compiler for a not yet supported arch, and I still am interested in having (AKA contributing to such an effort) an "up to date" fpc compiler for as well 68K as PIC32 (AFAIK identical to a certain version of MIPS32). I doubt that I would even be able to start, unless an up-to-date documentation of the appropriate parts of the docu is available.

-Michael

Reply by email

Mark Morgan Lloyd
to Michael Schnell
Michael Schnell wrote 12 lines
On 08/30/2012 10:20 PM, Florian Klaempfl wrote: > I doubt that a good developer needs such a document to get into the > compiler... Hmmm. I once thought about trying to do an fpc compiler for a not yet supported arch, and I still am interested in having (AKA contributing to such an effort) an "up to date" fpc compiler for as well 68K as PIC32 (AFAIK identical to a certain version of MIPS32). I doubt that I would even be able to start, unless an up-to-date documentation of the appropriate parts of the docu is available.

I tried to make notes when looking at the "unofficial" MIPS compiler on Sourceforge, but things suddenly started moving faster than I could keep track of (I'll probably chop what I did out of the wiki once the compiler is stable). I still felt I learned a lot, but there has to be a better way. http://wiki.lazarus.freepascal.org/Native_MIPS_Systems

Paul Edwards started to make a list of units and their relationships (in the context of a mainframe compiler), but I don't see any recent updates. http://wiki.lazarus.freepascal.org/ZSeries/Part_1

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Florian Klaempfl
to Michael Schnell: Hmmm. I once thought about trying to do an fpc compiler for a not yet supported arch, and…
Michael Schnell wrote 12 lines
On 08/30/2012 10:20 PM, Florian Klaempfl wrote: > I doubt that a good developer needs such a document to get into the > compiler... Hmmm. I once thought about trying to do an fpc compiler for a not yet supported arch, and I still am interested in having (AKA contributing to such an effort) an "up to date" fpc compiler for as well 68K as PIC32 (AFAIK identical to a certain version of MIPS32). I doubt that I would even be able to start, unless an up-to-date documentation of the appropriate parts of the docu is available.

The big picture which could be documented is the easy part. But such a document can never cover all details and the details are the hairy part. Like certain properties of the target architecture might be special and not yet covered by the compiler thus they cannot be documented. They are the challenging and time consuming part when adding a new architecture.

Reply by email

Mark Morgan Lloyd
to Florian Klaempfl
Florian Klaempfl wrote 19 lines
Am 31.08.2012 09:32, schrieb Michael Schnell: > On 08/30/2012 10:20 PM, Florian Klaempfl wrote: >> I doubt that a good developer needs such a document to get into the >> compiler... > > Hmmm. > > I once thought about trying to do an fpc compiler for a not yet > supported arch, and I still am interested in having (AKA contributing to > such an effort) an "up to date" fpc compiler for as well 68K as PIC32 > (AFAIK identical to a certain version of MIPS32). I doubt that I would > even be able to start, unless an up-to-date documentation of the > appropriate parts of the docu is available. The big picture which could be documented is the easy part. But such a document can never cover all details and the details are the hairy part. Like certain properties of the target architecture might be special and not yet covered by the compiler thus they cannot be documented. They are the challenging and time consuming part when adding a new architecture.

I for one am very much aware of that, since for reasons not directly related to FPC I'm spending a lot of time inside CPU manuals (I've now got to something like p290 of the IBM S/390 manual, and it's finally starting to talk about opcodes- although it's not yet discussed the register model).

However, what's needed /is/ the big picture, starting off with what's needed for a port (a PC, preferably running Linux, and a working FPC), where the modified source should be put (local svn, Lazarus CCR, or a branch of the main repository, and who to talk to and/or how best to do it in each case), and what naming conventions etc. should be applied (roughly, how to set up ./compiler/xxxxx and what to change in ./compiler to make the build process aware of it).

We can really do without another David Zhang episode where somebody well-meaning flattens the directory structure and duplicates files needlessly.

With respect to everybody concerned, I'd strongly suggest that http://wiki.lazarus.freepascal.org/ZSeries/Part_1 et seq. are worth reviewing since they contain a number of misconceptions that have been echoed by others (e.g. that the best way to start is to have a working Pascal compiler on the target system).

It's entirely in order for a document to state that some elements of what it describes are unknown, or unknowable without feedback from the reader. But there are still targets worth supporting and people with the motivation and target-specific skills to do so, and keeping the project "closed by complexity" is to nobody's advantage.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Hans-Peter Diettrich
to Mark Morgan Lloyd
Show quoted text 7 lines
However, what's needed /is/ the big picture, starting off with what's needed for a port (a PC, preferably running Linux, and a working FPC), where the modified source should be put (local svn, Lazarus CCR, or a branch of the main repository, and who to talk to and/or how best to do it in each case), and what naming conventions etc. should be applied (roughly, how to set up ./compiler/xxxxx and what to change in ./compiler to make the build process aware of it).

Let me summarize the recent answers on this topic:

1. FPC is a production compiler[1].

2. Implementors shall ask the developers concrete questions, once they start running into problems.

[1] "production" means that the compiler is a moving target, with optimization in the first place - documentation will be outdated once it has been written. The same applies to the code for new targets, as long as it is not yet maintained by the core developers.

The basic FPC code violates all acknowledged programming rules, by e.g. using global variables for caching all over, so that it's impossible to track assignments to the underlying record fields.

Show quoted text 5 lines
With respect to everybody concerned, I'd strongly suggest that http://wiki.lazarus.freepascal.org/ZSeries/Part_1 et seq. are worth reviewing since they contain a number of misconceptions that have been echoed by others (e.g. that the best way to start is to have a working Pascal compiler on the target system).

A cross compiler doesn't deserve an bootstrap compiler on every target system. Delphi goes the same route BTW.

DoDi

Reply by email