MS/CW-style inline assembly for GCC
Ian Lance Taylor
ian@wasabisystems.com
Fri May 7 02:34:00 GMT 2004
Stan Shebs <shebs@apple.com> writes:
> >Isn't this going to be rather problematic on a less regular
> >architecture, like the 68k, or the x86? On the x86, it seems like the
> >compiler will have to understand all the weird and wonderful
> >instructions like "rep movs". That's a lot of parsing.
> >
> >
> Well yeah, but isn't that the kind of knowledge you want in the
> software tool, and not as a little quiz for the programmer ("write
> down all the clobbers, and if you make a mistake, I'll punish
> you with flaky runtime behavior when you do -Os during a new
> moon").
That's a fair point, and a good argument for the target specific
__builtin_xxx functions which are slipping into gcc.
But my point is that if we introduce this feature into the target
independent part of gcc, we are more or less putting ourselves on the
hook to write an assembler parser for each supported target. That's a
big job, and it needs to be a part of any decision to approve this
approach.
> The GCC syntax was a cheap quickie hack thrown in nearly twenty
> years ago and hardly improved since then, even though empirically
> it's one of the leading causes of bugs and problems with using GCC.
> It may suit you just fine, but most users only put up with it
> because they have no alternative.
I think that saying that it is one of the leading causes of bugs and
problems is a bit of a stretch. How many entries in bugzilla are due
to inline assembler?
Still, you have a good point. There are some obvious problems with
the gcc assembler syntax. But rather than assuming that CW syntax is
the answer, let me ask, if we start from a blank slate, how can we
improve it? What features do we want from inline assembler?
Ian
More information about the Gcc
mailing list