The ADDRESS_OF iCode should have a second parameter for a constant offset. That way, an ADDRESS_OF followed by + or - with constant could be merged into one iCode. This would be similar to what we do with + or - followed by GET_VALUE_AT_ADDRESS.
Typically, ADDRESS_OF is implemented by adding on offset to stack- or frame-pointer for local variables, and by loading a constant for global variables. In both cases an additional offset would be free. This is even cheaper than the offset in GET_VALUE_AT_ADDRESS, so when both optimizations are possible, we should prefer the ADDRESS_OF one.
This would mostly improve code for aggregates and unions, which are still one of the weaker points of sdcc.
Philipp
Implemented in revision #8799.
Philipp