[fpc-devel] Re: fpc-devel Digest, Vol 112, Issue 32

Sven Barth pascaldragon at googlemail.com
Mon Aug 26 09:58:37 CEST 2013

Am 26.08.2013 00:57 schrieb "Steve Smith" <fski12 at yahoo.com>:
>>>> There's also the issue of the assembler reader (used, if I understand
>>>> things correctly, to parse inline assembler mostly in the lower-level
> >>> bits of the RTL). This seems to cause almost as much problem during
> >>> development as the assembler writer, and having to support (or at
> >>> least pass through) complex assembler macros isn't going to make
> >>> things any easier.
>>> I don't really see why passing macro calls through to an external
>>> assembler is any different than passing 'raw' code.  It's just text
>>> isn't it?
>> Writing assembler by hand is not necessarily the same as letting a
>> write assembler code. At least in FPC the assembly language of each
>> processor is abstracted in operations which are hold in lists and using
>> assembler writer (of which there can be multiple to target different
>> assemblers) this list is turned into the final file.
> I'm aware of that, but I don't see how that makes a difference to how the
compiler generated assembler is treated differently to the stuff inside a
TP ASM block, inline assembler, or am I misunderstanding Mark's point.

Assembler blocks in FPC are handled by a assembler reader which needs to be
implemented for each assembler language variant that needs to be supported
(e.g. on x86 systems we support Intel and AT&T syntaxes whereby each has
its own reader implementation). These readers convert a parsed assembler
operation to an abstract assembler operation which is independent of the
assembler syntax, but CPU dependant. At the end an assembler writer
converts the linear lists of assembler operations to a assembly language
file for the chosen assembler which may contain additional information not
present in the assembler block and which also does not need to be the same
assembler syntax that was parsed originally.

So for a new CPU platform you need to implement at least an assembler
writer, an assembler reader (which could be at first so primitive that it
can only handle the necessary RTL assembler blocks) and a linkscript writer
which is passed to the external linker to link together all generated
object files.

>>> "Here's some code, assemble it, and be quick about it johnny!"
>> Was that a Short Circuit reference? O.o
> Once again in English please. I just don't understand that last sentence
at all. Sorry.

As waldo already wrote "Johnny" is the name the robot of the movie "Short
Circuit" gave itself at the end of the first movie and is used extensively
in the second one. Also he his told by his friend to assemble toy robots
that resemble Johnny which is why I thought it was a reference.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130826/65952c19/attachment.html>

More information about the fpc-devel mailing list