summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorJohan Tibell <johan.tibell@gmail.com>2011-08-25 15:02:58 +0200
committerJohan Tibell <johan.tibell@gmail.com>2011-08-25 20:39:14 +0200
commitc579340ca8494908abdec0a50952ea81b8eaa6ab (patch)
treecda9700fa60e26b249cc737971433f46740037f1 /compiler
parentc5056b932a06b4adce5167a5cb69f1f0768d28ec (diff)
downloadhaskell-c579340ca8494908abdec0a50952ea81b8eaa6ab.tar.gz
Make popCnt# primop work with dynamic compilation
Diffstat (limited to 'compiler')
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index 5474905f9b..a7ab86b2a4 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