On Mon, Feb 02, 2009 at 10:48:21PM -0800, Shawn Jefferson wrote: > How difficult, or possible would it be to allow the zeropage regbank size to > be specified in the linker config script, or via a pragma command? Why do you need a linker config option or #pragma? Have you tried the --register-space compiler command line option? Decreasing the size requires checking the library, because some modules (for example _printf.s) assume that the register bank is at least 6 bytes large, but increasing it shouldn't be a problem. I'm not sure however, if this gives noticeable speed increases. The best use for register variables is using it for (struct-) pointers and functions with more than three pointers are candidates for a rewrite anyway :-) > I know there is some overhead in saving and restoring the zeropage > variables, and at some point doing this negates the benefit you get. It > would be nice if the compiler could tell you when that is the case or not as > well, but that may be much more difficult. That's too much for a compiler like cc65. Fortunately, it's not too difficult to make a rough estimate: Three uses of a pointer means it is usually worth declaring it as a register variable. If you have three distinct uses, you will even get a size decrease, if you have a loop that uses the pointer at least three times, you will get a size increase but also a speed increase. That's the rule that I'm using. 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 Tue Feb 3 19:05:51 2009
This archive was generated by hypermail 2.1.8 : 2009-02-03 19:05:52 CET