[commit: ghc] ghc-8.0: Fix AIX/ppc codegen in `-prof` compilation mode (aa4349d)

git at git.haskell.org git at git.haskell.org
Mon Mar 28 11:37:33 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/aa4349d68014c2d0cb1baa0f327226857b458b97/ghc

>---------------------------------------------------------------

commit aa4349d68014c2d0cb1baa0f327226857b458b97
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Mar 27 23:41:12 2016 +0200

    Fix AIX/ppc codegen in `-prof` compilation mode
    
    The implementation in df26b95559fd467abc0a3a4151127c95cb5011b9
    wrongly assumed that all C-ABI subroutine calls would use a
    'ForeignLabel' but it turns out that calls inserted via
    'emitRtsCall' use 'CmmLabel's instead.
    
    (cherry picked from commit 61df7f8fb4e76fc8987c0b4f02aa9ec795be7afb)


>---------------------------------------------------------------

aa4349d68014c2d0cb1baa0f327226857b458b97
 compiler/nativeGen/PPC/Ppr.hs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs
index 16e8dc1..59b0ad8 100644
--- a/compiler/nativeGen/PPC/Ppr.hs
+++ b/compiler/nativeGen/PPC/Ppr.hs
@@ -607,10 +607,16 @@ pprInstr (BCTR _ _) = hcat [
     ]
 pprInstr (BL lbl _) = do
     sdocWithPlatform $ \platform -> case platformOS platform of
-        OSAIX | isForeignLabel lbl ->
+        OSAIX ->
           -- On AIX, "printf" denotes a function-descriptor (for use
           -- by function pointers), whereas the actual entry-code
-          -- address is denoted by the dot-prefixed ".printf" label
+          -- address is denoted by the dot-prefixed ".printf" label.
+          -- Moreover, the PPC NCG only ever emits a BL instruction
+          -- for calling C ABI functions. Most of the time these calls
+          -- originate from FFI imports and have a 'ForeignLabel',
+          -- but when profiling the codegen inserts calls via
+          -- 'emitRtsCallGen' which are 'CmmLabel's even though
+          -- they'd technically be more like 'ForeignLabel's.
           hcat [
             text "\tbl\t.",
             ppr lbl



More information about the ghc-commits mailing list