Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/c579340ca8494908abdec0a50952ea81b8eaa6ab

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

commit c579340ca8494908abdec0a50952ea81b8eaa6ab
Author: Johan Tibell <johan.tib...@gmail.com>
Date:   Thu Aug 25 15:02:58 2011 +0200

    Make popCnt# primop work with dynamic compilation

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

 compiler/nativeGen/X86/CodeGen.hs |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/compiler/nativeGen/X86/CodeGen.hs 
b/compiler/nativeGen/X86/CodeGen.hs
index 5474905..a7ab86b 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -39,6 +39,7 @@ import Platform
 -- Our intermediate code:
 import BasicTypes
 import BlockId
+import Module           ( primPackageId )
 import PprCmm           ()
 import OldCmm
 import OldPprCmm        ()
@@ -1595,10 +1596,15 @@ genCCall (CmmPrim (MO_PopCnt width)) 
dest_regs@[CmmHinted dst _]
                      else
                          unitOL (POPCNT size (OpReg src_r)
                                  (getRegisterReg False (CmmLocal dst))))
-        else genCCall (CmmCallee (fn width) CCallConv) dest_regs args
-  where size = intSize width
-        fn w = CmmLit (CmmLabel (mkForeignLabel (fsLit (popCntLabel w)) Nothing
-                                 ForeignLabelInExternalPackage IsFunction))
+        else do
+            dflags <- getDynFlagsNat
+            targetExpr <- cmmMakeDynamicReference dflags addImportNat
+                          CallReference lbl
+            let target = CmmCallee targetExpr CCallConv
+            genCCall target dest_regs args
+  where
+    size = intSize width
+    lbl = mkCmmCodeLabel primPackageId (fsLit (popCntLabel width))
 
 genCCall target dest_regs args =
     do dflags <- getDynFlagsNat



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to