[LLVMbugs] [Bug 11226] New: Thumb 2: Code space: Prefer R4-R7 over IP, LR, etc.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Oct 24 15:50:41 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=11226
Summary: Thumb 2: Code space: Prefer R4-R7 over IP, LR, etc.
Product: libraries
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: ARM
AssignedTo: unassignedbugs at nondot.org
ReportedBy: xocotl at gmail.com
CC: llvmbugs at cs.uiuc.edu
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
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list