Moduleghc-9.10.3GHC2021
GHC.Types.RepType
- 4 types
- 22 values
- Packageghc-9.10.3
- Exports26
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceRepType.hs
Code generator views onto Types
4 declarationsGets rid of the stuff that prevents us from understanding the runtime representation of a type. Including: 1. Casts 2. Newtypes 3. Foralls 4. Synonyms But not type/data families, because we don't have the envs to hand.
Predicates on types
1 declarationTrue if the type has zero width.
Type representation for the code generator
14 declarationsLike typePrimRep, but assumes that there is at most 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]
Take a type of kind RuntimeRep and extract the list of PrimRep that
it encodes. See also Note [Getting from RuntimeRep to PrimRep].
The [PrimRep] is the final runtime representation after unarisation.
A PrimRep is an abstraction of a non-void type.
(Use PrimRepOrVoidRep if you want void types too.)
It contains information that the code generator needs
in order to pass arguments, return results,
and store values of this type. See also Note [RuntimeRep and PrimRep] in
GHC.Types.RepType and Note [VoidRep] in GHC.Types.RepType.
Constructors
BoxedRep !(Maybe Levity)Boxed, heap value
Int8RepSigned, 8-bit value
Int16RepSigned, 16-bit value
Int32RepSigned, 32-bit value
Int64RepSigned, 64 bit value
IntRepSigned, word-sized value
Word8RepUnsigned, 8 bit value
Word16RepUnsigned, 16 bit value
Word32RepUnsigned, 32 bit value
Word64RepUnsigned, 64 bit value
WordRepUnsigned, word-sized value
AddrRepA pointer, but not to a Haskell value (use BoxedRep)
FloatRepDoubleRepVecRep Int PrimElemRepA vector
Instances6Eq, Data, Ord, Show, Outputable, Binary
Eq PrimRepDefined in ghc-9.10.3 · GHC.Core.TyConData PrimRepDefined in ghc-9.10.3 · GHC.Core.TyConOrd PrimRepDefined in ghc-9.10.3 · GHC.Core.TyConShow PrimRepDefined in ghc-9.10.3 · GHC.Core.TyConOutputable PrimRepDefined in ghc-9.10.3 · GHC.Core.TyConBinary PrimRepDefined in ghc-9.10.3 · GHC.Core.TyCon
Convert a PrimRep back to a Type. Used only in the unariser to give types to fresh Ids. Really, only the type's representation matters. See also Note [RuntimeRep and PrimRep]
Count the arity of a function post-unarisation, including zero-width arguments.
The post-unarisation arity may be larger than the arity of the original function type. See Note [Unarisation].
Give the demands on the arguments of a Core constructor application (Con dc args) at runtime. Assumes the constructor is not levity polymorphic. For example unboxed tuples won't work.
Find the runtime representation of a TyCon. Defined here to avoid module loops. Returns a list of the register shapes necessary. See also Note [Getting from RuntimeRep to PrimRep]
Take a type of kind RuntimeRep and extract the list of PrimRep that
it encodes. See also Note [Getting from RuntimeRep to PrimRep].
The [PrimRep] is the final runtime representation after unarisation.
Returns Nothing if rep can't be determined. Eg. levity polymorphic types.
Take a kind (of shape `TYPE rr` or `CONSTRAINT rr`) and produce the PrimReps of values of types of this kind. See also Note [Getting from RuntimeRep to PrimRep] Returns Nothing if rep can't be determined. Eg. levity polymorphic types.
Discovers the primitive representation of a Type. Returns a list of PrimRep: it's a list because of the possibility of no runtime representation (void) or multiple (unboxed tuple/sum) See also Note [Getting from RuntimeRep to PrimRep] Returns Nothing if rep can't be determined. Eg. levity polymorphic types.
Unboxed sum representation type
6 declarationsGiven the arguments of a sum type constructor application, return the unboxed sum rep type.
E.g.
(# Int# | Maybe Int | (# Int#, Float# #) #)
We call `ubxSumRepType [ [IntRep], [LiftedRep], [IntRep, FloatRep] ]`, which returns [WordSlot, PtrSlot, WordSlot, FloatSlot]
INVARIANT: Result slots are sorted (via Ord SlotTy), except that at the head of the list we have the slot for the tag.