#include "X86InstrInfo.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
+#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/CodeGen/Passes.h" // For IDs of passes that are preserved.
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
int StackAdj = StackAdjust.getImm();
if (StackAdj) {
- // standard x86_64 and NaCl use 64-bit frame/stack pointers, x32 - 32-bit.
- // Check if we should use LEA for SP.
- const X86FrameLowering *TFI = STI->getFrameLowering();
- bool UseLEAForSP = STI->useLeaForSP() &&
- X86FL->canUseLEAForSPInEpilogue(*MBB.getParent());
// Check for possible merge with preceding ADD instruction.
- StackAdj += TFI->mergeSPUpdates(MBB, MBBI, true);
- TFI->emitSPUpdate(MBB, MBBI, StackAdj, UseLEAForSP);
+ StackAdj += X86FL->mergeSPUpdates(MBB, MBBI, true);
+ X86FL->emitSPUpdate(MBB, MBBI, StackAdj, /*InEpilogue=*/true);
}
// Jump to label or value in register.
// The EH_RETURN pseudo is really removed during the MC Lowering.
return true;
}
+
+ case X86::EH_RESTORE: {
+ // Restore ESP and EBP, and optionally ESI if required.
+ bool IsSEH = isAsynchronousEHPersonality(classifyEHPersonality(
+ MBB.getParent()->getFunction()->getPersonalityFn()));
+ X86FL->restoreWin32EHStackPointers(MBB, MBBI, DL, /*RestoreSP=*/IsSEH);
+ MBBI->eraseFromParent();
+ return true;
+ }
}
llvm_unreachable("Previous switch has a fallthrough?");
}