summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen
diff options
context:
space:
mode:
authorsof <unknown>1997-05-19 00:21:27 +0000
committersof <unknown>1997-05-19 00:21:27 +0000
commitdcef38bab91d45b56f7cf3ceeec96303d93728bb (patch)
treeef5cc7ac9b590d502c03f6906de2e66df01f8d34 /ghc/compiler/codeGen
parentf1815aa4bb218b92bc699d1355b6a704ee3e89ee (diff)
downloadhaskell-dcef38bab91d45b56f7cf3ceeec96303d93728bb.tar.gz
[project @ 1997-05-19 00:12:10 by sof]
2.04 changes
Diffstat (limited to 'ghc/compiler/codeGen')
-rw-r--r--ghc/compiler/codeGen/CGLoop1.hs1
-rw-r--r--ghc/compiler/codeGen/CgBindery.hi-boot12
-rw-r--r--ghc/compiler/codeGen/CgBindery.lhs17
-rw-r--r--ghc/compiler/codeGen/CgCase.lhs13
-rw-r--r--ghc/compiler/codeGen/CgClosure.lhs20
-rw-r--r--ghc/compiler/codeGen/CgCon.lhs4
-rw-r--r--ghc/compiler/codeGen/CgConTbls.lhs11
-rw-r--r--ghc/compiler/codeGen/CgExpr.hi-boot6
-rw-r--r--ghc/compiler/codeGen/CgExpr.lhs43
-rw-r--r--ghc/compiler/codeGen/CgHeapery.lhs4
-rw-r--r--ghc/compiler/codeGen/CgLetNoEscape.lhs3
-rw-r--r--ghc/compiler/codeGen/CgLoop1.hs9
-rw-r--r--ghc/compiler/codeGen/CgLoop2.hs7
-rw-r--r--ghc/compiler/codeGen/CgMonad.lhs26
-rw-r--r--ghc/compiler/codeGen/CgRetConv.hi-boot7
-rw-r--r--ghc/compiler/codeGen/CgRetConv.lhs7
-rw-r--r--ghc/compiler/codeGen/CgTailCall.lhs5
-rw-r--r--ghc/compiler/codeGen/CgUsages.hi-boot5
-rw-r--r--ghc/compiler/codeGen/ClosureInfo.hi-boot18
-rw-r--r--ghc/compiler/codeGen/ClosureInfo.lhs41
-rw-r--r--ghc/compiler/codeGen/CodeGen.lhs5
-rw-r--r--ghc/compiler/codeGen/SMRep.lhs7
22 files changed, 193 insertions, 78 deletions
diff --git a/ghc/compiler/codeGen/CGLoop1.hs b/ghc/compiler/codeGen/CGLoop1.hs
new file mode 100644
index 0000000000..06227bcc18
--- /dev/null
+++ b/ghc/compiler/codeGen/CGLoop1.hs
@@ -0,0 +1 @@
+module IdLoop () where
diff --git a/ghc/compiler/codeGen/CgBindery.hi-boot b/ghc/compiler/codeGen/CgBindery.hi-boot
new file mode 100644
index 0000000000..a61fc45a48
--- /dev/null
+++ b/ghc/compiler/codeGen/CgBindery.hi-boot
@@ -0,0 +1,12 @@
+_interface_ CgBindery 1
+_exports_
+CgBindery CgBindings CgIdInfo(MkCgIdInfo) VolatileLoc StableLoc LambdaFormInfo nukeVolatileBinds maybeAStkLoc maybeBStkLoc;
+_declarations_
+1 type CgBindings = Id.IdEnv CgIdInfo;
+1 data CgIdInfo = MkCgIdInfo Id.Id CgBindery.VolatileLoc CgBindery.StableLoc CgBindery.LambdaFormInfo;
+1 data VolatileLoc;
+1 data StableLoc;
+1 data LambdaFormInfo;
+1 nukeVolatileBinds _:_ CgBindery.CgBindings -> CgBindery.CgBindings ;;
+1 maybeAStkLoc _:_ CgBindery.StableLoc -> PrelBase.Maybe HeapOffs.VirtualSpAOffset ;;
+1 maybeBStkLoc _:_ CgBindery.StableLoc -> PrelBase.Maybe HeapOffs.VirtualSpBOffset ;;
diff --git a/ghc/compiler/codeGen/CgBindery.lhs b/ghc/compiler/codeGen/CgBindery.lhs
index 452466bff4..a5feb794c9 100644
--- a/ghc/compiler/codeGen/CgBindery.lhs
+++ b/ghc/compiler/codeGen/CgBindery.lhs
@@ -27,7 +27,7 @@ module CgBindery (
) where
IMP_Ubiq(){-uitous-}
-IMPORT_DELOOPER(CgLoop1) -- here for paranoia-checking
+--IMPORT_DELOOPER(CgLoop1) -- here for paranoia-checking
import AbsCSyn
import CgMonad
@@ -41,16 +41,21 @@ import HeapOffs ( SYN_IE(VirtualHeapOffset),
import Id ( idPrimRep, toplevelishId, isDataCon,
mkIdEnv, rngIdEnv, SYN_IE(IdEnv),
idSetToList,
- GenId{-instance NamedThing-}
+ GenId{-instance NamedThing-}, SYN_IE(Id)
)
+import Literal ( Literal )
import Maybes ( catMaybes )
-import Name ( isLocallyDefined, isWiredInName, Name{-instance NamedThing-} )
+import Name ( isLocallyDefined, isWiredInName,
+ Name{-instance NamedThing-}, NamedThing(..) )
#ifdef DEBUG
import PprAbsC ( pprAmode )
#endif
import PprStyle ( PprStyle(..) )
+import Pretty ( Doc )
+import PrimRep ( PrimRep )
import StgSyn ( SYN_IE(StgArg), SYN_IE(StgLiveVars), GenStgArg(..) )
-import Unpretty ( uppShow )
+import Unique ( Unique )
+import UniqFM ( Uniquable(..) )
import Util ( zipWithEqual, panic )
\end{code}
@@ -197,7 +202,7 @@ getCAddrModeAndInfo :: Id -> FCode (CAddrMode, LambdaFormInfo)
getCAddrModeAndInfo id
| not (isLocallyDefined name) || isWiredInName name
{- Why the "isWiredInName"?
- Imagine you are compiling GHCbase.hs (a module that
+ Imagine you are compiling PrelBase.hs (a module that
supplies some of the wired-in values). What can
happen is that the compiler will inject calls to
(e.g.) GHCbase.unpackPS, where-ever it likes -- it
@@ -410,7 +415,7 @@ bindNewPrimToAmode name (CVal (NodeRel offset) _)
#ifdef DEBUG
bindNewPrimToAmode name amode
- = panic ("bindNew...:"++(uppShow 80 (pprAmode PprDebug amode)))
+ = panic ("bindNew...:"++(show (pprAmode PprDebug amode)))
#endif
\end{code}
diff --git a/ghc/compiler/codeGen/CgCase.lhs b/ghc/compiler/codeGen/CgCase.lhs
index 939c87ddc1..ed5cc8ebea 100644
--- a/ghc/compiler/codeGen/CgCase.lhs
+++ b/ghc/compiler/codeGen/CgCase.lhs
@@ -45,16 +45,19 @@ import CLabel ( mkVecTblLabel, mkReturnPtLabel, mkDefaultLabel,
)
import ClosureInfo ( mkConLFInfo, mkLFArgument, layOutDynCon )
import CmdLineOpts ( opt_SccProfilingOn, opt_GranMacros )
-import CostCentre ( useCurrentCostCentre )
+import CostCentre ( useCurrentCostCentre, CostCentre )
import HeapOffs ( SYN_IE(VirtualSpBOffset), SYN_IE(VirtualHeapOffset) )
import Id ( idPrimRep, toplevelishId,
dataConTag, fIRST_TAG, SYN_IE(ConTag),
isDataCon, SYN_IE(DataCon),
- idSetToList, GenId{-instance Uniquable,Eq-}
+ idSetToList, GenId{-instance Uniquable,Eq-}, SYN_IE(Id)
)
+import Literal ( Literal )
import Maybes ( catMaybes )
+import Outputable ( Outputable(..) )
import PprStyle ( PprStyle(..) )
import PprType ( GenType{-instance Outputable-} )
+import Pretty ( Doc )
import PrimOp ( primOpCanTriggerGC, PrimOp(..),
primOpStackRequired, StackRequirement(..)
)
@@ -64,11 +67,15 @@ import PrimRep ( getPrimRepSize, isFollowableRep, retPrimRepSize,
import TyCon ( isEnumerationTyCon )
import Type ( typePrimRep,
getAppSpecDataTyConExpandingDicts,
- maybeAppSpecDataTyConExpandingDicts
+ maybeAppSpecDataTyConExpandingDicts,
+ SYN_IE(Type)
)
+import Unique ( Unique )
+import UniqFM ( Uniquable(..) )
import Util ( sortLt, isIn, isn'tIn, zipEqual,
pprError, panic, assertPanic
)
+
\end{code}
\begin{code}
diff --git a/ghc/compiler/codeGen/CgClosure.lhs b/ghc/compiler/codeGen/CgClosure.lhs
index 872827fba6..39d484c0ad 100644
--- a/ghc/compiler/codeGen/CgClosure.lhs
+++ b/ghc/compiler/codeGen/CgClosure.lhs
@@ -49,24 +49,24 @@ import ClosureInfo -- lots and lots of stuff
import CmdLineOpts ( opt_ForConcurrent, opt_GranMacros )
import CostCentre ( useCurrentCostCentre, currentOrSubsumedCosts,
noCostCentreAttached, costsAreSubsumed,
- isCafCC, isDictCC, overheadCostCentre, showCostCentre
+ isCafCC, isDictCC, overheadCostCentre, showCostCentre,
+ CostCentre
)
import HeapOffs ( SYN_IE(VirtualHeapOffset) )
import Id ( idType, idPrimRep,
showId, getIdStrictness, dataConTag,
emptyIdSet,
- GenId{-instance Outputable-}
+ GenId{-instance Outputable-}, SYN_IE(Id)
)
import ListSetOps ( minusList )
import Maybes ( maybeToBool )
import Outputable ( Outputable(..){-instances-} ) -- ToDo:rm
import PprStyle ( PprStyle(..) )
import PprType ( GenType{-instance Outputable-}, TyCon{-ditto-} )
-import Pretty ( prettyToUn, ppBesides, ppChar, ppPStr, ppCat, ppStr )
+import Pretty ( Doc, hcat, char, ptext, hsep, text )
import PrimRep ( isFollowableRep, PrimRep(..) )
import TyCon ( isPrimTyCon, tyConDataCons )
import Type ( showTypeCategory )
-import Unpretty ( uppShow )
import Util ( isIn, panic, pprPanic, assertPanic, pprTrace{-ToDo:rm-} )
getWrapperArgTypeCategories = panic "CgClosure.getWrapperArgTypeCategories (ToDo)"
@@ -602,7 +602,7 @@ enterCostCentreCode closure_info cc is_thunk
if costsAreSubsumed cc then
--ASSERT(isToplevClosure closure_info)
--ASSERT(is_thunk == IsFunction)
- (if isToplevClosure closure_info && is_thunk == IsFunction then \x->x else pprTrace "enterCostCenterCode:" (ppCat [ppr PprDebug (is_thunk == IsFunction){-, ppr PprDebug closure_info-}, ppStr (showCostCentre PprDebug False cc)])) $
+ (if isToplevClosure closure_info && is_thunk == IsFunction then \x->x else pprTrace "enterCostCenterCode:" (hsep [ppr PprDebug (is_thunk == IsFunction){-, ppr PprDebug closure_info-}, text (showCostCentre PprDebug False cc)])) $
costCentresC SLIT("ENTER_CC_FSUB") []
else if currentOrSubsumedCosts cc then
@@ -915,12 +915,12 @@ closureDescription :: FAST_STRING -- Module
-- CgConTbls.lhs with a description generated from the data constructor
closureDescription mod_name name args body
- = uppShow 0 (prettyToUn (
- ppBesides [ppChar '<',
- ppPStr mod_name,
- ppChar '.',
+ = show (
+ hcat [char '<',
+ ptext mod_name,
+ char '.',
ppr PprDebug name,
- ppChar '>']))
+ char '>'])
\end{code}
\begin{code}
diff --git a/ghc/compiler/codeGen/CgCon.lhs b/ghc/compiler/codeGen/CgCon.lhs
index 2ae485e84c..a4110434d5 100644
--- a/ghc/compiler/codeGen/CgCon.lhs
+++ b/ghc/compiler/codeGen/CgCon.lhs
@@ -41,11 +41,11 @@ import ClosureInfo ( mkClosureLFInfo, mkConLFInfo, mkLFArgument,
layOutStaticClosure
)
import CostCentre ( currentOrSubsumedCosts, useCurrentCostCentre,
- dontCareCostCentre
+ dontCareCostCentre, CostCentre
)
import Id ( idPrimRep, dataConTag, dataConTyCon,
isDataCon, SYN_IE(DataCon),
- emptyIdSet
+ emptyIdSet, SYN_IE(Id)
)
import Literal ( Literal(..) )
import Maybes ( maybeToBool )
diff --git a/ghc/compiler/codeGen/CgConTbls.lhs b/ghc/compiler/codeGen/CgConTbls.lhs
index c970c9fc22..09d9c109a1 100644
--- a/ghc/compiler/codeGen/CgConTbls.lhs
+++ b/ghc/compiler/codeGen/CgConTbls.lhs
@@ -29,21 +29,22 @@ import CLabel ( mkConEntryLabel, mkStaticClosureLabel,
import ClosureInfo ( layOutStaticClosure, layOutDynCon,
layOutPhantomClosure, closurePtrsSize,
fitsMinUpdSize, mkConLFInfo,
- infoTableLabelFromCI, dataConLiveness
+ infoTableLabelFromCI, dataConLiveness,
+ ClosureInfo
)
-import CostCentre ( dontCareCostCentre )
+import CostCentre ( dontCareCostCentre, CostCentre )
import FiniteMap ( fmToList, FiniteMap )
import HeapOffs ( zeroOff, SYN_IE(VirtualHeapOffset) )
import Id ( dataConTag, dataConRawArgTys,
dataConNumFields, fIRST_TAG,
emptyIdSet,
- GenId{-instance NamedThing-}
+ GenId{-instance NamedThing-}, SYN_IE(Id)
)
import Name ( getOccString )
import PrelInfo ( maybeIntLikeTyCon )
import PrimRep ( getPrimRepSize, PrimRep(..) )
-import TyCon ( tyConDataCons, mkSpecTyCon )
-import Type ( typePrimRep )
+import TyCon ( tyConDataCons, mkSpecTyCon, TyCon )
+import Type ( typePrimRep, SYN_IE(Type) )
import Util ( panic )
mkSameSpecCon = panic "CgConTbls.mkSameSpecCon (ToDo)"
diff --git a/ghc/compiler/codeGen/CgExpr.hi-boot b/ghc/compiler/codeGen/CgExpr.hi-boot
new file mode 100644
index 0000000000..6398db2209
--- /dev/null
+++ b/ghc/compiler/codeGen/CgExpr.hi-boot
@@ -0,0 +1,6 @@
+_interface_ CgExpr 1
+_exports_
+CgExpr cgExpr getPrimOpArgAmodes;
+_declarations_
+1 cgExpr _:_ StgSyn.StgExpr -> CgMonad.Code ;;
+1 getPrimOpArgAmodes _:_ PrimOp.PrimOp -> [StgSyn.StgArg] -> CgMonad.FCode [AbsCSyn.CAddrMode] ;;
diff --git a/ghc/compiler/codeGen/CgExpr.lhs b/ghc/compiler/codeGen/CgExpr.lhs
index c9a6dc7fc3..d90f9886e4 100644
--- a/ghc/compiler/codeGen/CgExpr.lhs
+++ b/ghc/compiler/codeGen/CgExpr.lhs
@@ -35,16 +35,18 @@ import CgTailCall ( cgTailCall, performReturn,
mkDynamicAlgReturnCode, mkPrimReturnCode
)
import CLabel ( mkPhantomInfoTableLabel, mkInfoTableVecTblLabel )
-import ClosureInfo ( mkClosureLFInfo, mkSelectorLFInfo, mkVapLFInfo, lfArity_maybe,
+import ClosureInfo ( mkClosureLFInfo, mkSelectorLFInfo, mkVapLFInfo,
layOutDynCon )
import CostCentre ( sccAbleCostCentre, isDictCC, isSccCountCostCentre )
import HeapOffs ( SYN_IE(VirtualSpBOffset), intOffsetIntoGoods )
import Id ( dataConTyCon, idPrimRep, getIdArity,
- mkIdSet, unionIdSets, GenId{-instance Outputable-}
+ mkIdSet, unionIdSets, GenId{-instance Outputable-},
+ SYN_IE(Id)
)
import IdInfo ( ArityInfo(..) )
import Name ( isLocallyDefined )
import PprStyle ( PprStyle(..) )
+import Pretty ( Doc )
import PrimOp ( primOpCanTriggerGC, primOpHeapReq, HeapRequirement(..),
getPrimOpResultInfo, PrimOp(..), PrimOpResultInfo(..)
)
@@ -52,6 +54,9 @@ import PrimRep ( getPrimRepSize, PrimRep(..) )
import TyCon ( tyConDataCons, maybeTyConSingleCon )
import Maybes ( assocMaybe, maybeToBool )
import Util ( panic, isIn, pprPanic, assertPanic )
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable ( Outputable(..) )
+#endif
\end{code}
This module provides the support code for @StgToAbstractC@ to deal
@@ -312,8 +317,10 @@ cgRhs name (StgRhsCon maybe_cc con args)
zero_size atom = getPrimRepSize (getArgPrimRep atom) == 0
cgRhs name (StgRhsClosure cc bi fvs upd_flag args body)
- = mkRhsLFInfo fvs upd_flag args body `thenFC` \ lf_info ->
- cgRhsClosure name cc bi fvs args body lf_info
+ = cgRhsClosure name cc bi fvs args body lf_info
+ where
+ lf_info = mkRhsLFInfo fvs upd_flag args body
+
\end{code}
mkRhsLFInfo looks for two special forms of the right-hand side:
@@ -322,8 +329,13 @@ mkRhsLFInfo looks for two special forms of the right-hand side:
If neither happens, it just calls mkClosureLFInfo. You might think
that mkClosureLFInfo should do all this, but
+
(a) it seems wrong for the latter to look at the structure
of an expression
+
+ [March 97: item (b) is no longer true, but I've left mkRhsLFInfo here
+ anyway because of (a).]
+
(b) mkRhsLFInfo has to be in the monad since it looks up in
the environment, and it's very tiresome for mkClosureLFInfo to
be. Apart from anything else it would make a loop between
@@ -355,7 +367,7 @@ mkRhsLFInfo [the_fv] -- Just one free var
&& maybeToBool offset_into_int_maybe
&& offset_into_int <= mAX_SPEC_SELECTEE_SIZE -- Offset is small enough
= -- ASSERT(is_single_constructor) -- Should be true, but causes error for SpecTyCon
- returnFC (mkSelectorLFInfo scrutinee con offset_into_int)
+ mkSelectorLFInfo scrutinee con offset_into_int
where
(_, params_w_offsets) = layOutDynCon con idPrimRep params
maybe_offset = assocMaybe params_w_offsets selectee
@@ -381,26 +393,13 @@ mkRhsLFInfo fvs
[] -- No args; a thunk
(StgApp (StgVarArg fun_id) args _)
| isLocallyDefined fun_id -- Must be defined in this module
- = -- Get the arity of the fun_id. We could find out from the
- -- looking in the Id, but it's more certain just to look in the code
- -- generator's environment.
-
-----------------------------------------------
--- Sadly, looking in the environment, as suggested above,
--- causes a black hole (because cgRhsClosure depends on the LFInfo
--- returned here to determine its control flow.
--- So I wimped out and went back to looking at the arity inside the Id.
--- That means beefing up Core2Stg to propagate it. Sigh.
--- getCAddrModeAndInfo fun_id `thenFC` \ (_, fun_lf_info) ->
--- let arity_maybe = lfArity_maybe fun_lf_info
-----------------------------------------------
-
+ = -- Get the arity of the fun_id. It's guaranteed to be correct (by setStgVarInfo).
let
arity_maybe = case getIdArity fun_id of
ArityExactly n -> Just n
other -> Nothing
in
- returnFC (case arity_maybe of
+ case arity_maybe of
Just arity
| arity > 0 && -- It'd better be a function!
arity == length args -- Saturated application
@@ -408,8 +407,6 @@ mkRhsLFInfo fvs
mkVapLFInfo fvs upd_flag fun_id args store_fun_in_vap
other -> mkClosureLFInfo False{-not top level-} fvs upd_flag []
- )
-
where
-- If the function is a free variable then it must be stored
-- in the thunk too; if it isn't a free variable it must be
@@ -422,7 +419,7 @@ The default case
~~~~~~~~~~~~~~~~
\begin{code}
mkRhsLFInfo fvs upd_flag args body
- = returnFC (mkClosureLFInfo False{-not top level-} fvs upd_flag args)
+ = mkClosureLFInfo False{-not top level-} fvs upd_flag args
\end{code}
diff --git a/ghc/compiler/codeGen/CgHeapery.lhs b/ghc/compiler/codeGen/CgHeapery.lhs
index 1e7b2c99c9..903d072cac 100644
--- a/ghc/compiler/codeGen/CgHeapery.lhs
+++ b/ghc/compiler/codeGen/CgHeapery.lhs
@@ -24,10 +24,10 @@ import CgUsages ( getVirtAndRealHp, setVirtHp, setRealHp,
initHeapUsage
)
import ClosureInfo ( closureSize, closureHdrSize, closureGoodStuffSize,
- slopSize, allocProfilingMsg, closureKind
+ slopSize, allocProfilingMsg, closureKind, ClosureInfo
)
import HeapOffs ( isZeroOff, addOff, intOff,
- SYN_IE(VirtualHeapOffset)
+ SYN_IE(VirtualHeapOffset), HeapOffset
)
import PrimRep ( PrimRep(..) )
\end{code}
diff --git a/ghc/compiler/codeGen/CgLetNoEscape.lhs b/ghc/compiler/codeGen/CgLetNoEscape.lhs
index 591e775f98..c3ee85bec2 100644
--- a/ghc/compiler/codeGen/CgLetNoEscape.lhs
+++ b/ghc/compiler/codeGen/CgLetNoEscape.lhs
@@ -29,8 +29,9 @@ import CgStackery ( mkVirtStkOffsets )
import CgUsages ( setRealAndVirtualSps, getVirtSps )
import CLabel ( mkStdEntryLabel )
import ClosureInfo ( mkLFLetNoEscape )
+import CostCentre ( CostCentre )
import HeapOffs ( SYN_IE(VirtualSpBOffset) )
-import Id ( idPrimRep )
+import Id ( idPrimRep, SYN_IE(Id) )
\end{code}
%************************************************************************
diff --git a/ghc/compiler/codeGen/CgLoop1.hs b/ghc/compiler/codeGen/CgLoop1.hs
new file mode 100644
index 0000000000..b5cd421c98
--- /dev/null
+++ b/ghc/compiler/codeGen/CgLoop1.hs
@@ -0,0 +1,9 @@
+module CgLoop1
+
+ (
+ module CgBindery,
+ module CgUsages
+ ) where
+
+import CgBindery
+import CgUsages
diff --git a/ghc/compiler/codeGen/CgLoop2.hs b/ghc/compiler/codeGen/CgLoop2.hs
new file mode 100644
index 0000000000..dc42921a0a
--- /dev/null
+++ b/ghc/compiler/codeGen/CgLoop2.hs
@@ -0,0 +1,7 @@
+module CgLoop2
+
+ (
+ module CgExpr
+ ) where
+
+import CgExpr
diff --git a/ghc/compiler/codeGen/CgMonad.lhs b/ghc/compiler/codeGen/CgMonad.lhs
index 18902fc84b..c7e18cdfe8 100644
--- a/ghc/compiler/codeGen/CgMonad.lhs
+++ b/ghc/compiler/codeGen/CgMonad.lhs
@@ -57,22 +57,28 @@ import CmdLineOpts ( opt_SccProfilingOn, opt_DoTickyProfiling,
opt_OmitBlackHoling
)
import HeapOffs ( maxOff,
- SYN_IE(VirtualSpAOffset), SYN_IE(VirtualSpBOffset)
+ SYN_IE(VirtualSpAOffset), SYN_IE(VirtualSpBOffset),
+ HeapOffset
)
+import CLabel ( CLabel )
import Id ( idType,
nullIdEnv, mkIdEnv, addOneToIdEnv,
modifyIdEnv, lookupIdEnv, rngIdEnv, SYN_IE(IdEnv),
- SYN_IE(ConTag), GenId{-instance Outputable-}
+ SYN_IE(ConTag), GenId{-instance Outputable-},
+ SYN_IE(Id)
)
import Maybes ( maybeToBool )
import PprStyle ( PprStyle(..) )
import PprType ( GenType{-instance Outputable-} )
-import Pretty ( ppAboves, ppCat, ppPStr )
+import Pretty ( Doc, vcat, hsep, ptext )
import PrimRep ( getPrimRepSize, PrimRep(..) )
import StgSyn ( SYN_IE(StgLiveVars) )
import Type ( typePrimRep )
import UniqSet ( elementOfUniqSet )
import Util ( sortLt, panic, pprPanic )
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable ( Outputable(..) )
+#endif
infixr 9 `thenC` -- Right-associative!
infixr 9 `thenFC`
@@ -688,13 +694,13 @@ lookupBindC name info_down@(MkCgInfoDown _ static_binds _)
Just this -> this
Nothing
-> pprPanic "lookupBindC:no info!\n"
- (ppAboves [
- ppCat [ppPStr SLIT("for:"), ppr PprShowAll name],
- ppPStr SLIT("(probably: data dependencies broken by an optimisation pass)"),
- ppPStr SLIT("static binds for:"),
- ppAboves [ ppr PprDebug i | (MkCgIdInfo i _ _ _) <- rngIdEnv static_binds ],
- ppPStr SLIT("local binds for:"),
- ppAboves [ ppr PprDebug i | (MkCgIdInfo i _ _ _) <- rngIdEnv local_binds ]
+ (vcat [
+ hsep [ptext SLIT("for:"), ppr PprShowAll name],
+ ptext SLIT("(probably: data dependencies broken by an optimisation pass)"),
+ ptext SLIT("static binds for:"),
+ vcat [ ppr PprDebug i | (MkCgIdInfo i _ _ _) <- rngIdEnv static_binds ],
+ ptext SLIT("local binds for:"),
+ vcat [ ppr PprDebug i | (MkCgIdInfo i _ _ _) <- rngIdEnv local_binds ]
])
\end{code}
diff --git a/ghc/compiler/codeGen/CgRetConv.hi-boot b/ghc/compiler/codeGen/CgRetConv.hi-boot
new file mode 100644
index 0000000000..7be70a88c6
--- /dev/null
+++ b/ghc/compiler/codeGen/CgRetConv.hi-boot
@@ -0,0 +1,7 @@
+_interface_ CgRetConv 1
+_exports_
+CgRetConv CtrlReturnConvention(VectoredReturn UnvectoredReturn) ctrlReturnConvAlg;
+_declarations_
+1 data CtrlReturnConvention = VectoredReturn PrelBase.Int | UnvectoredReturn PrelBase.Int;
+1 ctrlReturnConvAlg _:_ TyCon.TyCon -> CgRetConv.CtrlReturnConvention ;;
+
diff --git a/ghc/compiler/codeGen/CgRetConv.lhs b/ghc/compiler/codeGen/CgRetConv.lhs
index 6b773f964b..60597a70a4 100644
--- a/ghc/compiler/codeGen/CgRetConv.lhs
+++ b/ghc/compiler/codeGen/CgRetConv.lhs
@@ -35,7 +35,8 @@ import Constants ( mAX_FAMILY_SIZE_FOR_VEC_RETURNS,
)
import CmdLineOpts ( opt_ReturnInRegsThreshold )
import Id ( isDataCon, dataConRawArgTys,
- SYN_IE(DataCon), GenId{-instance Eq-}
+ SYN_IE(DataCon), GenId{-instance Eq-},
+ SYN_IE(Id)
)
import Maybes ( catMaybes )
import PprStyle ( PprStyle(..) )
@@ -47,9 +48,13 @@ import PrimOp ( primOpCanTriggerGC,
import PrimRep ( isFloatingRep, PrimRep(..) )
import TyCon ( tyConDataCons, tyConFamilySize )
import Type ( typePrimRep )
+import Pretty ( Doc )
import Util ( zipWithEqual, mapAccumL, isn'tIn,
pprError, pprTrace, panic, assertPanic
)
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable ( Outputable(..) )
+#endif
\end{code}
%************************************************************************
diff --git a/ghc/compiler/codeGen/CgTailCall.lhs b/ghc/compiler/codeGen/CgTailCall.lhs
index 136814ab26..87cd59c8b9 100644
--- a/ghc/compiler/codeGen/CgTailCall.lhs
+++ b/ghc/compiler/codeGen/CgTailCall.lhs
@@ -32,7 +32,7 @@ import CgRetConv ( dataReturnConvPrim, dataReturnConvAlg,
)
import CgStackery ( adjustRealSps, mkStkAmodes )
import CgUsages ( getSpARelOffset )
-import CLabel ( mkStdUpdCodePtrVecLabel, mkConUpdCodePtrVecLabel )
+import CLabel ( mkStdUpdCodePtrVecLabel, mkConUpdCodePtrVecLabel, CLabel )
import ClosureInfo ( nodeMustPointToIt,
getEntryConvention, EntryConvention(..),
LambdaFormInfo
@@ -40,13 +40,14 @@ import ClosureInfo ( nodeMustPointToIt,
import CmdLineOpts ( opt_DoSemiTagging )
import HeapOffs ( zeroOff, SYN_IE(VirtualSpAOffset) )
import Id ( idType, dataConTyCon, dataConTag,
- fIRST_TAG
+ fIRST_TAG, SYN_IE(Id)
)
import Literal ( mkMachInt )
import Maybes ( assocMaybe )
import PrimRep ( PrimRep(..) )
import StgSyn ( SYN_IE(StgArg), GenStgArg(..), SYN_IE(StgLiveVars) )
import Type ( isPrimType )
+import TyCon ( TyCon )
import Util ( zipWithEqual, panic, assertPanic )
\end{code}
diff --git a/ghc/compiler/codeGen/CgUsages.hi-boot b/ghc/compiler/codeGen/CgUsages.hi-boot
new file mode 100644
index 0000000000..af1fb46b7a
--- /dev/null
+++ b/ghc/compiler/codeGen/CgUsages.hi-boot
@@ -0,0 +1,5 @@
+_interface_ CgUsages 1
+_exports_
+CgUsages getSpBRelOffset;
+_declarations_
+1 getSpBRelOffset _:_ HeapOffs.VirtualSpBOffset -> CgMonad.FCode AbsCSyn.RegRelative ;;
diff --git a/ghc/compiler/codeGen/ClosureInfo.hi-boot b/ghc/compiler/codeGen/ClosureInfo.hi-boot
new file mode 100644
index 0000000000..fce0a2a75f
--- /dev/null
+++ b/ghc/compiler/codeGen/ClosureInfo.hi-boot
@@ -0,0 +1,18 @@
+_interface_ ClosureInfo 1
+_exports_
+ClosureInfo ClosureInfo closureKind closureLabelFromCI closureNonHdrSize closurePtrsSize closureSMRep closureSemiTag closureSizeWithoutFixedHdr closureTypeDescr closureUpdReqd entryLabelFromCI fastLabelFromCI infoTableLabelFromCI maybeSelectorInfo;
+_declarations_
+1 data ClosureInfo;
+1 closureKind _:_ ClosureInfo -> PrelBase.String ;;
+1 closureLabelFromCI _:_ ClosureInfo -> CLabel.CLabel ;;
+1 closureNonHdrSize _:_ ClosureInfo -> PrelBase.Int ;;
+1 closurePtrsSize _:_ ClosureInfo -> PrelBase.Int ;;
+1 closureSMRep _:_ ClosureInfo -> SMRep.SMRep ;;
+1 closureSemiTag _:_ ClosureInfo -> PrelBase.Int ;;
+1 closureSizeWithoutFixedHdr _:_ ClosureInfo -> HeapOffs.HeapOffset ;;
+1 closureTypeDescr _:_ ClosureInfo -> PrelBase.String ;;
+1 closureUpdReqd _:_ ClosureInfo -> PrelBase.Bool ;;
+1 entryLabelFromCI _:_ ClosureInfo -> CLabel.CLabel ;;
+1 fastLabelFromCI _:_ ClosureInfo -> CLabel.CLabel ;;
+1 infoTableLabelFromCI _:_ ClosureInfo -> CLabel.CLabel ;;
+1 maybeSelectorInfo _:_ ClosureInfo -> PrelBase.Maybe (Id.Id, PrelBase.Int) ;;
diff --git a/ghc/compiler/codeGen/ClosureInfo.lhs b/ghc/compiler/codeGen/ClosureInfo.lhs
index f48aeaee6b..6a7f408070 100644
--- a/ghc/compiler/codeGen/ClosureInfo.lhs
+++ b/ghc/compiler/codeGen/ClosureInfo.lhs
@@ -28,7 +28,7 @@ module ClosureInfo (
mkVirtHeapOffsets,
nodeMustPointToIt, getEntryConvention,
- blackHoleOnEntry, lfArity_maybe,
+ blackHoleOnEntry,
staticClosureRequired,
slowFunEntryCodeRequired, funInfoTableRequired,
@@ -75,14 +75,14 @@ import CLabel ( mkStdEntryLabel, mkFastEntryLabel,
)
import CmdLineOpts ( opt_SccProfilingOn, opt_ForConcurrent )
import HeapOffs ( intOff, addOff, totHdrSize, varHdrSize,
- SYN_IE(VirtualHeapOffset)
+ SYN_IE(VirtualHeapOffset), HeapOffset
)
import Id ( idType, getIdArity,
externallyVisibleId,
dataConTag, fIRST_TAG,
- isDataCon, isNullaryDataCon, dataConTyCon, dataConArity,
+ isDataCon, isNullaryDataCon, dataConTyCon,
isTupleCon, SYN_IE(DataCon),
- GenId{-instance Eq-}
+ GenId{-instance Eq-}, SYN_IE(Id)
)
import IdInfo ( ArityInfo(..) )
import Maybes ( maybeToBool )
@@ -91,13 +91,17 @@ import PprStyle ( PprStyle(..) )
import PprType ( getTyDescription, GenType{-instance Outputable-} )
import Pretty --ToDo:rm
import PrelInfo ( maybeCharLikeTyCon, maybeIntLikeTyCon )
-import PrimRep ( getPrimRepSize, separateByPtrFollowness )
+import PrimRep ( getPrimRepSize, separateByPtrFollowness, PrimRep )
import SMRep -- all of it
import TyCon ( TyCon{-instance NamedThing-} )
import Type ( isPrimType, splitForAllTy, splitFunTyExpandingDictsAndPeeking,
- mkFunTys, maybeAppSpecDataTyConExpandingDicts
+ mkFunTys, maybeAppSpecDataTyConExpandingDicts,
+ SYN_IE(Type)
)
import Util ( isIn, mapAccumL, panic, pprPanic, assertPanic )
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable ( Outputable(..) )
+#endif
\end{code}
The ``wrapper'' data type for closure information:
@@ -1018,10 +1022,18 @@ noUpdVapRequired binder_info
@lfArity@ extracts the arity of a function from its LFInfo
\begin{code}
+{- Not needed any more
+
lfArity_maybe (LFReEntrant _ arity _) = Just arity
-lfArity_maybe (LFCon con _) = Just (dataConArity con)
-lfArity_maybe (LFTuple con _) = Just (dataConArity con)
+
+-- Removed SLPJ March 97. I don't believe these two;
+-- LFCon is used for construcor *applications*, not constructors!
+--
+-- lfArity_maybe (LFCon con _) = Just (dataConArity con)
+-- lfArity_maybe (LFTuple con _) = Just (dataConArity con)
+
lfArity_maybe other = Nothing
+-}
\end{code}
%************************************************************************
@@ -1099,7 +1111,7 @@ fun_result_ty arity id
(arg_tys, res_ty) = splitFunTyExpandingDictsAndPeeking (idType id)
in
-- ASSERT(arity >= 0 && length arg_tys >= arity)
- (if (arity >= 0 && length arg_tys >= arity) then (\x->x) else pprPanic "fun_result_ty:" (ppCat [ppInt arity, ppr PprShowAll id, ppr PprDebug (idType id)])) $
+ (if (arity >= 0 && length arg_tys >= arity) then (\x->x) else pprPanic "fun_result_ty:" (hsep [int arity, ppr PprShowAll id, ppr PprDebug (idType id)])) $
mkFunTys (drop arity arg_tys) res_ty
\end{code}
@@ -1128,9 +1140,16 @@ Label generation.
\begin{code}
fastLabelFromCI :: ClosureInfo -> CLabel
fastLabelFromCI (MkClosureInfo id lf_info _)
+{- [SLPJ Changed March 97]
+ (was ok, but is the only call to lfArity,
+ and the id should guarantee to have the correct arity in it.
+
= case lfArity_maybe lf_info of
- Just arity -> mkFastEntryLabel id arity
- other -> pprPanic "fastLabelFromCI" (ppr PprDebug id)
+ Just arity ->
+-}
+ = case getIdArity id of
+ ArityExactly arity -> mkFastEntryLabel id arity
+ other -> pprPanic "fastLabelFromCI" (ppr PprDebug id)
infoTableLabelFromCI :: ClosureInfo -> CLabel
infoTableLabelFromCI (MkClosureInfo id lf_info rep)
diff --git a/ghc/compiler/codeGen/CodeGen.lhs b/ghc/compiler/codeGen/CodeGen.lhs
index 4f2e58556c..4865d4ebab 100644
--- a/ghc/compiler/codeGen/CodeGen.lhs
+++ b/ghc/compiler/codeGen/CodeGen.lhs
@@ -35,10 +35,15 @@ import ClosureInfo ( mkClosureLFInfo )
import CmdLineOpts ( opt_SccProfilingOn, opt_CompilingGhcInternals,
opt_EnsureSplittableC, opt_SccGroup
)
+import CostCentre ( CostCentre )
import CStrings ( modnameToC )
import FiniteMap ( FiniteMap )
+import Id ( SYN_IE(Id) )
import Maybes ( maybeToBool )
+import Name ( SYN_IE(Module) )
import PrimRep ( getPrimRepSize, PrimRep(..) )
+import Type ( SYN_IE(Type) )
+import TyCon ( TyCon )
import Util ( panic, assertPanic )
\end{code}
diff --git a/ghc/compiler/codeGen/SMRep.lhs b/ghc/compiler/codeGen/SMRep.lhs
index 7c46adff06..78934e8668 100644
--- a/ghc/compiler/codeGen/SMRep.lhs
+++ b/ghc/compiler/codeGen/SMRep.lhs
@@ -19,8 +19,11 @@ module SMRep (
IMP_Ubiq(){-uitous-}
-import Pretty ( ppStr )
+import Pretty ( text )
import Util ( panic )
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable
+#endif
\end{code}
%************************************************************************
@@ -218,7 +221,7 @@ instance Text SMRep where
MuTupleRep _ -> "MUTUPLE")
instance Outputable SMRep where
- ppr sty rep = ppStr (show rep)
+ ppr sty rep = text (show rep)
getSMInfoStr :: SMRep -> String
getSMInfoStr (StaticRep _ _) = "STATIC"