Page MenuHomePhabricator

[AArch64] Allow pairing lr with other GPRs for WinCFI
ClosedPublic

Authored by mstorsjo on Thu, Oct 1, 1:33 PM.

Details

Summary

This saves one instruction per prologue/epilogue for any function with an odd number of callee-saved GPRs, but more importantly, allows such functions to match the packed unwind format.

Diff Detail

Event Timeline

mstorsjo created this revision.Thu, Oct 1, 1:33 PM
mstorsjo requested review of this revision.Thu, Oct 1, 1:33 PM
efriedma added inline comments.Thu, Oct 1, 2:36 PM
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
1318

Looking at the reference, the first number should be an odd number between 19 and 27.

llvm/test/CodeGen/AArch64/wineh-save-lrpair2.mir
6

It would probably be slightly more efficient to express this as alloc_s followed by save_lrpair, but I guess we can look into that as a followup.

mstorsjo added inline comments.Thu, Oct 1, 11:25 PM
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
1318

Oh, good catch, I had forgotten about that restriction.

llvm/test/CodeGen/AArch64/wineh-save-lrpair2.mir
6

Yeah, that would probably be more efficient. Not sure exactly where to poke things to achieve that though...

mstorsjo updated this revision to Diff 295738.Thu, Oct 1, 11:26 PM

Added checks/asserts and a testcase for trying to pair lr with an even register.

This revision is now accepted and ready to land.Fri, Oct 2, 11:02 AM
This revision was automatically updated to reflect the committed changes.