[LLVMdev] setting instruction parents
Misha Brukman
brukman at uiuc.edu
Tue May 31 06:47:17 PDT 2005
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
More information about the llvm-dev
mailing list