This is an archive of the discontinued LLVM Phabricator instance.

X86: Emit an ABI compliant prologue and epilogue for Win64
ClosedPublic

Authored by majnemer on Feb 9 2015, 3:29 PM.

Details

Summary

Win64 has specific contraints on what valid prologues and epilogues look
like. This constraint is born from the flexibility and descriptiveness
of Win64's unwind opcodes.

Prologues previously emitted by LLVM could not be represented by the
unwind opcodes, preventing operations powered by stack unwinding to
successfully work.

Diff Detail

Event Timeline

majnemer updated this revision to Diff 19621.Feb 9 2015, 3:29 PM
majnemer retitled this revision from to X86: Emit an ABI compliant prologue and epilogue for Win64.
majnemer updated this object.
majnemer added a reviewer: rnk.
majnemer added a subscriber: Unknown Object (MLST).
rnk edited edge metadata.Feb 9 2015, 3:47 PM

All my comments are comment related. :) Let me patch this and test it.

lib/Target/X86/X86FrameLowering.cpp
894

This comment is not associated with the relevant code anymore. I'd kill it.

936

s/pushed/spilled/, since we don't push XMM regs.

1215–1217

We need to describe what Offset is, since it took so much research to find. My attempt:
Offset will hold the offset from the stack pointer at function entry to the object. We need to factor in additional offsets applied during the prologue to the frame, base, and stack pointer depending on which is used.

1245

My attempt at describing this variable:
FPDelta is the offset from the "traditional" FP location of the old base pointer followed by return address and the location required by the restricted Win64 prologue. Add FPDelta to all offsets below that go through the frame pointer.

majnemer updated this revision to Diff 19623.Feb 9 2015, 3:55 PM
majnemer edited edge metadata.
  • Address rnk's review feedback.
majnemer updated this revision to Diff 19633.Feb 9 2015, 4:56 PM
  • Cleanup code by excising cast.
  • Fix self-host test breakage.
rnk accepted this revision.Feb 9 2015, 4:56 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Feb 9 2015, 4:56 PM
This revision was automatically updated to reflect the committed changes.