X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcoreSyn%2FMkExternalCore.lhs;h=a0bccda29e19b21bc3c61a73aa0003894de88da9;hp=467cff5baa78a40a618c80cf38f166d2dddaf3b5;hb=7fc749a43b4b6b85d234fa95d4928648259584f4;hpb=49c98d143c382a1341e1046f5ca00819a25691ba diff --git a/compiler/coreSyn/MkExternalCore.lhs b/compiler/coreSyn/MkExternalCore.lhs index 467cff5..a0bccda 100644 --- a/compiler/coreSyn/MkExternalCore.lhs +++ b/compiler/coreSyn/MkExternalCore.lhs @@ -2,6 +2,12 @@ % (c) The University of Glasgow 2001-2006 % \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details module MkExternalCore ( emitExternalCore @@ -10,16 +16,15 @@ module MkExternalCore ( #include "HsVersions.h" import qualified ExternalCore as C -import Char import Module import CoreSyn import HscTypes import TyCon import TypeRep import Type -import PprExternalCore -- Instances +import PprExternalCore () -- Instances import DataCon -import CoreSyn +import Coercion import Var import IdInfo import Literal @@ -105,10 +110,15 @@ make_exp (Var v) = case globalIdDetails v of -- a DataConId represents the Id of a worker, which is a varName. -- sof 4/02 -- DataConId _ -> C.Dcon (make_con_qid (Var.varName v)) - FCallId (CCall (CCallSpec (StaticTarget nm) _ _)) -> C.External (unpackFS nm) (make_ty (idType v)) - FCallId _ -> error "MkExternalCore died: can't handle non-static-C foreign call" + FCallId (CCall (CCallSpec (StaticTarget nm) callconv _)) + -> C.External (unpackFS nm) (showSDoc (ppr callconv)) (make_ty (idType v)) + FCallId (CCall (CCallSpec DynamicTarget callconv _)) + -> C.DynExternal (showSDoc (ppr callconv)) (make_ty (idType v)) + FCallId _ + -> pprPanic "MkExternalCore died: can't handle non-{static,dynamic}-C foreign call" + (ppr v) _ -> C.Var (make_var_qid (Var.varName v)) -make_exp (Lit (l@(MachLabel s _))) = error "MkExternalCore died: can't handle \"foreign label\" declarations" +make_exp (Lit (l@(MachLabel s _))) = C.Label (unpackFS s) make_exp (Lit l) = C.Lit (make_lit l) make_exp (App e (Type t)) = C.Appt (make_exp e) (make_ty t) make_exp (App e1 e2) = C.App (make_exp e1) (make_exp e2) @@ -174,7 +184,8 @@ make_ty (NoteTy _ t) = make_ty t make_kind :: Kind -> C.Kind -make_kind (PredTy p) | isEqPred p = panic "coercion kinds in external core not implemented!" +make_kind (PredTy p) | isEqPred p = C.Keq (make_ty t1) (make_ty t2) + where (t1, t2) = getEqPredTys p make_kind (FunTy k1 k2) = C.Karrow (make_kind k1) (make_kind k2) make_kind k | isLiftedTypeKind k = C.Klifted