I call a short and easy function out of an timer interrupt. This causes the c51 compiler to push all registers (A, B, DPH, DPL, PSW AR0..AR7) to the stack without any necessarity (they are not changed in this function). The fuction I call is in a seperate *.c file. How can I tell the C51-Compiler not to do this to save dataRAM and runtime? I can not use the using functionality because of register access.
You could consider assembler for the interrupt - Then you can be totally explicit about what you push and pop.
You say the function you call does not change certain registers - But what happens if you modify the function, or use a newer/different version of the compiler? A different combination of registers might end up being used and you would have to change your interrupt accordingly.
Hy, thanks for this information. I was already thinking about assembler, but I want the compiler to do this, because it is possible. The comiler pushes even all registers, when the called function is an empty "dummy" function!
because it is possible
You might want to look at Global Register Coloring in the manuals. I have not used it myself, but it might do the job.
Hy, I tested the global register coloring and it solved my problem. I was looking for this point of optimazation on my local help, but on my installation exact this point is not described. So I took a look into the internet and saw that this is what I was searching for.
Thanks a lot for your help!