> Paul Russell:
> > Steve555:
[quoted text clipped - 15 lines]
> --
> Jens Ayton
Thanks, doing that produced:
void MyAdd()
{
int a=7, b=8;
int c = a+b;
}
...
LBB3:
.stabd 68,0,14
li r0,7
stw r0,32(r30)
li r0,8
stw r0,28(r30)
.stabd 68,0,15
lwz r2,32(r30)
lwz r0,28(r30)
add r0,r2,r0
stw r0,24(r30)
LBE3:
LBE2:
.stabd 68,0,17
lwz r1,0(r1)
lwz r30,-8(r1)
blr
...
(and a stack of stuff that looks like it's not related to the tesk at
hand)
But how would I now use these instructions directly in my source? Is
there a compiler message to tell it that what follows is assembly and
not any flavor of C?
Gregory Weston - 29 Apr 2007 17:43 GMT
> > Or, equivalently, Build->Show Assembly Code in Xcode.
>
[quoted text clipped - 3 lines]
>
> But how would I now use these instructions directly in my source?
You would search via Google for XCode and asm and one of the first hits
you would find would tell you how to activate support for assembly
blocks and how they're formatted.
<http://developer.apple.com/documentation/DeveloperTools/Conceptual/Movin
gProjectsToXcode/migration_differences/chapter_2_section_14.html>
If you don't mind me asking, is there a reason you don't trust the
compiler to generate code at least as well as you for the task at hand?
Jens Ayton - 29 Apr 2007 18:02 GMT
Gregory Weston:
> If you don't mind me asking, is there a reason you don't trust the
> compiler to generate code at least as well as you for the task at hand?
Reading back, I get the horrible feeling he's trying to use GAs to generate
asm. Don't do that -- you might build Skynet by mistake.

Signature
Jens Ayton
Steve555 - 29 Apr 2007 18:32 GMT
> Gregory Weston:
> >
[quoted text clipped - 6 lines]
> --
> Jens Ayton
Hey Jens, gimme a break, old though I am, I still find this stuff
fun. ;-)
Steve555 - 29 Apr 2007 18:12 GMT
> > > Or, equivalently, Build->Show Assembly Code in Xcode.
> >
[quoted text clipped - 13 lines]
> If you don't mind me asking, is there a reason you don't trust the
> compiler to generate code at least as well as you for the task at hand?
Thanks for the link. First hit if you knew asm meant assembly.
I'm chopping up my code in to 'genes' for mutation/crossover -a la
genetic algorithm - I just wanted to see if I could reduce the
building blocks to the smallest possible size (...without trying to
figure out what a function call looks like in binary). It's starting
to look way too scary though. I think I'll use function pointers
instead.
(No intention of competing with Xcode's amazing abilities!)
Steve
Sherm Pendley - 29 Apr 2007 18:34 GMT
> I'm chopping up my code in to 'genes' for mutation/crossover -a la
> genetic algorithm - I just wanted to see if I could reduce the
> building blocks to the smallest possible size (...without trying to
> figure out what a function call looks like in binary). It's starting
> to look way too scary though.
If it's not looking scary enough yet, consider universal binaries, and
the fact that there are a *lot* of PPC Macs still out there. Are you fluent
in *two* different asm languages? :-)
sherm--

Signature
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Steve555 - 30 Apr 2007 08:15 GMT
> > I'm chopping up my code in to 'genes' for mutation/crossover -a la
> > genetic algorithm - I just wanted to see if I could reduce the
[quoted text clipped - 11 lines]
> Web Hosting by West Virginians, for West Virginians: http://wv-www.net
> Cocoa programming in Perl: http://camelbones.sourceforge.net
Yes, quite. Idea banished.