MS/CW-style inline assembly for GCC
Stan Shebs
shebs@apple.com
Fri May 7 05:13:00 GMT 2004
Andrew Pinski wrote:
>
> On May 6, 2004, at 22:14, Andrew Pinski wrote:
>
>>
>> On May 6, 2004, at 22:10, Stan Shebs wrote:
>>
>>> You're not the first person to suggest the separate tool idea! It
>>> would have to know types and decls well enough to come up with the
>>> right constraint letters. Take a look at MacMAME sources to see
>>> some hairy usage of CW inline asm; much of it is assembled from
>>> combinations of macros.
>>
>>
>> How can he as the source comes in .dmg format. I am downloading it
>> right now and I will post some examples.
>
>
> Here is an example (which I think is stupid to use asm in this case as it
> can be written using function pointers (or maybe libffi) and there is no
> reason why this has to be in the source file except for inlining reasons,
> but then again this example is a case where GCC would not get right
> as the asm wants to allocate the stack frame it self.
>
I would think the inlining reason is sort of compelling in time
critical code, wouldn't you?
> static asm void execute_core(void)
That's not where the real action is though. Look at macblitters.c,
especially the various things that BLIT_FUNC expands into. Interested
persons can find all the mac-specific files online at
http://cvs.mess.org:6502/cgi-bin/viewcvs.cgi/mac/MacMAME/override/macintosh/
> It looks like all the examples in MacMame really should be in
> an asm file instead of a C file because they all allocate the
> stackframe themselves. They are just using the preprocessor
> really which already can be done for assembly.
You'd also have to do the right things for parameters and structure
offsets at least. And sure, all that can be rewritten, but by that
argument we don't need that complex C++ stuff because it can all
be done in C. :-)
Stan
More information about the Gcc
mailing list