[LLVMdev] Beginner LLVM Questions
ajgopala at gmail.com
Wed Mar 25 16:25:41 PDT 2015
I've recently started using LLVM IR generation APIs for my project. The
documentation and LLC tool are pretty helpful, but I haven't been able to
find answer to the following -
All code that creates LLVM IR instructions using their APIs seems to "new"
instructions instead of creating them as stack variables.
auto x = new Alloca(...) vs. Alloca(...) x;
I am wondering what the ownership semantics are for the pointers that are
created? Do I have to call delete on these instruction objects. All code
that I've seen calls "delete engine;".
I am guessing that all this memory is owned by this Module object and when
the module is destroyed, all the memory occupied by these instructions are
also destroyed. By looking at some of the code, it seems that all these
instruction objects are created by using "placement new" ... Is this
It would be great if someone can explain the memory allocation schema used
by these APIs.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev