[LLVMdev] [PATCH] - Union types, attempt 2

me22 me22.ca at gmail.com
Thu Jan 14 21:25:24 PST 2010


2010/1/14 Talin <viridia at gmail.com>:
> The reason for doing it this way is that to construct a union, you really
> need 4 pieces of information: The type of the union, the type and value of
> the member to be initialized, and the index of which member is being
> initialized.

Does requiring the index mean that uniquing the union type will have
to re-write many of the corresponding insertvalue calls?

For instance, how would this round-trip?

    @foo = constant union { float, i32 } insertvalue union { i32,
float } undef, i32 4, 0
    @bar = constant union { i32, float } insertvalue union { float,
i32 } undef, i32 4, 1

I'm very glad to see a non-bitcast method of using unions, BTW.



More information about the llvm-dev mailing list