[fpc-devel] Re: Porting FPC to IBM zArch

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Tue Aug 20 12:01:53 CEST 2013

Florian Klämpfl wrote:
> Am 19.08.2013 10:37, schrieb Sven Barth:
>> Adding a new platform to FPC is not cheesecake and you should know how
>> the compiler's backend work. Just looking at the output of a target
>> won't help you!

I'd hope that Paul isn't naive enough to make that mistake :-) On the 
other hand, looking at how something like the MIPS compiler was put 
together could probably be useful.

> A good start is aarch64: I tried to work in it as structured as possible
> to make it some draft for porting, so have a look at the history of
> fpc/compiler/aarch64 so you know how to start.

Thanks for that, noted. Going back to some of Paul's points though: one 
thing he's asking is how to get the fundamental hooks added to the 
invariant part of FPC to allow the target-specific stuff to be put in 
its own directory. What's best here: for developers to have their own 
subversion (or equivalent) servers, or for a sandbox to be set up on the 
public FPC SVN server?

Apropos Paul's comments of doing a good cross-reference and handling 
compiler directives, I think the thing that is likely to give real 
problems is the {$if defined() } form... I suppose that it would, at a 
pinch, be possible to reconstitute the used source from assembler output 
(-al -s options) but it's the worst kind of hack.

program testpreproc;

const   a= 1;

var     b: integer;

{$if defined(a) }
   b := 1
{$else }
   b := 2
{$endif }

# [5] var.b: integer;
# [7] begin
# [11] b := 2
# [13] end.
# [15]

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-devel mailing list