Page MenuHomePhabricator

[SEH] [ARM64] Retrieve the frame pointer from SEH funclets
ClosedPublic

Authored by ssijaric on Jan 9 2019, 6:29 PM.

Details

Summary

The Windows ARM64 runtime passes the establisher frame to funclets as the first argument. This change just copies x1 to fp in that case.

The test case depends on https://reviews.llvm.org/D53540, which lowers the localaddr intrinsic.

Diff Detail

Repository
rL LLVM

Event Timeline

ssijaric created this revision.Jan 9 2019, 6:29 PM
efriedma added inline comments.Jan 9 2019, 6:51 PM
lib/Target/AArch64/AArch64FrameLowering.cpp
927

The casting/stripPointerCasts/hasPersonalityFn is unnecessary here, I think; llvm::classifyEHPersonality will do it for you.

Checking the personality here seems a little awkward, but I guess it works.

ssijaric updated this revision to Diff 181116.Jan 10 2019, 11:24 AM

Cleanup per Eli's comments. Checking for the personality function is probably not necessary. I could add an assert instead of the check?

efriedma added inline comments.Jan 10 2019, 12:27 PM
lib/Target/AArch64/AArch64FrameLowering.cpp
923

Do we need to do anything special to recover the base pointer in SEH funclets? (If not, probably worth adding an explicit comment.)

ssijaric updated this revision to Diff 181189.Jan 10 2019, 5:06 PM

Clarify the comment. By looking at cl.exe generated code, it looks like only the frame pointer is passed in x1. The base pointer, if needed, is used directly (e.g. x19). I will verify with a more complicated test case.

efriedma accepted this revision.Jan 10 2019, 5:39 PM

LGTM

test/CodeGen/AArch64/seh_funclet_x1.ll
118

You could probably clean up this testcase a bit (remove the unnecessary attributes, maybe run mem2reg).

This revision is now accepted and ready to land.Jan 10 2019, 5:39 PM
ssijaric closed this revision.Jan 16 2019, 4:33 PM

Committed under https://reviews.llvm.org/rL351404. Forgot to add a Different Revision line.