[LLVMdev] [patch] Writing ConstantUnions

Talin viridia at gmail.com
Wed Mar 17 11:02:15 PDT 2010


Wow, thanks so much for doing this. I haven't had much time to work on the
union stuff recently, work has been kind of crazy lately...

On Mon, Mar 15, 2010 at 2:30 PM, Tim Northover
<T.P.Northover at sms.ed.ac.uk>wrote:

> On Mon, Mar 15, 2010 at 11:51:47AM +0000, Tim Northover wrote:
> > Hello,
> >
> > I noticed a bit of a gap in the current code for unions: a
> > ConstantUnion cannot be written out to .ll.
>
> I've been continuing plugging gaps as I find them, which might not be
> the best way to solve this problem, but it has produced something that
> seems to do roughly what I expect.
>
> I've split it into three broadly independent patches
>
> 1: bitcodeUnion.patch. Again writing constants, I think we need to send
> the type index along with the actual data. I've (ab?)used the Aggregate
> abbreviation still.
>
> 2: asmUnion.patch. Code to emit constant unions as native assembly. Also
> includes handling of GEP.
>
> 3: layoutUnion.patch. I added functions to calculate the required
> size and alignment for unions. I wasn't sure whether to assume alignment
> was a power of 2. If not, that function probably needs changing to take
> a running lcm rather than maximum.
>
> Together these seem to allow both "llvm-as | llvm-dis" and "llvm-as |
> llc" on the following fragment:
>
> %un = type union { {i8, i8}, i32, i8 }
> @val = constant %un { i32 42 }
>
> I'm slightly concerned about the ".align 3" I get for arm (and x86 as I
> recall), but the same happens with structs so I don't think it's
> related.
>
> Any comments or requests to please stop bugging you fine.
>
> Tim.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100317/ae0a2d03/attachment.html>


More information about the llvm-dev mailing list