Converting unboxed sum types in StgCmm

Ryan Newton rrnewton at
Mon Sep 14 18:04:09 UTC 2015

> It seems to me that we just want to rewrite the case altogether into
> something that looks at the tag field of the data constructor. Also, in stg
> we use the same DataCon as in core, but after stg the unboxed sum case
> really only has one constructor (one with the union of all the fields),
> which makes it awkward to reuse the original DataCon.

Is there a problem with introducing a totally new datatype at this point in
the compile to represent the product (tag, wordish1, ..., wordishN, ptr1
... ptrM)?  Or, if it is an anonymous product, why can't it use existing
unboxed sum machinery?

Also, as an architecture thing, is there a reason this shouldn't be its own
stg->stg pass?

(P.S. "wordish" above has a weaselly suffix because as Dan pointed out,
some unboxed things are > 64 bits.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list