I am trying to create a boxed tagged datatype for a language where it is necessary to resolve the type at runtime. If I were writing an interpreter in C- it would most likely look something like this-
struct
{
unsigned tag;
union { long Int; double Float; .... }
}
Is there a standard way for constructing a type like this in LLVM?
So essentially the union just turns into bitcasts.
I know there was some discussion about adding a first-order union to
LLVM a bit back, but IIRC disagreement over semantics prevented it
from going anywhere.
Thanks both. I looked over the getelementptr and bitcast documentation but I am still a bit confused by one point. lets say i have something like this.
union
{
long Int; double float; long* IntRef;
}
Since pointer sizes are platform dependent if I am trying to use the union in question with an extern C function is it possible to make write the single definition in a platform independent way?