From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 1999-07-19 14:46:24
> Why not? The optimization routines (which work at the assembly language > level) could be signalled to make a register variable of a function a > non-register one. Only the initialization and the clean-up code would > need patching, I think. While this is possible in theory, it is almost impossible in real life. "Big" compilers keep the compiler generated meta information and pass it to the optimization stage. The cc65 optimizer has just the assembly output with a few "hints" from the compiler. Any information about variable names, types, offsets has been lost. The maximum unit the current optimizer handles is a basic block, that is, all instructions between two labels. To change all variable accesses, it would be necessary to extract again all variable information from the assembly code on a function level, that is, by looking at a whole function at once. This involves analyzing jumps and rewriting code. For code using a register variable: register char* s; s [1] = 0x00; the following code may be generated: ldy #$01 lda #$00 sta (regbank+4),y If s is no longer a register variable, the code has to be changed in that place to read something like ldy #$05 ; Stack offset of local variable s lda (sp),y sta ptr1+1 dey lda (sp),y sta ptr1 ldy #$01 lda #$00 sta (ptr1),y And this is just an example, there are much more pieces of code that have to get replaced. Regards Uz -- 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:44 CET