[LLVMdev] Emitting recursive types

Renato Golin renato.golin at linaro.org
Sun Feb 17 13:24:19 PST 2013


Hi James,

Last time I did this, there used to be PATypeHolder, which would take care
of incomplete types and replace all by complete when you finished, but more
than a year ago the StructType class was changed to accommodate that use
and the PATypeHolder was deprecated.

I believe you should use isOpaque and setBody functions from StructType.
Have a look at how Clang does it.

cheers,
--renato



On 17 February 2013 17:00, James Jackson <james.a.f.jackson.2 at googlemail.com
> wrote:

> Hi,
>
> I'm having a play with LLVM to implement a custom language (for my
> intellectual curiosity only). I'm wondering how, when using IRBuilder, one
> can can it to emit a recursive type definition? The code for TypeBuilder
> explicitly states that it doesn't handle recursive types...
>
> I'm after being able to emit, programmatically, stuff like the Named Types
> example in the Language Reference:
>
> %mytype = type { %mytype*, i32 }
>
> I'd welcome any advice!
>
> Yours,
> James Jackson.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130217/58f19456/attachment.html>


More information about the llvm-dev mailing list