[PATCH] D63396: [WinEH] Allocate space in funclets stack to save XMM CSRs

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 14:55:31 PDT 2019


rnk added inline comments.


================
Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:1414
+            assert(IsWin64Prologue && "Only valid on Windows 64bit");
+            int Offset = (FI - XMMFrameSlotOrigin - 1) * 16;
+            addRegOffset(BuildMI(MBB, MBBI, DL, TII.get(X86::MOVAPSmr)),
----------------
This math relies on too many fragile undocumented invariants:
- frame indices are consecutive
- frame indices are fixed (or non-fixed), one is negative, the other not

Is it possible to adjust from the assigned fixed offset in the parent frame to the funclet frame using some other MachineFrameInfo values? This MOVAPS instruction replacement seems like the correct fix, I just want to make it more robust.


================
Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:1425
+            int Offset = getFrameIndexReference(MF, FI, IgnoredFrameReg);
+            BuildMI(MBB, MBBI, DL, TII.get(X86::SEH_SaveXMM))
+                .addImm(Reg)
----------------
This code should execute for funclets as well, I believe, so we get .seh_savexmm directives for funclets.


================
Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:2230
+  if (MBB.isEHFuncletEntry() && STI.is64Bit())
+    BuildMI(MBB, MI, DL, TII.get(X86::ADD64ri8), X86::RSP)
+        .addReg(X86::RSP)
----------------
This is not the right place to do this, I would expect to see it in emitepilog.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63396/new/

https://reviews.llvm.org/D63396





More information about the llvm-commits mailing list