[Sparc] Correctly handle call to functions with ReturnsTwice attribute.
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>
Thu, 5 Sep 2013 05:32:16 +0000 (05:32 +0000)
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>
Thu, 5 Sep 2013 05:32:16 +0000 (05:32 +0000)
commit1b41835f02f77c04a93323f722cf158cc566acae
tree3e32e648c5ce951b6a83dbc7c7ea378258cfced3
parent2909c9801979f41a85166f3381d0d3c577a7e89c
[Sparc] Correctly handle call to functions with ReturnsTwice attribute.

In sparc, setjmp stores only the registers %fp, %sp, %i7 and %o7. longjmp restores
the stack, and the callee-saved registers (all local/in registers: %i0-%i7, %l0-%l7)
using the stored %fp and register windows. However, this does not guarantee that the longjmp
will restore the registers, as they were when the setjmp was called. This is because these
registers may be clobbered after returning from setjmp, but before calling longjmp.

This patch prevents the registers %i0-%i5, %l0-l7 to live across the setjmp call using the register mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190033 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Sparc/SparcCallingConv.td
lib/Target/Sparc/SparcISelLowering.cpp
lib/Target/Sparc/SparcRegisterInfo.cpp
lib/Target/Sparc/SparcRegisterInfo.h
test/CodeGen/SPARC/setjmp.ll [new file with mode: 0644]