MS/CW-style inline assembly for GCC

Paul Koning pkoning@equallogic.com
Tue May 4 14:27:00 GMT 2004


>>>>> "Stan" == Stan Shebs <shebs@apple.com> writes:

 Stan> One of the long-notorious features of GCC has been its inline
 Stan> assembly extension for C-dialect languages. ...

 Stan> However, the syntax has also been somewhat inaccessible. Those
 Stan> constraint letters were often undocumented, and are still
 Stan> somewhat mysterious to users, while the use of strings for
 Stan> instructions makes the construction of longer assembly
 Stan> sequences a rather difficult undertaking. In addition, the
 Stan> "capture" of GCC's constraint letters and pattern syntax into
 Stan> source code has the potential to reduce our flexibility to
 Stan> change compiler internals later.

I don't understand these objections.

Yes, the constraints are very poorly documented.  To the extent they
are documented at all, the description is aimed at authors of xxx.md
files.  But that's fixable.

I don't see why the use of strings makes constructing long assembly
statements hard.  String concatenations works just fine.

As for tying things to internals: if the internals ever need to change
away from constraint letters, you end up needing a mapping from
constraint letters in asm statements to whatever replaces them.  Right
now that's an identity mapping, but it does not need to be.

    paul



More information about the Gcc mailing list