[PATCH] D50969: [Sparc] Improve the builtin setjmp/longjmp

Daniel Cederman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 05:49:13 PDT 2018


dcederman created this revision.
dcederman added reviewers: jyknight, venkatra.
Herald added subscribers: llvm-commits, jrtc27, fedor.sergeev.

The current version does not always generate correct code and fails the -verify-machineinstrs test.

This patch makes the following changes:

- Require base address of jmp_buf to be in a single register. This simplifies things as there is always room for the offset in the immediate field.

- Chain longjmp with a FLUSHW to get a platform independent register window flush before going up the stack.

- Use LDX/STX for 64-bit systems.

- Simplify emitEHSjLjLongJmp with a for-loop.

- Use a register mask to force reload of data into registers after a longjmp.

- Use a call instruction to get the return address. This allows the same code to be used for 64-bit systems and with position-independent code.

I have only tested it on a 32-bit system.


Repository:
  rL LLVM

https://reviews.llvm.org/D50969

Files:
  lib/Target/Sparc/SparcISelLowering.cpp
  lib/Target/Sparc/SparcInstrInfo.td
  test/CodeGen/SPARC/sjlj.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50969.161466.patch
Type: text/x-patch
Size: 18973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180820/dade44a2/attachment.bin>


More information about the llvm-commits mailing list