summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-08-09 14:05:13 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2019-08-27 10:45:02 +0300
commit10763ce0fbf2ec88b16902cb9ba6c717bf400c13 (patch)
treee1b383c3f34d19b2cc7360fbdf7871b109799149 /compiler/codeGen
parentcff44d8686c1539ee77d34756d6b7908e120b96a (diff)
downloadhaskell-10763ce0fbf2ec88b16902cb9ba6c717bf400c13.tar.gz
Some more documentation for typePrimRep1 stuff
[skip ci]
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmClosure.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs
index 437219bf45..ac8db1268f 100644
--- a/compiler/codeGen/StgCmmClosure.hs
+++ b/compiler/codeGen/StgCmmClosure.hs
@@ -166,20 +166,27 @@ assertNonVoidStgArgs args = ASSERT(not (any (isVoidTy . stgArgType) args))
-- Why are these here?
+-- | Assumes that there is precisely one 'PrimRep' of the type. This assumption
+-- holds after unarise.
+-- See Note [Post-unarisation invariants]
idPrimRep :: Id -> PrimRep
idPrimRep id = typePrimRep1 (idType id)
- -- NB: typePrimRep1 fails on unboxed tuples,
- -- but by StgCmm no Ids have unboxed tuple type
-- See also Note [VoidRep] in RepType
+-- | Assumes that Ids have one PrimRep, which holds after unarisation.
+-- See Note [Post-unarisation invariants]
addIdReps :: [NonVoid Id] -> [NonVoid (PrimRep, Id)]
addIdReps = map (\id -> let id' = fromNonVoid id
in NonVoid (idPrimRep id', id'))
+-- | Assumes that arguments have one PrimRep, which holds after unarisation.
+-- See Note [Post-unarisation invariants]
addArgReps :: [NonVoid StgArg] -> [NonVoid (PrimRep, StgArg)]
addArgReps = map (\arg -> let arg' = fromNonVoid arg
in NonVoid (argPrimRep arg', arg'))
+-- | Assumes that the argument has one PrimRep, which holds after unarisation.
+-- See Note [Post-unarisation invariants]
argPrimRep :: StgArg -> PrimRep
argPrimRep arg = typePrimRep1 (stgArgType arg)