[LLVMdev] Tagged (Disjoint) Unions
Chris Lattner
sabre at nondot.org
Wed May 3 11:08:13 PDT 2006
On Wed, 3 May 2006, Ben Chambers wrote:
> I realize I *COULD* do it as a pair of an integer tag and the data, or any of
> the numerous ways that have been devised for representing such types in other
> functional languages.
Yup, you should treat LLVM as a slightly-higher level machine language.
As such, you should lower it into an explicit "union" (using pointer casts
etc).
> The problem that I see is that any optimizations for
> which LLVM needs types to perform would basically be prohibited this
> technique. So, I guess what I'm asking is, is there a way of representing
> tagged union types in LLVM that doesn't prevent providing accurate type
> information?
No, there isn't.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list