On Sun, Jun 8, 2008 at 1:23 AM, Bill Bumgarner <[EMAIL PROTECTED]> wrote:

> Consider:
>
> {
>    int foo;
>
>    ... calculate on foo ...
>
>    int bar = getirdone(foo);
>
>    while(1) {
>        func(bar);
>        func2(bar);
>        ... etc ...
>    }
> }
>
> Without being able to recycle the space used by foo and bar, the compiler
> will generate code the pays the price of that space being consumed for all
> of the while loop, which could be the vast majority of the run time of the
> application.
>
> As well, if foo / bar fall in a register, then those registers would have to
> be preserved for all of the while loop, too, either by not being available
> to the bulk of the program (which raises some serious codegen issues) or
> being moved out/in the registers every time one of the funcs in the while
> loop is called or returns.

I was thinking that after the call to getirdone(foo), instead of
simply overwriting the value of foo in the register, the compiler
could move it to a space on the stack it had previously reserved for
that purpose.

Hamish
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to