[PATCH] Fix return sequence on armv4 thumb

Jon Roelofs jonathan at codesourcery.com
Fri Aug 1 17:38:59 PDT 2014


I found another sequence that will work for the case where we would be clobbering r3 of the return value.

pop {r4, r5, r6, r7}
mov ip, r3
pop {r3}
mov lr, r3
mov r3, ip
bx lr

This is slightly less horrible than all the alternatives I've been able to come up with... correctness first, then performance later.

With this patch, I've fixed both the varargs and non-varargs cases, and added a test for the latter. I still need to write one for the former, but it is exercising the same logic.

http://reviews.llvm.org/D4748

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/ARM/ARMMachineFunctionInfo.h
  lib/Target/ARM/Thumb1FrameLowering.cpp
  test/CodeGen/ARM/thumb1_return_sequence.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4748.12129.patch
Type: text/x-patch
Size: 7805 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140802/ba613bd0/attachment.bin>


More information about the llvm-commits mailing list