Bernd Oppolzer wrote:
Am 01.09.2013 18:01, schrieb Florian Klämpfl:
Am 01.09.2013 16:55, schrieb Bernd Oppolzer:
No need to answer to that ... I understood in the meantime that FPC does
NOT rely on
PUSH and POP instructions. Instead the linear assembler representation
is already fully
CPU specific.
(which makes porting a bigger effort)
Proof?
It's my opinion. If the compiler translates the source language
to machine code for an abstract target machine that is not too complicated
(but well suited to the needs of the source language), you only have to
translate
the operations of this abstract machine one by one to your real target
machine,
which seems to me to be an easier task.
The problem here is that compiler design has moved on a lot since
Wirth's day. It's not difficult to write a compiler using e.g. recursive
descent or Meta-II which emits instructions for an abstract stack-based
machine, and that might be a good match for a CPU with a small number of
general-purpose registers. However it can be extremely difficult to
optimise this for a modern CPU with a large register file, it's far more
effective to give the frontend a rough idea of how many registers the
backend has available to it and to warn it about known peculiarities.
Optimization can occur already in the stages, which are target-independent,
but later, too.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel