Skip to content
  • Sylvain Henry's avatar
    CodeGen X86: fix unsafe foreign calls wrt inlining · b61b7c24
    Sylvain Henry authored
    Foreign calls (unsafe and safe) interact badly with inlining and
    register passing ABIs (see #11792 and #12614):
    the inlined code to compute a parameter of the call may overwrite a
    register already set to pass a preceding parameter.
    
    With this patch, we compute all parameters which are not simple
    expressions before assigning them to fixed registers required by the
    ABI.
    
    Test Plan:
       - Add test (test both reg and stack parameters)
       - Validate
    
    Reviewers: osa1, bgamari, austin, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2263
    
    GHC Trac Issues: #11792, #12614
    b61b7c24