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

Chris Lattner clattner at apple.com
Tue Jun 15 12:14:35 PDT 2010


On Jun 15, 2010, at 11:51 AM, Stéphane Letz wrote:

>> 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?

It would work, but sounds really inefficient.  What are you really trying to do here?

-Chris



More information about the llvm-dev mailing list