Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Alex D
GHC
Commits
10763ce0
Commit
10763ce0
authored
Aug 09, 2019
by
Ömer Sinan Ağacan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more documentation for typePrimRep1 stuff
[skip ci]
parent
cff44d86
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
compiler/codeGen/StgCmmClosure.hs
compiler/codeGen/StgCmmClosure.hs
+9
-2
compiler/simplStg/RepType.hs
compiler/simplStg/RepType.hs
+3
-1
compiler/simplStg/UnariseStg.hs
compiler/simplStg/UnariseStg.hs
+2
-0
No files found.
compiler/codeGen/StgCmmClosure.hs
View file @
10763ce0
...
...
@@ -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
)
...
...
compiler/simplStg/RepType.hs
View file @
10763ce0
...
...
@@ -472,7 +472,9 @@ typePrimRep ty = kindPrimRep (text "typePrimRep" <+>
(
typeKind
ty
)
-- | Like 'typePrimRep', but assumes that there is precisely one 'PrimRep' output;
-- an empty list of PrimReps becomes a VoidRep.
-- This assumption holds after unarise, see Note [Post-unarisation invariants].
-- Before unarise it may or may not hold.
-- See also Note [RuntimeRep and PrimRep] and Note [VoidRep]
typePrimRep1
::
HasDebugCallStack
=>
UnaryType
->
PrimRep
typePrimRep1
ty
=
case
typePrimRep
ty
of
...
...
compiler/simplStg/UnariseStg.hs
View file @
10763ce0
...
...
@@ -188,6 +188,8 @@ STG programs after unarisation have these invariants:
`StgCmmEnv.NonVoid`, for example.
* Alt binders (binders in patterns) are always non-void.
* Binders always have zero (for void arguments) or one PrimRep.
-}
{-# LANGUAGE CPP, TupleSections #-}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment