OSDN Git Service

Re-apply r214881: Fix return sequence on armv4 thumb
authorJonathan Roelofs <jonathan@codesourcery.com>
Tue, 5 Aug 2014 21:32:21 +0000 (21:32 +0000)
committerJonathan Roelofs <jonathan@codesourcery.com>
Tue, 5 Aug 2014 21:32:21 +0000 (21:32 +0000)
commitb23c2d9b2c9f4cfcb3781486c3a13d553a45b474
tree7aa7143c2b63168a42a895eeec92d19301f21e65
parent416ea4bfa71642c9a2c2f378ae9380406cdba1f7
Re-apply r214881: Fix return sequence on armv4 thumb

This reverts r214893, re-applying r214881 with the test case relaxed a bit to
satiate the build bots.

POP on armv4t cannot be used to change thumb state (unilke later non-m-class
architectures), therefore we need a different return sequence that uses 'bx'
instead:

  POP {r3}
  ADD sp, #offset
  BX r3

This patch also fixes an issue where the return value in r3 would get clobbered
for functions that return 128 bits of data. In that case, we generate this
sequence instead:

  MOV ip, r3
  POP {r3}
  ADD sp, #offset
  MOV lr, r3
  MOV r3, ip
  BX lr

http://reviews.llvm.org/D4748

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214928 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMMachineFunctionInfo.h
lib/Target/ARM/Thumb1FrameLowering.cpp
test/CodeGen/ARM/thumb1_return_sequence.ll [new file with mode: 0644]