[GHC] #11138: Kill the terrible LLVM Mangler

GHC ghc-devs at haskell.org
Tue Mar 7 13:33:20 UTC 2017


#11138: Kill the terrible LLVM Mangler
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (LLVM)   |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by angerman):

 * cc: gmainland (added)


Comment:

 This was added already in 2013.

 afdb2fc3d2013ced6c136853f4e24e84b6f150e9 \\
 Author:     Geoffrey Mainland <mainland at cs.drexel.edu> \\
 AuthorDate: Thu Feb 14 21:25:54 2013 +0000 \\
 Commit:     Geoffrey Mainland <mainland at cs.drexel.edu> \\
 CommitDate: Sun Sep 22 22:33:59 2013 -0400

 **Set LLVM option -stack-alignment=32 when compiling AVX instructions.**


 ----

 Then mangler code however was created earlier in 2011.

 f8c51678b0e60aad8ee1e4c57af746fa792a3546\\
 Author:       Geoffrey Mainland <mainland at cs.drexel.edu>\\
 AuthorDate:   Sat Nov 26 12:45:23 2011 +0000\\
 Commit:       Geoffrey Mainland <mainland at cs.drexel.edu>\\
 CommitDate:   Sun Sep 22 22:33:59 2013 -0400

 **Fixup stack spills when generating AVX instructions.**

 LLVM uses aligned AVX moves to spill values onto the stack, which requires
 32-bye aligned stacks. Since the stack in only 16-byte aligned, LLVM
 inserts
 extra instructions that munge the stack pointer. This is very very bad for
 the
 GHC calling convention, so we tell LLVM to assume the stack is 32-byte
 aligned. This patch rewrites the spill instructions that LLVM generates so
 they
 do not require an aligned stack.

 ----

 Could it be that the Mangler code is some ancient relict?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11138#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list