<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY>
Hi,<BR>
<BR>
I'm working on developing a programming language using LLVM as a backend, and it'd be very handy for me if LLVM had union support. I've been looking into getting the previous union implementation working properly for the last week or so, but I'm entirely new to the LLVM codebase so I thought I'd ask whether I'm barking up the wrong tree before doing a full-blown implementation. At the moment it seems like the best approach to get unions working is to treat them as a byte array and then have the insertvalue/extractvalue instructions automatically perform conversions to and from other types by bitcasting to/from an equivalent size i8 vector where the bytes can be got at individually.<BR>
<BR>
This approach seems to have a few problems. It gets vector instructions involved without any really good reason (I'm looking at the assembler output). It also seems to violate the ABI - my test function is trying to return the result in memory where I think it should be using registers (I'm JITing a function and calling it using GCC compiled code). The x86-86 ABI isn't very clear to me though.<BR>
<BR>
Anyway, please let me know if anyone sees major problems with this approach, or has any thoughts on the ABI issues.<BR>
<BR>
Regards,<BR>
<BR>
James
</BODY>
</HTML>