[LLVMdev] simulating c style unions in LLVM
Eli Friedman
eli.friedman at gmail.com
Mon Jun 29 23:20:48 PDT 2009
On Mon, Jun 29, 2009 at 11:09 PM, Carter Cheng<carter_cheng at yahoo.com> wrote:
>
> 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?
You have to write it using bitcasts. Try looking at llvm-gcc or clang
output for a rough outline.
-Eli
More information about the llvm-dev
mailing list