[llvm] [X86][CodeGen] Teach frame lowering to spill/reload registers w/ PUSHP/POPP, PUSH2[P]/POP2[P] (PR #73292)
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 01:00:59 PST 2023
================
@@ -1818,18 +1852,30 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
// Skip the callee-saved push instructions.
bool PushedRegs = false;
int StackOffset = 2 * stackGrowth;
+ MachineBasicBlock::iterator LastCSPush = MBBI;
+ auto IsCSPush = [&](const MachineBasicBlock::iterator &MBBI) {
+ if (MBBI == MBB.end() || !MBBI->getFlag(MachineInstr::FrameSetup))
+ return false;
+ unsigned Opc = MBBI->getOpcode();
+ return Opc == X86::PUSH32r || Opc == X86::PUSH64r || Opc == X86::PUSHP64r ||
+ Opc == X86::PUSH2 || Opc == X86::PUSH2P;
+ };
- while (MBBI != MBB.end() && MBBI->getFlag(MachineInstr::FrameSetup) &&
- (MBBI->getOpcode() == X86::PUSH32r ||
- MBBI->getOpcode() == X86::PUSH64r)) {
+ while (IsCSPush(MBBI)) {
PushedRegs = true;
Register Reg = MBBI->getOperand(0).getReg();
+ LastCSPush = MBBI;
----------------
KanRobert wrote:
Done
https://github.com/llvm/llvm-project/pull/73292
More information about the llvm-commits
mailing list