It would be good if sdcc, while compiling a function, would keep information on the accessed named address spaces. Example: A file contains g() and f(), with g() calling no other functions, and f() containing a call to g(). g() comes first and is compiled first. g() does not access any variables in named address spaces. Then when calling g() from f() we would know that that the call does not change the currently active named address space, which can save writes to memory banking registers.
In the future it might be possible to extend this somehow to library functions, so we would be able to have this information even though the library functions are in different files.
At first a simple annotation in function declarations that states that a function doesn't access any variabels in banked memory would probably cover most use cases at little implementation effort.
Log in to post a comment.