summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/SparcCallingConv.td
diff options
context:
space:
mode:
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-09-05 05:32:16 +0000
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-09-05 05:32:16 +0000
commit55ecb10e995a3e5df9118c48c1b0643d639f6033 (patch)
tree6f3895889bd93e0cfe06fc31641d4c8c39ba0614 /llvm/lib/Target/Sparc/SparcCallingConv.td
parentef44edfde470d2f03f6cd808a139f2feafbedee4 (diff)
downloadbcm5719-llvm-55ecb10e995a3e5df9118c48c1b0643d639f6033.tar.gz
bcm5719-llvm-55ecb10e995a3e5df9118c48c1b0643d639f6033.zip
[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. llvm-svn: 190033
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcCallingConv.td')
-rw-r--r--llvm/lib/Target/Sparc/SparcCallingConv.td5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/Sparc/SparcCallingConv.td b/llvm/lib/Target/Sparc/SparcCallingConv.td
index 181165d6ddd..acd4ec21de4 100644
--- a/llvm/lib/Target/Sparc/SparcCallingConv.td
+++ b/llvm/lib/Target/Sparc/SparcCallingConv.td
@@ -123,3 +123,8 @@ def CSR : CalleeSavedRegs<(add)> {
let OtherPreserved = (add (sequence "I%u", 0, 7),
(sequence "L%u", 0, 7));
}
+
+// Callee-saved registers for calls with ReturnsTwice attribute.
+def RTCSR : CalleeSavedRegs<(add)> {
+ let OtherPreserved = (add I6, I7);
+}
OpenPOWER on IntegriCloud