[LLVMdev] setting instruction parents

Patrick Meredith pmeredit at uiuc.edu
Tue May 31 06:53:49 PDT 2005


Yes, actually I was wrong.  It does change the parent, I just haven't gotten
enough sleep ;-)

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Misha Brukman
Sent: Tuesday, May 31, 2005 8:47 AM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] setting instruction parents

On Tue, May 31, 2005 at 08:42:26AM -0500, Patrick Meredith wrote:
> Currently, my way around this was to go into Instruction.h and make
> setParent() public.  I hope there is a better way?

You shouldn't be modifying the API like this ...
 
> When one moves an instruction from one BasicBlock to another, the
> instruction continues to believe that its parent is the original
> BasicBlock.  This is very undesirable.  Is there a way to set the
> parent or a way to move the instruction such that the parent is
> updated correctly?

See LICM::hoist() in lib/Transforms/Scalar/LICM.cpp for an example.

-- 
Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list