Re: [cc65] optimizer or me?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-07-15 16:13:58
On Thu, Jul 15, 2004 at 06:40:43AM -0700, Shawn Jefferson wrote:
> Is this optimization intended for other similiar cases
> as well?

The optimization is intended for things like

        j = i;
        if (j == 0) {

        }

Since the value of j is already in the register, there's no need to load it
again from the memory cell where is was stored just before.

> I solved my immediate problem by moving the store up
> several lines in the code, which seems to force the
> compiler to reload it and compare.  I guess the
> optmizer only knows about so many previous
> instructions?

It's not the number of instructions but the fact that any other code will
destroy the contents of the A register, which contains the value of $D104. If
the compiler finds that the register contents are destroyed, the following
load from $D104 cannot be removed.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jul 15 16:14:03 2004

This archive was generated by hypermail 2.1.8 : 2004-07-15 16:14:11 CEST