I am writing a compiler for language with nested functions.
I decided to use display to access local variables of outer functions from inner ones, I don't know how to represent writing of activation record to display array in intermediate representation, because to do this I need an access to stack pointer register, which is machine-depended.
There is another solution, instead of translate writing of activation record to display into intermediate representation, I can postpone this step to final stage of compilation, which do machine-depended translation.
So, my question is:
which solution is better, and if the first one, how to represent writing of activation record to display array in intermediate representation?