-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Description
| Bugzilla Link | 11226 |
| Version | trunk |
| OS | Windows NT |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
Howdy
It seems Thumb 2 code often pushes and uses R8-14 for its temporaries.
For code space, if R4-R7 are not used by arguments passed in, it would be
better if these were used instead.
For example, I noticed one function that
pushed LR (it called other functions, so this was a necessity), but presumably to maintain 8-byte stack alignment, it also pushed IP. It then proceeded to use it everywhere, generating 4-byte instructions left and right.
I've also seen it push FP/R11 despite not using it anywhere (alignment again, I assume). In this case there would be no cost whatsoever to push a lower register.
It would have been better if it had used R7 in this case, as registers R0-R7 can be used in many more two-byte instructions than R8-R15.
So, my suggestion is, unless necessary like LR, on Thumb 2 allocate from the R0-R7 before using the later registers.
James