[LLVMdev] how to build a StructType incrementally

Jochen Wilhelmy j.wilhelmy at arcor.de
Mon Mar 14 08:56:59 PDT 2011


Hi!

StructType has no method for adding elements, but I'd like to build
a type incrementally, i.e. it starts empty and a global of the type exists.
then load instructions are added to a basic block and for each load
instruction an element to the type has to be added. Is there a way to do 
this?
For example I could first use UndefValues instead of load and then
do a replaceAllUsesWith when the type is finally known. Does this work
or is there a better solution?

-Jochen




More information about the llvm-dev mailing list