How useful is having the linker rewrite LDS/STS instructions to IN/OUT (given the address fall in the I/O addressable range)? The IN/OUT instructions are a byte shorter and take one fewer cycle to execute, according to the datasheet.
The compiler already does this for addresses known to be in the IN/OUT range at compile time - it falls back to lds/sts otherwise (I'm excluding things LTO can do). The final addresses will obviously be known at link time, so if this is done, the linker can catch the missed cases too.
I'm just curious if it will be useful though - how common is having I/O code that doesn't really know the actual addresses until link time? In most cases, the device header is included when compiling, so the compiler can see the actual addresses. Library code will benefit though.
What do you guys think?