From d2f767d2f6832e5d6bf13ff7f3a309bcd2b8f502 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 4 Mar 2016 22:56:17 +0000 Subject: [X86] Support cleaning more than 2**16 bytes of stack The x86 ret instruction has a 16 bit immediate indicating how many bytes to pop off of the stack beyond the return address. There is a problem when extremely large structs are passed by value: we might not be able to fit the number of bytes to pop into the return instruction. To fix this, expand RET_FLAG a little later and use a special sequence to clean the stack: pop %ecx ; return address is now in %ecx add $n, %esp ; clean the stack push %ecx ; bring the return address back on the stack ret ; pop the return address and jmp to it's value llvm-svn: 262755 --- llvm/lib/Target/X86/X86FrameLowering.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp') diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index de56259f744..c52ce15cf6a 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -159,6 +159,7 @@ static unsigned findDeadCallerSavedReg(MachineBasicBlock &MBB, unsigned Opc = MBBI->getOpcode(); switch (Opc) { default: return 0; + case X86::RET: case X86::RETL: case X86::RETQ: case X86::RETIL: -- cgit v1.2.3