summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmForeign.hs
diff options
context:
space:
mode:
authorBen.Lippmeier@anu.edu.au <unknown>2010-01-04 03:15:06 +0000
committerBen.Lippmeier@anu.edu.au <unknown>2010-01-04 03:15:06 +0000
commit6e9c0431a7cf2bf1a48f01db48c6a1d41fe15a09 (patch)
treeaf2b190722d7f5abd3a1940b4a0e3431bee61a30 /compiler/codeGen/StgCmmForeign.hs
parent172b85497dc0da68176fa90c993abd9bcdc6b96f (diff)
downloadhaskell-6e9c0431a7cf2bf1a48f01db48c6a1d41fe15a09.tar.gz
Refactor PackageTarget back into StaticTarget
Diffstat (limited to 'compiler/codeGen/StgCmmForeign.hs')
-rw-r--r--compiler/codeGen/StgCmmForeign.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/compiler/codeGen/StgCmmForeign.hs b/compiler/codeGen/StgCmmForeign.hs
index bda9e0fe1b..b98da50f25 100644
--- a/compiler/codeGen/StgCmmForeign.hs
+++ b/compiler/codeGen/StgCmmForeign.hs
@@ -56,11 +56,17 @@ cgForeignCall results result_hints (CCall (CCallSpec target cconv safety)) stg_a
= do { cmm_args <- getFCallArgs stg_args
; let ((call_args, arg_hints), cmm_target)
= case target of
- StaticTarget lbl ->
- (unzip cmm_args,
- CmmLit (CmmLabel (mkForeignLabel lbl (call_size cmm_args)
- ForeignLabelInThisPackage IsFunction)))
- DynamicTarget -> case cmm_args of
+ StaticTarget lbl mPkgId
+ -> let labelSource
+ = case mPkgId of
+ Nothing -> ForeignLabelInThisPackage
+ Just pkgId -> ForeignLabelInPackage pkgId
+ size = call_size cmm_args
+ in ( unzip cmm_args
+ , CmmLit (CmmLabel
+ (mkForeignLabel lbl size labelSource IsFunction)))
+
+ DynamicTarget -> case cmm_args of
(fn,_):rest -> (unzip rest, fn)
[] -> panic "cgForeignCall []"
fc = ForeignConvention cconv arg_hints result_hints