[LLVMdev] Adding fields in a already built type? (2)

St├ęphane Letz letz at grame.fr
Tue Jun 15 11:51:32 PDT 2010

> Nope, types are immutable once created.  The only thing you can do is "refine" opaque types to other types.  There is a section in the programmer's manual on this:
> http://llvm.org/docs/ProgrammersManual.html#TypeResolve
> -Chris

So I succeeded  in using a "PATypeHolder" for the "opaque" type, define a Type* with PointerType::getUnqual, prepare a field,  then use " refineAbstractTypeTo " to built the real type with this added field.

The thing is that I would need to do that repeatedly, that is progressively adding fields, generates code that access those ready fields, and "refine" the type step by step.

Is that even possible?


St├ęphane Letz

More information about the llvm-dev mailing list