[llvm-bugs] [Bug 32858] New: Use ENTER and LEAVE instructions in function stack handling for optsize or when performant

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 29 06:07:19 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32858

            Bug ID: 32858
           Summary: Use ENTER and LEAVE instructions in function stack
                    handling for optsize or when performant
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: andrea.dibiagio at gmail.com, craig.topper at gmail.com,
                    filcab at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com
            Blocks: 26299

The ENTER and LEAVE instructions give us a way to start/end a stack frame in a
single instruction instead of:

ENTER N, 0 -->
push  %esp
mov   %esp, %ebp
sub   N, %esp // if we need to align the stack N must be 0 with separate
and+sub

LEAVE -->
mov %ebp, %esp
pop %ebp

They aren't fast on all architectures (especially ENTER), but can reduce
codesize and decode pressure which should be taken into account.

The AMD 15h SOG encourages the use of LEAVE (even without a corresponding
ENTER) under all circumstances.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=26299
[Bug 26299] [meta][X86] Size optimization opportunities (in particular for
32-bit Chromium on Windows)
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170429/51f5135a/attachment.html>


More information about the llvm-bugs mailing list