From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2001-03-19 22:40:05
On Mon, Mar 19, 2001 at 02:45:05PM -0600, Mike McCarty wrote: > Certainly it can. The gnu C compiler does this automatically as an > optimization even for machines which have a reasonable (read 16 bit) > stack pointer. If a routine is declared "static" then the compiler > knows, and can check for aliased pointers. For one, the GNU C compiler has about one hundred times the source code size of cc65. I would expect it to do things like this. Second, this can only be done for routines declared static, which limits the scope considerably. And third, if there are external functions and calls to external functions in this module (which is true for most C modules) the scope of such optimizations is even more limited, since recursive calls may happen indirectly through these external functions and the compiler does not know about it. So I doubt that these optimizations do really save a considerable amount of pushes and pops. > Especially it can know if > it is told by the programmer by... [...] > using an ISO C Standard compliant #pragma. Do you really think it is realistic to expect programmers to tell the compiler for each function if it is called recursively? Most people are not even declaring local functions and variables as static. And what happens, if the code gets changed but not the #pragma? > Ultimately: You support the compiler. You don't like that solution, so > it won't exist. That's wrong in two places. Everyone is welcome to send me code improvements, and a lot of people have done so. So it's not just me who is supporting the compiler. It is your decision to use it as is, or help improving it. And if your solution is better than the stuff that exists now, and you can show that with hard facts (that is: a real implementation) and not just words, I would be happy to add your code to the compiler. If you send me code that has no unnecessary runtime overhead and does improve the optimizer so that lots of stack operations could be removed I would be crazy not to use it. And I may be stubborn, but I'm not crazy:-) Regards Uz P.S.: This discussion has kept me from adding the stack checking code which I was working on, so I will try to shut up until this is finished:-) -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:39 CET