This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MS/CW-style inline assembly for GCC


On Thu, May 06, 2004 at 07:02:28PM -0700, Stan Shebs wrote:
> >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").

Speaking as a user, I think I can see both sides of the argument.

I'm doing x86 virtual machines at work. The technology includes some
amount of dynamic recompilation. The programmers working on this are
generally quite good, and very familiar with the semantics of every
x86 instruction. Yet, for some reason, most of them seem to be unable
to figure out gcc assembly contraints - they either use some random
string that happened to work for them, or nowadays they tend to just
come by and ask me. Keep in mind, these are usualy kernel level
programmers with a lot of experience behind them.

Personally I dont see what's so complicated about the gcc asm
constraint syntax, but maybe it's just me. I suppose if it was better
documented, my colleagues would not have to ask me about it anymore.

Having the compiler parse down the user's asm and figure out the
constraints would be unlikely to work for us. Every now and then a new
processor comes along with a new instruction set extension that we
really want to use in our product - but, we do not necessarily need to
switch to a new compiler that knows about this instruction, as we have
a lot of validation costs associated with switching compilers. In this
context, the current generic gcc asm extension, which does not need to
know anything about x86 instructions and just expects the user to know
what the constraints are, works beautifully since it allows us to use
instruction set extensions that did not exist at the time our compiler
version was realeased.

-- 
Michel "Walken" Lespinasse
"In this time of war against Osama bin Laden and the oppressive
Taliban regime, we are thankful that OUR leader isn't the spoiled son
of a powerful politician from a wealthy oil family who is supported by
religious fundamentalists, operates through clandestine organizations,
has no respect for the democratic electoral process, bombs innocents,
and uses war to deny people their civil liberties." --The Boondocks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]