[LLVMdev] Allocate memory for a class

Tim Northover t.p.northover at gmail.com
Thu Apr 25 07:18:27 PDT 2013


On Thu, Apr 25, 2013 at 3:14 PM, B B <blackbox.dev.ml at gmail.com> wrote:
> > %call = call noalias i8* @_Znwm(i64 ptrtoint(%class.A* getelementptr(%class.A* null, i32 1) to i64))
> Yes, by "dynamically" I meant at IR code generation time. So if I
> understand, in your approach I need only to determine how many elements are
> in the structure. How can I get this value?

Actually, you don't even need that. The "1" means "one full struct"
rather than "after field 1" or anything similar. So it won't change
depending on how many fields are in the struct.

You might find this page from the docs useful:
http://llvm.org/docs/GetElementPtr.html

Tim.



More information about the llvm-dev mailing list