summaryrefslogtreecommitdiff
path: root/compiler/GHC/IfaceToCore.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/IfaceToCore.hs')
-rw-r--r--compiler/GHC/IfaceToCore.hs48
1 files changed, 44 insertions, 4 deletions
diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs
index b84fe1619d..7767f50e2e 100644
--- a/compiler/GHC/IfaceToCore.hs
+++ b/compiler/GHC/IfaceToCore.hs
@@ -19,7 +19,8 @@ module GHC.IfaceToCore (
tcIfaceDecl, tcIfaceInst, tcIfaceFamInst, tcIfaceRules,
tcIfaceAnnotations, tcIfaceCompleteSigs,
tcIfaceExpr, -- Desired by HERMIT (#7683)
- tcIfaceGlobal
+ tcIfaceGlobal,
+ tcIfaceOneShot
) where
#include "HsVersions.h"
@@ -30,6 +31,7 @@ import GHC.Builtin.Types.Literals(typeNatCoAxiomRules)
import GHC.Iface.Syntax
import GHC.Iface.Load
import GHC.Iface.Env
+import GHC.StgToCmm.Types
import GHC.Tc.TyCl.Build
import GHC.Tc.Utils.Monad
import GHC.Tc.Utils.TcType
@@ -1485,8 +1487,7 @@ tcIdInfo ignore_prags toplvl name ty info = do
then vanillaIdInfo `setUnfoldingInfo` BootUnfolding
else vanillaIdInfo
- let needed = needed_prags info
- foldlM tcPrag init_info needed
+ foldlM tcPrag init_info (needed_prags info)
where
needed_prags :: [IfaceInfoItem] -> [IfaceInfoItem]
needed_prags items
@@ -1506,6 +1507,9 @@ tcIdInfo ignore_prags toplvl name ty info = do
tcPrag info (HsCpr cpr) = return (info `setCprInfo` cpr)
tcPrag info (HsInline prag) = return (info `setInlinePragInfo` prag)
tcPrag info HsLevity = return (info `setNeverLevPoly` ty)
+ tcPrag info (HsLFInfo lf_info) = do
+ lf_info <- tcLFInfo lf_info
+ return (info `setLFInfo` lf_info)
-- The next two are lazy, so they don't transitively suck stuff in
tcPrag info (HsUnfold lb if_unf)
@@ -1518,6 +1522,38 @@ tcJoinInfo :: IfaceJoinInfo -> Maybe JoinArity
tcJoinInfo (IfaceJoinPoint ar) = Just ar
tcJoinInfo IfaceNotJoinPoint = Nothing
+tcLFInfo :: IfaceLFInfo -> IfL LambdaFormInfo
+tcLFInfo lfi = case lfi of
+ IfLFReEntrant rep_arity ->
+ -- LFReEntrant closures in interface files are guaranteed to
+ --
+ -- - Be top-level, as only top-level closures are exported.
+ -- - Have no free variables, as only non-top-level closures have free
+ -- variables
+ -- - Don't have ArgDescrs, as ArgDescr is used when generating code for
+ -- the closure
+ --
+ -- These invariants are checked when generating LFInfos in toIfaceLFInfo.
+ return (LFReEntrant TopLevel rep_arity True ArgUnknown)
+
+ IfLFThunk updatable mb_fun ->
+ -- LFThunk closure in interface files are guaranteed to
+ --
+ -- - Be top-level
+ -- - No have free variables
+ --
+ -- These invariants are checked when generating LFInfos in toIfaceLFInfo.
+ return (LFThunk TopLevel True updatable NonStandardThunk mb_fun)
+
+ IfLFUnlifted ->
+ return LFUnlifted
+
+ IfLFCon con_name ->
+ LFCon <$!> tcIfaceDataCon con_name
+
+ IfLFUnknown fun_flag ->
+ return (LFUnknown fun_flag)
+
tcUnfolding :: TopLevelFlag -> Name -> Type -> IdInfo -> IfaceUnfolding -> IfL Unfolding
tcUnfolding toplvl name _ info (IfCoreUnfold stable if_expr)
= do { dflags <- getDynFlags
@@ -1529,7 +1565,7 @@ tcUnfolding toplvl name _ info (IfCoreUnfold stable if_expr)
Just expr -> mkFinalUnfolding dflags unf_src strict_sig expr
}
where
- -- Strictness should occur before unfolding!
+ -- Strictness should occur before unfolding!
strict_sig = strictnessInfo info
tcUnfolding toplvl name _ _ (IfCompulsory if_expr)
@@ -1604,6 +1640,10 @@ tcPragExpr is_compulsory toplvl name expr
-- It's OK to use nonDetEltsUFM here because we immediately forget
-- the ordering by creating a set
+tcIfaceOneShot :: IfaceOneShot -> OneShotInfo
+tcIfaceOneShot IfaceNoOneShot = NoOneShotInfo
+tcIfaceOneShot IfaceOneShot = OneShotLam
+
{-
************************************************************************
* *