Re: Assembly macros with Gcc
Re: Assembly macros with Gcc
- Subject: Re: Assembly macros with Gcc
- From: Paul Russell <email@hidden>
- Date: Thu, 4 Mar 2004 09:17:42 -0800
On Feb 4, 2004, at 10:48 AM, Brad Post ((MACBU)) wrote:
Anyone have a good reference on how to do macros in assembly? I'm
trying to get some macros to work with gcc and Project Builder (not
Xcode) and having some troubles, so does anyone know a good reference
with decent examples?
I'm trying to do something like this:
#define SAVE_STATISTICS(stat, reg)
lwz reg, stat(r3)
addi reg, reg, 1
stw reg, stat(r3)
I've tried a bunch of stuff, but gcc doesn't seem to like it and I'm
hoping someone here might have a good reference book or website....
There are two kinds of asm macros you can use with gcc - old-fashioned
preprocessor macros such as your example above (which, BTW, needs \
line continuation characters at the end of each line) and proper asm
macros using the .macro directive. Unless there is a good reason I
would go for the proper macros, e.g.
.macro SAVE_STATISTICS
lwz $2,$1(r3)
addi $2,$2,1
stw $2,$1(r3)
.endmacro
Paul
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.