[LLVMdev] Memory allocation (or deallocation) model?

Chris Lattner sabre at nondot.org
Mon Dec 3 19:34:24 PST 2007

Yes, if/when an instruction is inserted into a block it is owned by  
that block.  If you remove the instruction you have to delete it or  
reinsert it into another block.



On Dec 3, 2007, at 6:59 PM, Jonathan Brandmeyer <jbrandmeyer at earthlink.net 
 > wrote:

> On Mon, 2007-12-03 at 18:56 -0800, Chris Lattner wrote:
>> Other IR objects (like instructions) have very simple ownership.  An
>> instruction is owned by its basic block, a bb is owned by the  
>> function, a
>> function is owned by thet module.
> If an instruction is initially allocated with its Instruction
> *insertAtEnd parameter defaulted to null, and then later appended to a
> BasicBlock, will the BasicBlock take ownership of the Instruction?
> Thanks,
> -Jonathan
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list